One more set of observation: I changed the name back to the original and reflashed. Once it started sending, HA matched up three sensors (humidity and soil moisture) with what was there before, but the temperature was discovered as sensor.test_temperature_2. Clearly it found a name collision but decided it was not the same and created a new one, and this one has the right units.
In the mqtt database the names matched, and old data is still present (i.e. it lumped it all together), so it was definitely HA that decided to separate to a test_temperature_2.
And it initially started sending correct temperatures (i.e. only the conversion in the esp8266).
Then, unrelated, was testing a generator getting ready for the storm, and my VM rebooted, which rebooted HA. After rebooting, the test_temperature_2 now was doing a double convert and about 170+ degrees.
Changed back to the new device name, and this time got a test_temperature_2 under the new device (for reasons unclear). And weirdly here it said “unavailable”. I deleted the whole mqtt integration, restarted HA, let it rediscover.
So I kept exploring and found I wasn’t getting correct discovery without the API in the esphome yaml. Not sure why, I thought that was for non-mqtt (this yaml is running on a whole different HA instance). Put it back, now started seeing the new sensor names, but still getting oddness.
Here’s an example. I’m actually getting the same sensor twice. When I look in mqtt explorer I see only one with that name. I have no idea why I’m seeing it twice in HA. Under developer tools, states there’s only one (without the extra decimal digits).
I looked in states, and here is the entire set of data in states, that corresponds roughly to the time of the graph shown (the data is a bit longer than the graph, but starts at the beginning). The 33.8 temps are a side effect of the device reporting 1C immediately after flashing. I flashed again about 1:58 so you see it twice in the data and in the graph. But only the top graph.
The bottom graph is… different. It’s about right for the data and time frame. But seems to exclude some of the data points that converted from 1c.
entity_id state attributes last_updated
------------------------ ----------- --------------------------------------------------------------------------------------------------- --------------------------
sensor.test2_temperature unavailable {"unit_of_measurement": "\u00b0C", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 17:46:05.677485
sensor.test2_temperature unknown {"unit_of_measurement": "\u00b0C", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 17:46:05.712339
sensor.test2_temperature 33.8 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 17:46:07.607957
sensor.test2_temperature unavailable {"unit_of_measurement": "\u00b0C", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 17:47:22.350852
sensor.test2_temperature 33.8 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 17:47:22.477755
sensor.test2_temperature 80.4 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 17:47:25.945021
sensor.test2_temperature unavailable {"unit_of_measurement": "\u00b0C", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 17:56:29.760103
sensor.test2_temperature 80.6 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 17:56:29.778625
sensor.test2_temperature 33.8 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 17:56:33.309839
sensor.test2_temperature unavailable {"unit_of_measurement": "\u00b0C", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 17:59:59.810984
sensor.test2_temperature 33.8 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 17:59:59.817962
sensor.test2_temperature 80.8 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:00:03.744866
sensor.test2_temperature 81.0 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:00:33.783447
sensor.test2_temperature 80.8 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:00:48.800983
sensor.test2_temperature 81.0 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:01:18.778602
sensor.test2_temperature 80.8 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:01:33.805346
sensor.test2_temperature 81.0 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:01:48.791092
sensor.test2_temperature 81.1 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:02:48.801180
sensor.test2_temperature 81.0 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:03:33.791581
sensor.test2_temperature 81.1 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:03:48.792408
sensor.test2_temperature 81.0 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:04:48.780504
sensor.test2_temperature 81.1 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:05:18.791504
sensor.test2_temperature 81.0 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:06:03.783631
sensor.test2_temperature 81.1 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:06:33.792941
sensor.test2_temperature 81.0 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:06:48.791981
sensor.test2_temperature 81.1 {"unit_of_measurement": "\u00b0F", "friendly_name": "Test2 Temperature", "icon": "mdi:thermometer"} 2019-08-29 18:09:03.790878
So what does all this mean – why am I getting two graphs? That’s usually due to different units of measurements, but here the unit of measurement is being inferred by HA. MQTT is getting degrees C entirely, and the esphome yaml has no units of measurement at all for temperature. But you can see it sometimes showing C and sometimes F, based on availability.
Which in turn is screwing up the graph?
There’s something here that is simply not working right.