twrecked / hass-aarlo

Asynchronous Arlo Component for Home Assistant
GNU Lesser General Public License v3.0
397 stars 79 forks source link

new MQTT version sometimes returns json payload on baby arlo sensors #563

Open jurgenweber opened 2 years ago

jurgenweber commented 2 years ago

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.

twrecked commented 2 years ago

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?

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open for 365 days with no activity. This issue will be automatically closed within 28 days if there is no further activity.