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
|
||||
SENSOR_ADDR = 0x77
|
||||
|
||||
DEVICE = {
|
||||
"manufacturer": "Dustin C. Hatch",
|
||||
"name": "RPi Thermostat Display",
|
||||
"model": "RPi Thermostat Display",
|
||||
"identifiers": [
|
||||
os.uname().nodename,
|
||||
],
|
||||
}
|
||||
|
||||
SENSOR_CONFIG = {
|
||||
"thermostat_temperature": {
|
||||
"device_class": "temperature",
|
||||
"name": "Thermostat Temperature",
|
||||
"device": DEVICE,
|
||||
"state_topic": TOPIC,
|
||||
"availability_topic": AVAILABILITY_TOPIC,
|
||||
"unit_of_measurement": "°C",
|
||||
|
@ -40,6 +49,7 @@ SENSOR_CONFIG = {
|
|||
"thermostat_pressure": {
|
||||
"device_class": "pressure",
|
||||
"name": "Thermostat Pressure",
|
||||
"device": DEVICE,
|
||||
"state_topic": TOPIC,
|
||||
"availability_topic": AVAILABILITY_TOPIC,
|
||||
"unit_of_measurement": "hPa",
|
||||
|
@ -48,6 +58,7 @@ SENSOR_CONFIG = {
|
|||
"thermostat_humidity": {
|
||||
"device_class": "humidity",
|
||||
"name": "Thermostat Humidity",
|
||||
"device": DEVICE,
|
||||
"state_topic": TOPIC,
|
||||
"availability_topic": AVAILABILITY_TOPIC,
|
||||
"unit_of_measurement": "%",
|
||||
|
|
Loading…
Reference in New Issue