cmroche / OctoPrint-HomeAssistant

Home Assistant plugin for OctoPrint, enabling MQTT discovery of you device and sensors
110 stars 18 forks source link

New handling of float conversion in HA 2021.10 throws error #78

Closed Arquiteto closed 2 years ago

Arquiteto commented 2 years ago

Due to recent change in Home Assistant template handling float filter should now provide default value

Template warning: 'float' got invalid input 'None' when rendering template '{{value_json.currentZ|float}}' but no default was specified. Currently 'float' will return '0', however this template will fail to render in Home Assistant core 2021.12

So I propose value template for current Z should now look like this: {{value_json.currentZ|float(0)}}

In version HA 2021.12 the old template will fail to render

garyt72 commented 2 years ago

Created PR to resolve this issue:

https://github.com/cmroche/OctoPrint-HomeAssistant/pull/80#issue-1027023661

cmroche commented 2 years ago

Should be fixed on release 3.3.1, thanks for the report.