hass-aarlo
hass-aarlo copied to clipboard
new MQTT version sometimes returns json payload on baby arlo sensors
Hi
Love your work on this module btw, its super good.
With the current beta and the move to MQTT I have noticed for no reason I can fathom my Baby Arlo Sensors will return this instead of the floats they should be return to tell us the temp and humidity. Example:
{'minThreshold': 170, 'maxThreshold': 270, 'alertsEnabled': False, 'recordingEnabled': True, 'value': 253, 'alertState': 'clear', 'scalingFactor': 10, 'hysteresis': 20}
it might last 1 minute, 2 minutes or 5 minutes but at some point it'll come good and then fail again. Its a little problematic with some automations and things when its expecting a number.
Example of a full error in an automation:
2022-01-27 12:07:25 WARNING (MainThread) [homeassistant.helpers.template] Template warning: 'float' got invalid input '{'minThreshold': 170, 'maxThreshold': 270, 'alertsEnabled': False, 'recordingEnabled': True, 'value': 253, 'alertState': 'clear', 'scalingFactor': 10, 'hysteresis': 20}' when rendering template '{% if states.sensor.aarlo_temperature_babymonitor.state | float > states.input_number.nursery_max_temp.state | float %}true{% endif %}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2022.1
In this particular case it was failing for a minute or so.
ILooks like I'll have to handle both formats, I'll poke around.
Any change you can add a copy of both kinds of MQTT message to this bug?