File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
custom_components/pyscript Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 2222_LOGGER = logging .getLogger (LOGGER_PATH + ".trigger" )
2323
2424
25- STATE_RE = re .compile (r"[a-zA-Z]\w*\.[a-zA-Z]\w*(\.\ *)?$" )
25+ STATE_RE = re .compile (r"[a-zA-Z]\w*\.[a-zA-Z]\w*(\.[a-zA-Z\*]?[a-zA-Z] *)?$" )
2626
2727
2828def dt_now ():
@@ -739,7 +739,19 @@ async def trigger_watch(self):
739739 elif notify_type == "state" :
740740 new_vars , func_args = notify_info
741741
742- if "var_name" not in func_args or (func_args ["var_name" ] not in self .state_trig_ident_any and f"{ func_args ['var_name' ]} .*" not in self .state_trig_ident_any ):
742+ # check if any state_trig_ident_any starts with var_name
743+ any_match = False
744+ if "var_name" not in func_args :
745+ any_match = True
746+ else :
747+ for check_var in self .state_trig_ident_any :
748+ if check_var == func_args ['var_name' ]:
749+ any_match = True
750+ break
751+ if check_var .startswith (f"{ func_args ['var_name' ]} ." ):
752+ any_match = True
753+ break
754+ if not any_match :
743755 if self .state_trig_eval :
744756 trig_ok = await self .state_trig_eval .eval (new_vars )
745757 exc = self .state_trig_eval .get_exception_long ()
You can’t perform that action at this time.
0 commit comments