Skip to content

Using hold_off=None and watch=None for @time_active and @state_trigger result in a validation error #819

@ALERTua

Description

@ALERTua

Two observations:

TypeError: function 'cat_toilet_someone_pooping' defined in file.cat_toilet: decorator @time_active keyword 'hold_off' expected float for dictionary value @ data['hold_off']
@time_active("range(9:00, 23:00)", hold_off=None)
def cat_toilet_someone_pooping(trigger_type=None, var_name=None, value=None, old_value=None, context=None, **kwargs):
    ...

documentation:

image

stubs: def time_active(*time_spec: str, hold_off: int | float | None = None) -> Callable[..., Any]:

Second one:

TypeError: function 'fnc' defined in apps.device_availability: decorator @state_trigger keyword 'watch' should be type list or set for dictionary value @ data['watch']

this was about a call of @state_trigger with watch=None

documentation:

image

stubs:

def state_trigger(
    *str_expr: str | list[str] | set[str],
    state_hold: int | float | None = None,
    state_hold_false: int | float | None = None,
    state_check_now: bool = False,
    kwargs: dict | None = None,
    watch: list[str] | set[str] | None = None,
) -> Callable[..., Any]:

It would be nice to be able to provide watch=None for the @state_trigger to get the list of the watched entity_ids from the trigger strings, as it would be with no watch kwarg provided at all.

via #818
ping @dmamelin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions