Anyone know what’s going on here, explain the issue, and suggest a solution? I re-flashed a Sonoff TH-16 with ESPHome and originally had a Lambda setup for the temperature entity to transmit just DegF. Down the road to present, I now need the original DegC & DegF transmitted. So I set up my YAML on the node to send both the original DegC and a templated DegF.
sensor:
- platform: dht
pin: GPIO14
temperature:
unit_of_measurement: "°C"
name: "TH16 #1 Temperature °C"
id: "temp"
humidity:
unit_of_measurement: "% HUM"
name: "TH16 #1 Humidity"
model: SI7021
update_interval: 30s
- platform: template
name: "TH16 #1 Temperature"
unit_of_measurement: "°F"
lambda: return (id(temp).state * (9.0/5.0) + 32.0);
I can see that the node is sending the HA API the correct data:
[13:48:47][D][sensor:092]: 'TH16 #1 Temperature': Sending state 63.68000 °F with 1 decimals of accuracy
[13:48:50][D][dht:048]: Got Temperature=17.6°C Humidity=49.9%
[13:48:50][D][sensor:092]: 'TH16 #1 Temperature °C': Sending state 17.60000 °C with 1 decimals of accuracy
[13:48:50][D][sensor:092]: 'TH16 #1 Humidity': Sending state 49.90000 % HUM with 0 decimals of accuracy
[13:49:20][D][dht:048]: Got Temperature=17.6°C Humidity=50.0%
[13:49:20][D][sensor:092]: 'TH16 #1 Temperature °C': Sending state 17.60000 °C with 1 decimals of accuracy
[13:49:20][D][sensor:092]: 'TH16 #1 Humidity': Sending state 50.00000 % HUM with 0 decimals of accuracy
[13:49:47][D][sensor:092]: 'TH16 #1 Temperature': Sending state 63.68000 °F with 1 decimals of accuracy
But when I lookup the entity and display on Lovelace, the units of measurement and displayed data is all DegF.
I’ve deleted the integration, reloaded, no change. I rebooted the host, server, etc, no change. Even looking in “core.registry_entity” I can see that each entity is formatted properly. I haven’t added a configuration.yaml entry for this entity either because I’d like the node to carry the calculation loads.
{
"entity_id": "sensor.th16_1_temperature",
"config_entry_id": "e0b165bb37ffe7518759daa2d076a654",
"device_id": "3a9445a4f3f45bd7446d462d70d52d50",
"area_id": null,
"unique_id": "esp-th16-1sensorth16_1_temperature",
"platform": "esphome",
"name": null,
"icon": null,
"disabled_by": null,
"capabilities": null,
"supported_features": 0,
"device_class": null,
"unit_of_measurement": "\u00b0F",
"original_name": "TH16 #1 Temperature",
"original_icon": ""
},
{
"entity_id": "sensor.th16_1_temperature_degc",
"config_entry_id": "e0b165bb37ffe7518759daa2d076a654",
"device_id": "3a9445a4f3f45bd7446d462d70d52d50",
"area_id": null,
"unique_id": "esp-th16-1sensorth16_1_temperature_c",
"platform": "esphome",
"name": null,
"icon": null,
"disabled_by": null,
"capabilities": null,
"supported_features": 0,
"device_class": null,
"unit_of_measurement": "\u00b0C",
"original_name": "TH16 #1 Temperature \u00b0C",
"original_icon": "mdi:thermometer"
},
What have I missed?