- id: vedlikeholdslading
alias: Automatisk vedlikeholdslading
trigger:
- platform: numeric_state
entity_id: sensor.ladeniva
below: 78
- platform: numeric_state
entity_id: sensor.ladeniva
above: 80
action:
service_template: >-
{% if states("sensor.ladeniva") | float < 79 %}
switch.turn_on
{% elif states("sensor.ladeniva") | float > 79 %}
switch.turn_off
{% endif %}
entity_id: switch.osram_plug_01_000d1a23_3
The reason I want this in one automation is that I want to be able to turn ut off sometimes. But that aside, the rule works fine. When “ladeniva” (chargelevel) falls below 78 the charger is turned on (switch.osram). And when it is above 80 it stops/turns off.
Most of the time this works but sometimes it doesnt. Why it fails I am not sure. In the logs there are no clues, but maybe I could log something special? Not sure if the automation triggers but the switch fails or similar. What is baffling is that even if the ladenivĂĄ keeps dropping the automation seems to never fire again. I would expect it to fire another time when it goes lower (like 77 or 76) but that never happens. One time I saw it pass the 80 aswell when charging and not stop. Again same story, just continued to charge until 100 without ever trigging again. Could I force it to check every time the ladeniva sensor gets a new value?
Any tips? Right now I am trying to add more triggers on 77, 76 and 75. Just to double safeguard, but that is more like a workaround…