Replies: 1 comment
-
At first sight, it should work. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is not a specific question about
pyscript
but rather its use and a request for fresh eyes on a very simple piece of code.I wanted to write automation that pulls up window covers when someone leaves. It is part of several other automation that works great. (explanation of the code below the block)
The idea is that when
person.martin
switches tonot_home
some covers get pulled up (viacover.open_cover(entity_id="cover.martin_volets")
). Since I want to do it only once, the first timemartin
leaves, I use a flag (pyscript.martin_one_time_volets_up
) that gets reset every night at 04:00. If the covers are pulled up automatically once, they will not do so another time in one day (I will improve that later).The problem: I never get into the
if
condition. When forcefully switchingperson.martin
tonot_home
, I get the following in the logs:This means that
pyscript.martin_one_time_volets_up
isFalse
(good! → this is the first time today the script is triggered)person.martin
isnot_home
(good! → just a double check but the trigger already tells us so)And yet
if not pyscript.martin_one_time_volets_up:
is not stepped into (no logs, and no covers up either)This must be something horribly obvious, I apologize in advance if so, but I am looking at this simple code and am stuck.
Beta Was this translation helpful? Give feedback.
All reactions