From e0e15533247aa623c465605cb87b90eb8a5e1b74 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 29 Jul 2016 22:18:28 +0200 Subject: [PATCH] Use the same password placeholder --- source/developers/python_api.markdown | 14 +++++++------- source/developers/server_sent_events.markdown | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/developers/python_api.markdown b/source/developers/python_api.markdown index 7a2ed8ee27c..4194b02817d 100644 --- a/source/developers/python_api.markdown +++ b/source/developers/python_api.markdown @@ -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."} diff --git a/source/developers/server_sent_events.markdown b/source/developers/server_sent_events.markdown index 67bda991c28..85c38151a37 100644 --- a/source/developers/server_sent_events.markdown +++ b/source/developers/server_sent_events.markdown @@ -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) ```