I have a custom device that is publishing a bunch of sensor data via MQTT discovery. I’m seeing the structure of the data in InfluxDB (entity names are in the right measurements) but no data. For example the following query returns no data:
SELECT mean("value") AS "mean_value"
FROM "homeassistant"."autogen"."%"
WHERE time > :dashboardTime: AND time < :upperDashboardTime:
AND "entity_id"='little_free_library_battery_soc'
GROUP BY time(:interval:), "entity_id"
FILL(null)
Is there something extra that needs done in either the MQTT sensor config or in the Influx config to get these logging? Maybe related is that the History view in HA does show/retain data for the sensors but there is nothing in the Logbook.
MQTT Discovery Config: homeassistant/sensor/little_free_library/battery_soc/config
{
"device": {
"name": "Little Free Library",
"model": "photon",
"manufacturer": "edalquist",
"identifiers": [
"library_monitor-E",
"2b002000XXXXXXXXXXXXXX"
]
},
"name": "Little Free Library Battery %",
"unique_id": "library_monitor-E_battery_soc",
"device_class": "battery",
"unit_of_measurement": "%",
"state_topic": "particle/ha/little_free_library/battery",
"value_template": "{{ value_json.soc }}",
"expire_after": 14400
}
MQTT State: particle/ha/little_free_library/battery
{
"voltage": 4.171500015,
"soc": 97.5,
"alert": "OFF",
"charging": "ON"
}
HA Entity Name: sensor.little_free_library_battery_soc
This is on:
- HA: 2020.12.2
- Influx Addon: 3.7.9