Skip to content

Commit a8c7b0f

Browse files
committed
Make the sample more copy-and-paste friendly
1 parent 47f1fab commit a8c7b0f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

source/developers/python_api.markdown

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ First import the module and setup the basics.
1818
```python
1919
import homeassistant.remote as remote
2020

21-
api = remote.API('host', 'password')
21+
api = remote.API('127.1.0.1', 'password')
2222
print(remote.validate_api(api))
2323
```
2424

@@ -27,7 +27,7 @@ This snippets shows how to use the `homeassistant.remote` package in another way
2727
```python
2828
import homeassistant.remote as remote
2929

30-
api = remote.API('host', 'password')
30+
api = remote.API('127.1.0.1', 'password')
3131
hass = remote.HomeAssistant(api)
3232
hass.start()
3333
living_room = hass.states.get('group.living_room')
@@ -40,7 +40,7 @@ Similar to the output in the "Developer Tools" of the frontend.
4040
```python
4141
import homeassistant.remote as remote
4242

43-
api = remote.API('host', 'password')
43+
api = remote.API('127.1.0.1', 'password')
4444

4545
print('-- Available services:')
4646
services = remote.get_services(api)
@@ -60,7 +60,7 @@ To get the details of a single entity the `get_state` method is used.
6060
```python
6161
import homeassistant.remote as remote
6262

63-
api = remote.API('host', 'password')
63+
api = remote.API('127.1.0.1', 'password')
6464
office_temperature = remote.get_state(api, 'sensor.office_temperature')
6565
print('{} is {} {}.'.format(office_temperature.attributes['friendly_name'],
6666
office_temperature.state,
@@ -80,7 +80,7 @@ The exact same thing is working for a switch. The difference is that both entiti
8080
```python
8181
import homeassistant.remote as remote
8282

83-
api = remote.API('host', 'password')
83+
api = remote.API('127.1.0.1', 'password')
8484
switch_livingroom = remote.get_state(api, 'switch.livingroom_pin_2')
8585
print('{} is {}.'.format(switch_livingroom.attributes['friendly_name'],
8686
switch_livingroom.state
@@ -96,7 +96,7 @@ Of course, it's possible to set the state.
9696
import homeassistant.remote as remote
9797
from homeassistant.const import STATE_ON
9898

99-
api = remote.API('host', 'password')
99+
api = remote.API('127.1.0.1', 'password')
100100
remote.set_state(api, 'sensor.office_temperature', new_state=123)
101101
remote.set_state(api, 'switch.livingroom_pin_2', new_state=STATE_ON)
102102
```
@@ -112,7 +112,7 @@ If you want to turn on all entities of a domain, just a service which was retrie
112112
import time
113113
import homeassistant.remote as remote
114114

115-
api = remote.API('host', 'password')
115+
api = remote.API('127.1.0.1', 'password')
116116
domain = 'switch'
117117

118118
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.
128128
import time
129129
import homeassistant.remote as remote
130130

131-
api = remote.API('host', 'password')
131+
api = remote.API('127.1.0.1', 'password')
132132
domain = 'switch'
133133
switch_name = 'switch.livingroom_pin_2'
134134

@@ -144,7 +144,7 @@ The example uses the jabber notification platform to send a single message to th
144144
```python
145145
import homeassistant.remote as remote
146146

147-
api = remote.API('host', 'password')
147+
api = remote.API('127.1.0.1', 'password')
148148
domain = 'notify'
149149
data = {"title":"Test", "message":"A simple test message from HA."}
150150

0 commit comments

Comments
 (0)