mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 01:06:52 +00:00
Use the same password placeholder
This commit is contained in:
parent
6499a70163
commit
e0e1553324
@ -40,7 +40,7 @@ Similar to the output in the "Developer Tools" of the frontend.
|
||||
```python
|
||||
import homeassistant.remote as remote
|
||||
|
||||
api = remote.API('127.1.0.1', 'password')
|
||||
api = remote.API('127.1.0.1', 'YOUR_PASSWORD')
|
||||
|
||||
print('-- Available services:')
|
||||
services = remote.get_services(api)
|
||||
@ -65,7 +65,7 @@ To get the details of a single entity the `get_state` method is used.
|
||||
```python
|
||||
import homeassistant.remote as remote
|
||||
|
||||
api = remote.API('127.1.0.1', 'password')
|
||||
api = remote.API('127.1.0.1', 'YOUR_PASSWORD')
|
||||
office_temperature = remote.get_state(api, 'sensor.office_temperature')
|
||||
print('{} is {} {}.'.format(office_temperature.attributes['friendly_name'],
|
||||
office_temperature.state,
|
||||
@ -85,7 +85,7 @@ The exact same thing is working for a switch. The difference is that both entiti
|
||||
```python
|
||||
import homeassistant.remote as remote
|
||||
|
||||
api = remote.API('127.1.0.1', 'password')
|
||||
api = remote.API('127.1.0.1', 'YOUR_PASSWORD')
|
||||
switch_livingroom = remote.get_state(api, 'switch.livingroom_pin_2')
|
||||
print('{} is {}.'.format(switch_livingroom.attributes['friendly_name'],
|
||||
switch_livingroom.state
|
||||
@ -101,7 +101,7 @@ Of course, it's possible to set the state.
|
||||
import homeassistant.remote as remote
|
||||
from homeassistant.const import STATE_ON
|
||||
|
||||
api = remote.API('127.1.0.1', 'password')
|
||||
api = remote.API('127.1.0.1', 'YOUR_PASSWORD')
|
||||
remote.set_state(api, 'sensor.office_temperature', new_state=123)
|
||||
remote.set_state(api, 'switch.livingroom_pin_2', new_state=STATE_ON)
|
||||
```
|
||||
@ -117,7 +117,7 @@ If you want to turn on all entities of a domain, just use a service which was re
|
||||
import time
|
||||
import homeassistant.remote as remote
|
||||
|
||||
api = remote.API('127.1.0.1', 'password')
|
||||
api = remote.API('127.1.0.1', 'YOUR_PASSWORD')
|
||||
domain = 'switch'
|
||||
|
||||
remote.call_service(api, domain, 'turn_on')
|
||||
@ -133,7 +133,7 @@ To turn on or off a single switch. The ID of the entity is needed as attribute.
|
||||
import time
|
||||
import homeassistant.remote as remote
|
||||
|
||||
api = remote.API('127.1.0.1', 'password')
|
||||
api = remote.API('127.1.0.1', 'YOUR_PASSWORD')
|
||||
domain = 'switch'
|
||||
switch_name = 'switch.livingroom_pin_2'
|
||||
|
||||
@ -149,7 +149,7 @@ The example uses the jabber notification platform to send a single message to th
|
||||
```python
|
||||
import homeassistant.remote as remote
|
||||
|
||||
api = remote.API('127.1.0.1', 'password')
|
||||
api = remote.API('127.1.0.1', 'YOUR_PASSWORD')
|
||||
domain = 'notify'
|
||||
data = {"title":"Test", "message":"A simple test message from HA."}
|
||||
|
||||
|
@ -67,7 +67,7 @@ The simplest script to consume the SSE looks like the following snipplet.
|
||||
```python
|
||||
from sseclient import SSEClient
|
||||
|
||||
messages = SSEClient('http://localhost:8123/api/stream?api_password=MYPASS')
|
||||
messages = SSEClient('http://localhost:8123/api/stream?api_password=YOUR_PASSWORD')
|
||||
for msg in messages:
|
||||
print(msg)
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user