"no state history" on plant sensors history-graph

I have setup some plant sensors that publish data by mqtt which works fine, the data updates as it should, I get warnings when the moisture is too low etc, but I am having trouble showing the history in some history-graph cards. Any idea where to start?

configuration.yaml:
    plant:
      Dracaena marginata:
        sensors:
          moisture: sensor.plant_1_moisture
          battery: sensor.plant_1_battery
          brightness: sensor.plant_1_brightness
        min_moisture: 20

ui-lovelace.yaml:
    type: history-graph
    title: Dracaena marginata
    entities:
      - sensor.plant_1_moisture

What version of HA are you on? There were problems with history and sensors on 0.80.x.

Running 0.81.2 at the moment.

I have the same issue - using a few xiaomi plant sensors via plantgateway and mqtt.

Just added a new sensor - config same as previous, and this one now has history. The others dont.

version 0.82.1

Yeah, I noticed the same. But after a few days history disappeared on the new ones I added too…

just checked - yup - gone.

Guess I’ll need to start learning how to debug.

I think this is it:

2018-11-21 14:23:34 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.139719447668552] Received {'type': 'config/entity_registry/get', 'entity_id': 'sensor.mqtt_plant4_conductivity', 'id': 19}
2018-11-21 14:23:34 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.139719447668552] Sending {'id': 19, 'type': 'result', 'success': False, 'error': {'code': 3, 'message': 'Entity not found'}}
2018-11-21 14:23:34 INFO (MainThread) [homeassistant.components.http.view] Serving /api/history/period/2018-11-20T03:23:34.430Z to 192.168.1.130 (auth: True)
2018-11-21 14:23:34 DEBUG (SyncWorker_26) [homeassistant.components.recorder.util] converting 44 rows to native objects took 0.007706s
2018-11-21 14:23:34 DEBUG (SyncWorker_26) [homeassistant.components.history] get_significant_states took 0.010032s
2018-11-21 14:23:34 DEBUG (SyncWorker_26) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001357s
2018-11-21 14:23:34 DEBUG (SyncWorker_26) [homeassistant.components.history] getting 0 first datapoints took 0.005808s
2018-11-21 14:23:34 DEBUG (MainThread) [homeassistant.components.history] Extracted 0 states in 0.016811s
2018-11-21 14:23:36 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.139719447668552] Received {'type': 'config/entity_registry/get', 'entity_id': 'sensor.mqtt_plant4_temperature', 'id': 20}
2018-11-21 14:23:36 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.139719447668552] Sending {'id': 20, 'type': 'result', 'success': False, 'error': {'code': 3, 'message': 'Entity not found'}}
2018-11-21 14:23:36 INFO (MainThread) [homeassistant.components.http.view] Serving /api/history/period/2018-11-21T03:23:09.029Z to 192.168.1.130 (auth: True)
2018-11-21 14:23:36 DEBUG (SyncWorker_12) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003167s
2018-11-21 14:23:36 DEBUG (SyncWorker_12) [homeassistant.components.history] get_significant_states took 0.005823s
2018-11-21 14:23:36 DEBUG (SyncWorker_12) [homeassistant.components.history] getting 0 first datapoints took 0.000004s
2018-11-21 14:23:36 DEBUG (MainThread) [homeassistant.components.history] Extracted 0 states in 0.006953s
2018-11-21 14:23:38 INFO (SyncWorker_32) [homeassistant.components.device_tracker.nmap_tracker] Scanning...
2018-11-21 14:23:38 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.139719447668552] Received {'type': 'config/entity_registry/get', 'entity_id': 'sensor.mqtt_plant4_temperature', 'id': 21}
2018-11-21 14:23:38 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.139719447668552] Sending {'id': 21, 'type': 'result', 'success': False, 'error': {'code': 3, 'message': 'Entity not found'}}
2018-11-21 14:23:38 INFO (MainThread) [homeassistant.components.http.view] Serving /api/history/period/2018-11-21T03:23:36.530Z to 192.168.1.130 (auth: True)
2018-11-21 14:23:38 DEBUG (SyncWorker_20) [homeassistant.components.recorder.util] converting 0 rows to native objects took 0.004080s
2018-11-21 14:23:38 DEBUG (SyncWorker_20) [homeassistant.components.history] get_significant_states took 0.007226s
2018-11-21 14:23:38 DEBUG (SyncWorker_20) [homeassistant.components.history] getting 0 first datapoints took 0.000002s
2018-11-21 14:23:38 DEBUG (MainThread) [homeassistant.components.history] Extracted 0 states in 0.008375s

Entity not found suggests a problem. lol.

and now I’m stuck

did you hide the mqtt sensors for the plant in the UI? If yes, no history will be stored.

check if the plant sensors have that attribute (and remove it, if yes):

hidden: true

You are absolutely correct! Out of old habit I have been hiding sensors, didn’t catch that. Works as it should now, thanks alot :slight_smile:

OK - But how do I stop the sensors being shown on default page?

(and any idea why the plant cards don’t show the current value until plantgateway does an update - even though i have the MQTT sensors set to force_update = true

Switch to Lovelace :slight_smile:

Might be because of missing retain flag.

nope. retain is set by plantgateway, and MQTT sensors set to force_update = true