Merge remote-tracking branch 'origin/next' into rc

This commit is contained in:
Paulus Schoutsen 2018-04-06 10:29:52 -04:00
commit 9bbbf21643
38 changed files with 844 additions and 97 deletions

View file

@ -68,6 +68,7 @@ Home Assistant adds extensions to allow templates to access all of the current s
- `states.sensor.temperature` returns the state object for `sensor.temperature`.
- `states('device_tracker.paulus')` will return the state string (not the object) of the given entity or `unknown` if it doesn't exist.
- `is_state('device_tracker.paulus', 'home')` will test if the given entity is specified state.
- `state_attr('device_tracker.paulus', 'battery')` will return the value of the attribute or None if it doesn't exist.
- `is_state_attr('device_tracker.paulus', 'battery', 40)` will test if the given entity is specified state.
- `now()` will be rendered as current time in your time zone.
- For specific values: `now().second`, `now().minute`, `now().hour`, `now().day`, `now().month`, `now().year`, `now().weekday()` and `now().isoweekday()`
@ -85,6 +86,10 @@ Home Assistant adds extensions to allow templates to access all of the current s
- Filter `timestamp_custom(format_string, local_boolean)` will convert an UNIX timestamp to a custom format, the use of a local timestamp is default, supporting [Python format options](https://docs.python.org/3/library/time.html#time.strftime).
- Filter `max` will obtain the largest item in a sequence.
- Filter `min` will obtain the smallest item in a sequence.
- Filter `regex_match(string, find, ignorecase=FALSE)` will match the find expression at the beginning of the string using regex.
- Filter `regex_search(string, find, ignorecase=FALSE)` will match the find expression anywhere in the string using regex.
- Filter `regex_replace(string, find='', replace='', ignorecase=False)` will replace the find expression with the replace string using regex.
- Filter `regex_findall_index(string, find='', index=0, ignorecase=False)` will find all regex matches of find in string and return the match at index (findall returns an array of matches).
[strp-format]: https://docs.python.org/3.6/library/datetime.html#strftime-and-strptime-behavior
@ -114,7 +119,7 @@ The next two statements result in same value if state exists. The second one wil
### {% linkable_title Attributes %}
Print an attribute if state is defined
Print an attribute if state is defined. Both will return the same thing but the last one you can specify entity_id from a variable.
```text
{% raw %}{% if states.device_tracker.paulus %}
@ -124,6 +129,18 @@ Print an attribute if state is defined
{% endif %}{% endraw %}
```
With strings
```text
{% raw %}{% set tracker_name = "paulus"%}
{% if states("device_tracker." + tracker_name) != "unknown" %}
{{ state_attr("device_tracker." + tracker_name, "battery")}}
{% else %}
??
{% endif %}{% endraw %}
```
### {% linkable_title Sensor states %}
Print out a list of all the sensor states.

View file

@ -1422,7 +1422,7 @@ Name of the event to subscribe to. Can be a standard Home Assistant event such a
One or more keyword value pairs representing App specific parameters to supply to the callback. If the keywords match values within the event data, they will act as filters, meaning that if they don't match the values, the callback will not fire.
As an example of this, a Minimote controller when activated will generate an event called `zwave.scene_activated`, along with 2 pieces of data that are specific to the event - `entity_id` and `scene`. If you include keyword values for either of those, the values supplied to the `listen_event()1 call must match the values in the event or it will not fire. If the keywords do not match any of the data in the event they are simply ignored.
As an example of this, a Minimote controller when activated will generate an event called `zwave.scene_activated`, along with 2 pieces of data that are specific to the event - `entity_id` and `scene`. If you include keyword values for either of those, the values supplied to the `listen_event()` call must match the values in the event or it will not fire. If the keywords do not match any of the data in the event they are simply ignored.
Filtering will work with any event type, but it will be necessary to figure out the data associated with the event to understand what values can be filtered on. This can be achieved by examining Home Assistant's logfiles when the event fires.

View file

@ -15,6 +15,7 @@ The discovery of MQTT devices will enable one to use MQTT devices with only mini
Supported by MQTT discovery:
- [Binary sensors](/components/binary_sensor.mqtt/)
- [Cameras](/components/camera.mqtt/)
- [Covers](/components/cover.mqtt/)
- [Fans](/components/fan.mqtt/)
- [Lights](/components/light.mqtt/)

View file

@ -94,7 +94,8 @@ For more information about jinja2, visit [jinja2 documentation](http://jinja.poc
{% linkable_title mqtt %}
This section is only visible if the MQTT is configured. To configure MQTT, add `mqtt:` to the `configuration.yaml` file. For more information, refer to [mqtt](/components/mqtt/)
This section is only visible if the MQTT component is configured. To configure MQTT, add `mqtt:` to the `configuration.yaml` file. For more information, refer to the [mqtt](/components/mqtt/) component.
Even though MQTT in general provides deeper functionality, the developer tools section of MQTT is limited to publishing messages to a given topic. It supports templates for the payload. To publish a message, simply specify the topic name and the payload and click “PUBLISH” button.
{% linkable_title Info %}