Are you familiar with the templates tab on the front end? Try creating an expression for “z” in there, and it should allow you to quickly iterate and figure out the exact syntax.
Hi thank you for trying to help, I am not familiar with the template feature, only I have used this in order to test that the templates I am using here return the correct values, but I cannot find a way to figure out the correct syntax in order to do those calculations.
I am new to home assistant and I started using templates just a few days ago. I think for some of you experienced in templating would not be such a great deal to provide an example for me.
{% set x = is_state(‘binary_sensor.power1_sensor’, ‘on’) %}
{% set y = states.cover.balcony_bedroom_cover.attributes.current_position %}
{{ (x * 2) + y }}
This equation doesnt make sense though because you are setting x to a state. But thats how you set values to objects.
You should look up how to use JINJA. That’s the coding language that is supported in the templates.
this results in a number as it counts the time the power is on to one of the two switches in a sonoff dual.
by knowing the time I can calculate the position the shutter has been moved. so how can i set X as the result of the above template ? thank you