diff --git a/atom.xml b/atom.xml index e2b923446e..67decefe53 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@
Make sure that the URL exactly matches your endpoint or resource. @@ -116,8 +117,7 @@ Make sure that the URL exactly matches your endpoint or resource.
In this section you find some real life examples of how to use this sensor.
You can find your external IP address using the service JSON Test at their http://ip.jsontest.com/ endpoint.
-To display the IP address, the entry for a sensor in the configuration.yaml
file will look like this.
You can find your external IP address using the service JSON Test at their http://ip.jsontest.com/ URL.
sensor:
- platform: rest
resource: http://ip.jsontest.com
@@ -127,7 +127,6 @@ Make sure that the URL exactly matches your endpoint or resource.
The glances sensor is doing the exact same thing for all exposed values.
-Add something similar to the entry below to your configuration.yaml
file:
sensor:
- platform: rest
resource: http://IP_ADRRESS:61208/api/2/mem/used
@@ -184,6 +183,58 @@ User-Agent: Home Assistant
User-Agent: Home Assistant REST sensor
JSON Test returns the current time, date and milliseconds since epoch from http://date.jsontest.com/.
+sensor:
+ - platform: rest
+ name: JSON time
+ json_attributes:
+ - date
+ - milliseconds_since_epoch
+ resource: http://date.jsontest.com/
+ value_template: '{{ value_json.time }}'
+ - platform: template
+ sensors:
+ date:
+ friendly_name: 'Date'
+ value_template: '{{ states.sensor.json_time.attributes["date"] }}'
+ milliseconds:
+ friendly_name: 'milliseconds'
+ value_template: '{{ states.sensor.json_time.attributes["milliseconds_since_epoch"] }}'
+
+This sample fetches a weather report from OpenWeatherMap, maps the resulting data into attributes of the RESTful sensor and then creates a set of template sensors that monitor the attributes and present the values in a usable form.
+sensor:
+ - platform: rest
+ name: OWM_report
+ json_attributes:
+ - main
+ - weather
+ value_template: '{{ value_json["weather"][0]["description"].title() }}'
+ resource: http://api.openweathermap.org/data/2.5/weather?zip=80302,us&APPID=VERYSECRETAPIKEY
+ - platform: template
+ sensors:
+ owm_weather:
+ value_template: '{{ states.sensor.owm_report.attributes.weather[0]["description"].title() }}'
+ icon_template: '{{ "http://openweathermap.org/img/w/"+states.sensor.owm_report.attributes.weather[0]["icon"]+".png" }}'
+ entity_id: sensor.owm_report
+ owm_temp:
+ friendly_name: 'Outside temp'
+ value_template: '{{ states.sensor.owm_report.attributes.main["temp"]-273.15 }}'
+ unit_of_measurement: "°C"
+ entity_id: sensor.owm_report
+ owm_pressure:
+ friendly_name: 'Outside pressure'
+ value_template: '{{ states.sensor.owm_report.attributes.main["pressure"] }}'
+ unit_of_measurement: "hP"
+ entity_id: sensor.owm_report
+ owm_humidity:
+ friendly_name: 'Outside humidity'
+ value_template: '{{ states.sensor.owm_report.attributes.main["humidity"] }}'
+ unit_of_measurement: "%"
+ entity_id: sensor.owm_report
+
+