I am having problems making my “auto / manual” function work. if I connect input_select.automanlysbag from configuration.yaml directly to value in “manuellysbag” in automation.yaml then it works. But when I try to do it with a script, I get no data in my BMS system.
I would like the end result to be like this:
(Off)Sluk = 0
(On)Tænd = 1
(Auto)Automatik = 2
What am I doing wrong?
configuration.yaml
automation: !include automations.yaml
script: !include scripts.yaml
#overstyring af udvendig lys og stik
input_select:
automanlysbag:
name: Manuel lys bag
initial: Automatik
options:
- Sluk
- Manuel
- Automatik
icon: mdi:target
@Jannik_Schallert Since your script is setting the value of an input_select your automation may work if you use the value of the input select but it also may be that you are not specifying the desired value is an integer in your template?
In either case I use this as my value template in my automation which gets it’s value from an input_number:
Hi Wellsy.
-Thanks for your reply
But… that does not work either…
I tried different things to extract the nummeric value from the script. to pass it on to my automation action, but nothing works.
i think the problem should be found in data template in the script, or in my automation action.
I have an input_number.Slider which works fine, it was “easy”, I did not have to convert a “string” to a “numeric” value like here…
I’ve gotten a little further, now it returns the value ‘0’ when the input_select is trigged…
I do not understand where it gets “0” from, I’v tried to replace ‘0’ with ‘2’ in the script, so it should not be returning ‘2’, but it is still returns ‘0’ to MODbus
@Jannik_Schallert Ok…Have you tested your value template you included in your script in the template editor? If yes…Is that giving you the expected values?
aaarh…
I didn’t know there was such a feature. I have only messed with HASS for a month
Now it works.
i removed my script, and made it in automations.yaml instead value: '{% if is_state(“input_select.automanlysbag”, “Sluk”) %} 0 {% elif is_state(“input_select.automanlysbag”, “Tænd”) %} 1 {% else %} 2 {% endif %}'