diff --git a/atom.xml b/atom.xml index 02efc1e7e7..9ec2eb640d 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@
sensor: platform: template sensors: - solar_angle: - value_template: '{{ "%+.1f"|format(states.sun.sun.attributes.elevation) }}' - friendly_name: 'Sun Angle' - unit_of_measurement: '°' + solar_angle: + value_template: '{{ "%+.1f"|format(states.sun.sun.attributes.elevation) }}' + friendly_name: 'Sun Angle' + unit_of_measurement: '°'
If you don’t like the wording of a sensor output then the template sensor can help too. Processes monitored by the System Monitor sensor show on
or off
if they are running or not. This example shows how the output of a monitored glances
process can be renamed.
sensor: + platform: template + sensors: + glances: + value_template: 'running' + friendly_name: 'Glances' +
This example shows a multiple line template with and if test. It looks at a sensing switch and shows on/off in the frontend. It disables warnings to avoid log messages where the switch it depends on isn’t loaded yet.
@@ -150,23 +165,24 @@sensor: platform: template sensors: - kettle: - friendly_name: 'Kettle' - value_template: >- - {%- if is_state("switch.kettle", "off") %} - off - {% elif states.switch.kettle.attributes.kwh < 1000 %} - standby - {% elif is_state("switch.kettle", "on") %} - on - {% else %} - failed - {%- endif %} + kettle: + friendly_name: 'Kettle' + value_template: >- + {%- if is_state("switch.kettle", "off") %} + off + {% elif states.switch.kettle.attributes.kwh < 1000 %} + standby + {% elif is_state("switch.kettle", "on") %} + on + {% else %} + failed + {%- endif %} - warnings: Off + warnings: Off
(please note the blank line to close the multi-line template)
next
to master
with the upcoming release number as title.master
into next
(git checkout next && git merge master
) to make the PR mergable.next
and base it on the text of the PR in the main repository. Add images, additional text, links, etc. if it adds value. Tag each platform/component in message to documentation.next
.source/index.html
) to link to the new release blog post and version number.master
(git merge next
).next
to master
with the upcoming release number as title.master
into next
($ git checkout next && git merge master
) to make the PR mergable.master
.There are various ways to access the stream. One is curl
:
$ curl -X GET -H "x-ha-access: YOUR_PASSWORD" \ +$ curl -X GET -H "x-ha-access: 12345" \ -H "Content-Type: application/json" http://localhost:8123/api/stream
Visit http://localhost:8123/local/sse.html to see the stream of events.
-The home-assistant-sse repository contains an more advanced example.
+If you want test the server-sent events without creating a website then the Python module sseclient
can help. Install it first:
$ pip3 install sseclient +
The simplest script to consume the SSE looks like the following snipplet.
+ +from sseclient import SSEClient + +messages = SSEClient('http://localhost:8123/api/stream?api_password=MYPASS') +for msg in messages: + print(msg) +