Make the sample more copy-and-paste friendly

This commit is contained in:
Fabian Affolter 2016-05-28 10:29:00 +02:00
parent 47f1faba17
commit a8c7b0fee0

View File

@ -18,7 +18,7 @@ First import the module and setup the basics.
```python
import homeassistant.remote as remote
api = remote.API('host', 'password')
api = remote.API('127.1.0.1', 'password')
print(remote.validate_api(api))
```
@ -27,7 +27,7 @@ This snippets shows how to use the `homeassistant.remote` package in another way
```python
import homeassistant.remote as remote
api = remote.API('host', 'password')
api = remote.API('127.1.0.1', 'password')
hass = remote.HomeAssistant(api)
hass.start()
living_room = hass.states.get('group.living_room')
@ -40,7 +40,7 @@ Similar to the output in the "Developer Tools" of the frontend.
```python
import homeassistant.remote as remote
api = remote.API('host', 'password')
api = remote.API('127.1.0.1', 'password')
print('-- Available services:')
services = remote.get_services(api)
@ -60,7 +60,7 @@ To get the details of a single entity the `get_state` method is used.
```python
import homeassistant.remote as remote
api = remote.API('host', 'password')
api = remote.API('127.1.0.1', 'password')
office_temperature = remote.get_state(api, 'sensor.office_temperature')
print('{} is {} {}.'.format(office_temperature.attributes['friendly_name'],
office_temperature.state,
@ -80,7 +80,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('host', 'password')
api = remote.API('127.1.0.1', 'password')
switch_livingroom = remote.get_state(api, 'switch.livingroom_pin_2')
print('{} is {}.'.format(switch_livingroom.attributes['friendly_name'],
switch_livingroom.state
@ -96,7 +96,7 @@ Of course, it's possible to set the state.
import homeassistant.remote as remote
from homeassistant.const import STATE_ON
api = remote.API('host', 'password')
api = remote.API('127.1.0.1', 'password')
remote.set_state(api, 'sensor.office_temperature', new_state=123)
remote.set_state(api, 'switch.livingroom_pin_2', new_state=STATE_ON)
```
@ -112,7 +112,7 @@ If you want to turn on all entities of a domain, just a service which was retrie
import time
import homeassistant.remote as remote
api = remote.API('host', 'password')
api = remote.API('127.1.0.1', 'password')
domain = 'switch'
remote.call_service(api, domain, 'turn_on')
@ -128,7 +128,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('host', 'password')
api = remote.API('127.1.0.1', 'password')
domain = 'switch'
switch_name = 'switch.livingroom_pin_2'
@ -144,7 +144,7 @@ The example uses the jabber notification platform to send a single message to th
```python
import homeassistant.remote as remote
api = remote.API('host', 'password')
api = remote.API('127.1.0.1', 'password')
domain = 'notify'
data = {"title":"Test", "message":"A simple test message from HA."}