right, mine too
it was even hard to write it down correct, but still that is what is done with the climate situation
and that is why a lot off people struggle so much
Yeah, I think it’s because we all see the problem from a different perspective, which is probably why you’re good with python and I really really really struggle with it.
in general i see a whole lot of people trying to combine things to a big problem.
and in my experience it is always the best way to splitt things up.
in science they splitt everything up to the smallest possible building bricks.
and use a few bricks together to create new bricks.
here you see people who have 10 automations and they want to create 1 from it.
just the other way around.
to built a wall you create 1 stone after another and then glue them together with cement.
if you take all the clay you need for the bricks and the cement together and trow it on 1 pile and try to build a wall from it you will never succeed.
but i am glad that @typeonegative figured it out, so its not that big of a problem that i am talking a bit phylosifical here
(still puzzles me why @typeonegative did ask my advise here, because i havent shown a lot off knowledge about this kind of things and other do)
then i only can say: thank you
but like all other people i can only be smart if i know how to use the tools
and there are others here that use this kind of tools way better then me.
I know i’m late to the party but it looks like you are just trying to turn off what is on.
This chunk of code should work better for expansion in the future if you add more of these devices. Your current solution would be a pain to manage if you add 1 more switch/climate device. So to clarify, It’s no better than the solutions you already have but it would be better for expansion because you just add to the sensor list and climate list.
entity_id: >
{% set sensors = [ 'binary_sensor.aken_arvuti', 'binary_sensor.aken_telekas', 'binary_sensor.aken_magala' ] %}
{% set climates = ['climate.elutuba', 'climate.trepp', 'climate.magala' ] %}
{%- for sensor in sensors if is_state(sensor, 'on') %}
{{- climates[sensors.index(sesnor)] }},
{% endfor %}
I am trying to create something similar to what you did above, as I am planning to add more things it is becoming complicated and I want to simplify things.
Ah, You actually have to list out what you have, you cannot create a loop. Jinja always returns a string. Jinja always returns 1 value. With those 2 limitations, you cannot create a for loop to turn on/off multiple entities in a single service.