Just to give some background for the purpose of this automation :
Using wallbox integration
for (hopefully) be able to set the charger amperage level based on time .
I tried with input_numer sensor:
sensor:
- platform: template
sensors:
ev_max_amper:
friendly_name: "ev max current allow"
value_template: >
{% set state = states('sensor.time') %}
{% if '22:00' <= state <= '22:59' %}
18
{% elif '23:00' <= state <= '07:30' %}
21
{% else %}
17
{% endif %}
I tried also add seconds but it not working properly
What do you mean by “not working properly” ? Error message ? Wrong value ? Because the value_template is giving me a correct value when I test in development tools…
By the way, this is the old way to create a template sensor (still works but not recommended), the new way should be:
template:
- sensor:
- name: "ev_max_amper"
state: >
{% set state = states('sensor.time') %}
{% if '22:00' <= state <= '22:59' %}
18
{% elif '23:00' <= state <= '07:30' %}
21
{% else %}
17
{% endif %}
@browetd
I let it ran exactly as i mention in first post and it didnt set the value correctly,
It look the “else if” condition met incorrectly .
from other hand - when i also test it , it looks fine so i don’t really know why its happening .
I change the sensor as you suggested - and will let it run with debug .
@pedolsky - thanks for your suggestion will consider it as well,
do u see any reason input_number not will not work based on time ?
In the documentation you linked for the wallbox, it said something about number entity (and not input_number). But I may be wrong as I don’t use that integration.