How to use several state triggers in pyscript?

The pyscript documentation states that (emphasisis mine)

A single function can have any or all of the decorator types specified, but at most one of each type.

Since I believe this is a technical limitation, is there a smart way to use several state triggers for one action?

I currently use something like but there may be a better way?

@state_trigger("group.salon")
def group_salon(**data):
    check_mode(data)

@state_trigger("sun.sun")
def sun_sun(**data):
    check_mode(data)

def check_mode(data):
    log.info(data)

It depends entirely on what that “action” is. There’s nothing wrong with the way you’ve done it here. For other cases you could do:

@state_trigger(["group.salon","sun.sun"])
def group_or_sun(**data):
    log.info(data)
1 Like