-
Notifications
You must be signed in to change notification settings - Fork 58
-
This doesnt work (not unexpectedly):
log.debug(switch.44625077dc4f225ae658)
>>>
Exception in <jupyter_0> line 1:
switch.44625077dc4f225ae658.turn_on()
^
SyntaxError: invalid syntax (jupyter_0, line 1)
but this does:
log.debug(state.get("switch.44625077dc4f225ae658"))
>>>
on
So i want to do a state trigger like the following, but gets the same issue:
@state_trigger("switch.44625077dc4f225ae658 == 'on'")
def test():
log.debug('Hello World!')
>>>
Exception in <jupyter_0.test @state_trigger()> line 1:
switch.44625077dc4f225ae658 == 'on'
^
SyntaxError: invalid syntax (jupyter_0.test @state_trigger(), line 1)
These 2 are accepted but arent actually being triggered:
@state_trigger("switch.44625077dc4f225ae658")
or
@state_trigger("state.get('switch.44625077dc4f225ae658') == 'on'")
Anyone know the best way to get around this?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
The issue is that pyscript is having trouble figuring out which entities to watch when state.get()
is in the trigger condition. You can get around it with the watch
argument to state_trigger
. Like this:
@state_trigger('state.get("input_boolean.1_test") == "on"', watch=['input_boolean.1_test']) def test_on(): log.info('on')
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment