@@ -438,8 +438,8 @@ If it evaluates to `False` (or zero), the trigger is ignored and the trigger fun
438
438
439
439
` @time_active` takes one or more strings that specify time-based ranges. When any trigger
440
440
occurs (whether time, state or event), each time range specification is checked. If the
441
- current time doesn't fall within every range specified, the trigger is ignored and the trigger
442
- function is not called.
441
+ current time doesn't fall within any range specified, the trigger is ignored and the
442
+ trigger function is not called.
443
443
444
444
Each string specification can take two forms :
445
445
- ` "range(datetime_start, datetime_end)"` is satisfied if the current time is in the indicated
@@ -514,10 +514,18 @@ includes a period. This is one aspect where the interpreter behaves differently
514
514
515
515
# ### Accessing state variables
516
516
517
+ State variables can be used and set just by using them as normal Python variables. However, there could
518
+ be cases where you want to dynamically generate the variable name (eg, in a loop). These functions
519
+ allow you to get and set a variable using its string name. The set function also allows you to optionally
520
+ set the attributes, which you can't do if you are directly assigning to the variable :
521
+
517
522
` state.get(name)` returns the value of the state variable, or `None` if it doesn't exist
518
523
519
524
` state.set(name, value, attr=None)` sets the state variable to the given value, with the optional attributes.
520
525
526
+ Note that in Hass, all state variable values are coerced into strings. For example, if a state variable
527
+ has a numberic value, you will have to convert it to a numeric type (eg, using `int()` or `float()`).
528
+
521
529
# ### Service Calls
522
530
523
531
` service.call(domain, name, **kwargs={})` calls the service `domain.name` with the given keyword arguments as
0 commit comments