This repository contains little helpers for testing and developing platform and/or components for Home Assistant.
The Flask-RESTful extension for Flask can be used to simulate devices locally.
$ ./ha-rest.py
Flask is running on Port 5000. The response contains various attributes with random assigned values.
$ curl -X GET http://127.0.0.1:5000/binary_sensor
{
"name": "Binary sensor",
"state1": 0,
"state2": "0",
"state3": {
"open": "true",
"timestamp": "2016-06-14 15:32:10.253225"
},
"state4": "FALSE",
"state5": "off",
"state6": "Close"
}
A sample entry for a binary sensor for the configuration.yaml
file could
like this:
binary_sensor:
- platform: rest
resource: http://127.0.0.1:5000/binary_sensor
name: REST test
sensor_class: opening
value_template: '{{ value_json.state1 }}'
The available endpoints are:
/binary_sensor
/binary_sensor1
/sensor
/weather
/sensor1
/sensor2
incl. support for POST requests/auth_basic
usable with username 'ha1' and password 'test1' or 'ha2'/'test2'/auth_digest
usable with username 'ha1' and password 'test1' or 'ha2'/'test2'/ip
Return the IP address of the remote system
This script provides a Flask based web server that is storing sensor values in various ways. The server is running on http://127.0.0.1:5000/
/sensor
and/sensor/<name>
/sensor_data.txt
home-assistant-dev-helper
is licensed under ASL 2.0, for more details check
LICENSE.md.