mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 09:17:06 +00:00
Add GitHub example
This commit is contained in:
parent
0aec729ee5
commit
76b28dec89
@ -19,7 +19,7 @@ To enable this sensor, add the following lines to your `configuration.yaml` file
|
|||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
sensor:
|
sensor:
|
||||||
platform: rest
|
- platform: rest
|
||||||
resource: http://IP_ADDRESS/ENDPOINT
|
resource: http://IP_ADDRESS/ENDPOINT
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ or for a POST request:
|
|||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry
|
# Example configuration.yaml entry
|
||||||
sensor:
|
sensor:
|
||||||
platform: rest
|
- platform: rest
|
||||||
resource: http://IP_ADDRESS/ENDPOINT
|
resource: http://IP_ADDRESS/ENDPOINT
|
||||||
method: POST
|
method: POST
|
||||||
payload: '{ "device" : "heater" }'
|
payload: '{ "device" : "heater" }'
|
||||||
@ -70,6 +70,7 @@ You can find your external IP address using the service [JSON Test](http://www.j
|
|||||||
To display the IP address, the entry for a sensor in the `configuration.yaml` file will look like this.
|
To display the IP address, the entry for a sensor in the `configuration.yaml` file will look like this.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
sensor:
|
||||||
- platform: rest
|
- platform: rest
|
||||||
resource: http://ip.jsontest.com
|
resource: http://ip.jsontest.com
|
||||||
name: External IP
|
name: External IP
|
||||||
@ -83,6 +84,7 @@ The [glances](/components/sensor.glances/) sensor is doing the exact same thing
|
|||||||
Add something similar to the entry below to your `configuration.yaml` file:
|
Add something similar to the entry below to your `configuration.yaml` file:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
sensor:
|
||||||
- platform: rest
|
- platform: rest
|
||||||
resource: http://IP_ADRRESS:61208/api/2/mem/used
|
resource: http://IP_ADRRESS:61208/api/2/mem/used
|
||||||
name: Used mem
|
name: Used mem
|
||||||
@ -95,6 +97,7 @@ Add something similar to the entry below to your `configuration.yaml` file:
|
|||||||
The Home Assistant [API](/developers/rest_api/) exposes the data from your attached sensors. If you are running multiple Home Assistant instances which are not [connected](/developers/architecture/#multiple-connected-instances) you can still get information from them.
|
The Home Assistant [API](/developers/rest_api/) exposes the data from your attached sensors. If you are running multiple Home Assistant instances which are not [connected](/developers/architecture/#multiple-connected-instances) you can still get information from them.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
sensor:
|
||||||
- platform: rest
|
- platform: rest
|
||||||
resource: http://IP_ADDRESS:8123/api/states/sensor.weather_temperature
|
resource: http://IP_ADDRESS:8123/api/states/sensor.weather_temperature
|
||||||
name: Temperature
|
name: Temperature
|
||||||
@ -106,6 +109,7 @@ The Home Assistant [API](/developers/rest_api/) exposes the data from your attac
|
|||||||
The REST sensor supports HTTP authentication and customized headers.
|
The REST sensor supports HTTP authentication and customized headers.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
sensor:
|
||||||
- platform: rest
|
- platform: rest
|
||||||
resource: http://IP_ADDRESS:5000/sensor
|
resource: http://IP_ADDRESS:5000/sensor
|
||||||
username: ha1
|
username: ha1
|
||||||
@ -127,3 +131,21 @@ Content-Type: application/json
|
|||||||
User-Agent: Home Assistant
|
User-Agent: Home Assistant
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### {% linkable_title Use GitHub to get the latest release of Home Assistant %}
|
||||||
|
|
||||||
|
This sample is very similar to the [`updater`](/components/updater/) component but the information are recieved from GitHub.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
sensor:
|
||||||
|
- platform: rest
|
||||||
|
resource: https://api.github.com/repos/home-assistant/home-assistant/releases/latest
|
||||||
|
username: YOUR_GITHUB_USERNAME
|
||||||
|
password: YOUR_GITHUB_ACCESS_TOKEN
|
||||||
|
authentication: basic
|
||||||
|
value_template: '{% raw %}{{ value_json.tag_name }}{% endraw %}'
|
||||||
|
headers:
|
||||||
|
Accept: application/vnd.github.v3+json
|
||||||
|
Content-Type: application/json
|
||||||
|
User-Agent: Home Assistant REST sensor
|
||||||
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user