I have this issue with a sensor using get entities node: I made a flow that search for every sensor of type=battery and send a notification on my phone for every on of them that are under 20%.
This is how I configured the node:
[
{
"id": "9a4f18eb79c66a52",
"type": "api-current-state",
"z": "bba1fec41b4a5a15",
"name": "Mi Band 4 Battery level",
"server": "4df5e94b.b41c18",
"version": 3,
"outputs": 1,
"halt_if": "",
"halt_if_type": "str",
"halt_if_compare": "is",
"entity_id": "sensor.miband4_battery",
"state_type": "str",
"blockInputOverrides": false,
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "entityState"
},
{
"property": "data",
"propertyType": "msg",
"value": "",
"valueType": "entity"
}
],
"for": "0",
"forType": "num",
"forUnits": "minutes",
"override_topic": false,
"state_location": "payload",
"override_payload": "msg",
"entity_location": "data",
"override_data": "msg",
"x": 390,
"y": 900,
"wires": [
[
"9082ba7ef5b59a92"
]
]
},
{
"id": "4df5e94b.b41c18",
"type": "server",
"name": "Home Assistant",
"version": 5,
"addon": true,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": false,
"heartbeatInterval": 30,
"areaSelector": "friendlyName",
"deviceSelector": "friendlyName",
"entitySelector": "friendlyName",
"statusSeparator": "at: ",
"statusYear": "hidden",
"statusMonth": "short",
"statusDay": "numeric",
"statusHourCycle": "h23",
"statusTimeFormat": "h:m",
"enableGlobalContextStore": true
}
]
The problem is that sometimes I get the wrong state value from this node. For example now my sensor.miband4_battery is at 90%, but from the get entities node it still results in 14%.
These are the logs of the results from the get entities node and a simple current state node in the same moment:
get entities
{"entity_id":"sensor.miband4_battery","state":"14","attributes":{"friendly_name":"Batteria","unit_of_measurement":"%","last_updated":"2023-09-18T15:35:59+0200","icon":"mdi:battery","device_class":"battery"},"last_changed":"2023-09-18T13:35:57.470Z","last_updated":"2023-09-18T13:35:57.470Z","context":{"id":"01HAM82G0Y82G2Y41QJ4WVQM9S","parent_id":null,"user_id":"2c276cbe0f07473d81d3ecd2209f4536"},"timeSinceChangedMs":83759306}
current state
{"_msgid":"7268103a40345cd0","payload":"90","topic":"","data":{"entity_id":"sensor.miband4_battery","state":"90","attributes":{"friendly_name":"Batteria","unit_of_measurement":"%","last_updated":"2023-09-19T13:58:58+0200","icon":"mdi:battery","device_class":"battery"},"last_changed":"2023-09-19T11:58:58.106Z","last_updated":"2023-09-19T11:58:58.106Z","context":{"id":"01HAPMXM1TKTX2V72DDGAZTTJQ","parent_id":null,"user_id":"2c276cbe0f07473d81d3ecd2209f4536"},"timeSinceChangedMs":3178697}}
Am I doing something wrong?