If you are looking at:
- Getting Familiar with Smart Home APis
- Learning how to control smart home devices
- Developing dashboards for smart home control
Then you should find this smart home simulator useful.
It is currently available as a node-red flow but depending on the level of interest I will also develop a Python version.
The Simulator will simulate some basic devices/sensors found in a house, and is controllable using a node-red dashboard as shown below:
However you can also control it using curl,a web browser and MQTT tools like mosquitto_pub and MQTT-Lens etc.
Using the Simulator
You will need node-red installed and also access to a Mosquitto broker.
I would recommend you set up an MQTT monitor to monitor the outputs of the sensors.
You can use mosquitto_sub for this.
mosquitto_sub - h localhost -t house/# -d
I have also a simple node-red MQTT monitor the flow is below:
The current implementation simulates:
- Door Sensor= Open and Closed
- Light Sensor -On or Off
- Temperature Sensor –
Most simulators have in built sensor changes so they will for example periodically turn a light on or off etc.
However because the sensors are controllable it is possible to set these values using an external program or dashboard.
This means that if you want to implement a house where the outside light comes on at 7pm and goes off at 7am you can so this by sending it a simple command using an external simulator program.
By default the sensors operate in change only mode (non verbose or non chatty). In this mode they only send data when their state changes.
You can toggle them into verbose mode using the dashboard.
Depending on the feedback I will create tutorials on using the simulator, the API and the dashboard.
Although I am making the simulator available as a download I would be interested to know if you would prefer an online version.
I created the simulator originally for a tutorial on APis and is ideal for learning more about APIs as well as building dashboards.
I will be developing this simulator further and will add simulations for common smart home devices like Tasmota.
To that end your feedback and suggestions are appreciated just use the comments form below.
Also use the comments for any bug reports. I would also suggest signing up to the newsletter to receive notifications.
- Controlling Smart Home Devices
- Understanding Smart Home APIs
- Controlling the Tasmota SonOff Switch with Node-Red
- Tasmota Project