sensor: Add device metadata
Associating sensor entities with a device improves organization within the Home Assistant UI.master
parent
e26363a4c8
commit
257bac9d86
|
@ -27,11 +27,20 @@ AVAILABILITY_TOPIC = f"{TOPIC}/availability"
|
||||||
I2CPORT = 1
|
I2CPORT = 1
|
||||||
SENSOR_ADDR = 0x77
|
SENSOR_ADDR = 0x77
|
||||||
|
|
||||||
|
DEVICE = {
|
||||||
|
"manufacturer": "Dustin C. Hatch",
|
||||||
|
"name": "RPi Thermostat Display",
|
||||||
|
"model": "RPi Thermostat Display",
|
||||||
|
"identifiers": [
|
||||||
|
os.uname().nodename,
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
SENSOR_CONFIG = {
|
SENSOR_CONFIG = {
|
||||||
"thermostat_temperature": {
|
"thermostat_temperature": {
|
||||||
"device_class": "temperature",
|
"device_class": "temperature",
|
||||||
"name": "Thermostat Temperature",
|
"name": "Thermostat Temperature",
|
||||||
|
"device": DEVICE,
|
||||||
"state_topic": TOPIC,
|
"state_topic": TOPIC,
|
||||||
"availability_topic": AVAILABILITY_TOPIC,
|
"availability_topic": AVAILABILITY_TOPIC,
|
||||||
"unit_of_measurement": "°C",
|
"unit_of_measurement": "°C",
|
||||||
|
@ -40,6 +49,7 @@ SENSOR_CONFIG = {
|
||||||
"thermostat_pressure": {
|
"thermostat_pressure": {
|
||||||
"device_class": "pressure",
|
"device_class": "pressure",
|
||||||
"name": "Thermostat Pressure",
|
"name": "Thermostat Pressure",
|
||||||
|
"device": DEVICE,
|
||||||
"state_topic": TOPIC,
|
"state_topic": TOPIC,
|
||||||
"availability_topic": AVAILABILITY_TOPIC,
|
"availability_topic": AVAILABILITY_TOPIC,
|
||||||
"unit_of_measurement": "hPa",
|
"unit_of_measurement": "hPa",
|
||||||
|
@ -48,6 +58,7 @@ SENSOR_CONFIG = {
|
||||||
"thermostat_humidity": {
|
"thermostat_humidity": {
|
||||||
"device_class": "humidity",
|
"device_class": "humidity",
|
||||||
"name": "Thermostat Humidity",
|
"name": "Thermostat Humidity",
|
||||||
|
"device": DEVICE,
|
||||||
"state_topic": TOPIC,
|
"state_topic": TOPIC,
|
||||||
"availability_topic": AVAILABILITY_TOPIC,
|
"availability_topic": AVAILABILITY_TOPIC,
|
||||||
"unit_of_measurement": "%",
|
"unit_of_measurement": "%",
|
||||||
|
|
Loading…
Reference in New Issue