Replies: 1 comment
-
Template needs to be fixed to account for 0 values. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the bug
Not 100% sure if this is really an issue with solaredge-modbus-multi, but I find ZeroDivisionErrors in my Homeassistant-Log from time to time (see Diagnostic File below).
Expected behavior
Null values of sensors should not produce log errors.
Screenshots
No response
Diagnostic File
2024-09-25 17:36:21.580 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ZeroDivisionError: float division by zero') while processing template 'Template<template=({% set wattsToCharge = ((states('sensor.solaredge_b1_maximum_energy') | float(0) 1000)/100)(100 - states('sensor.solaredge_b1_state_of_energy') | float) %} {% set totalhrs = (wattsToCharge | float / states('sensor.solaredge_b1_dc_power') | float) | round(2) %} {{ '%02d:%02d' | format((totalhrs | int),((totalhrs60) % 60) | round(0)) }}) renders=980>' for attribute '_attr_native_value' in entity 'sensor.solar_battery_time_to_charge'
2024-09-25 17:39:34.437 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ZeroDivisionError: float division by zero') while processing template 'Template<template=({% set batterypower = (states('sensor.solaredge_b1_dc_power') | int * -1) %} {% set wattsToDischarge = ((states('sensor.solaredge_b1_maximum_energy') | float(0) 1000)/100)(states('sensor.solaredge_b1_state_of_energy') | float) %} {% set totalhrs = (wattsToDischarge | float / batterypower | float) | round(2) %} {{ '%02d:%02d' | format((totalhrs | int),((totalhrs60) % 60) | round(0)) }}) renders=18>' for attribute '_attr_native_value' in entity 'sensor.solar_battery_time_to_empty'
Debug logs
No response
Home Assistant Version
2024.9.3
solaredge-modbus-multi Version
3.0.0
Installation Type
Container
Read the Instructions
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions