Skip to content

Latest commit

 

History

History
100 lines (82 loc) · 6.98 KB

README.md

File metadata and controls

100 lines (82 loc) · 6.98 KB

Build with PlatformIO Software released

HixPower

Software for a WIFI connected intelligent power switch. It contains a temperature sensor, PIR/radar motion sensor, button (with LED) and buzzer and is based on the ESP8266 microcontroller. Its measurements are pubished via MQTT and it can also be controlled via MQTT. Its part of my home automation system based on a raspberry pi running Mosquitoo, Nodered, InfluxDB and Grafana.

High voltage

This device uses high mains voltage! Remove it from the mains power (socket) while programming via the onboard FTDI connector. During programming and debugging the device can safely be powered via the FTDI with 5V. It will boot and work normally drawing power over the FTDI. This way you can also debug using the onboard serial port for the ESP8266 environment.

Make sure your FTDI programmer can deliver the required power. Mine, a chinese clone "Deek-Robot" had no problem at all. Once initially flashed the device can be updated Over The Air (OTA) (as supported by this firmware).

MQTT

Publishing

{room}
   └─── HixCO2
           └─── {deviceTag}
                     └─── device
                     │       └─── count
                     │       └─── room
                     │       └─── device_type
                     │       └─── device_version
                     │       └─── device_tag
                     │       └─── device_name
                     │       └─── wifi_ssid
                     │       └─── wifi_ip
                     │       └─── desired_temperature
                     │       └─── auto_switchoff_seconds
                     │       
                     └─── status
                     │       └─── count
                     │       └─── wifi_rssi
                     │       └─── temperature
                     │       └─── motion_detected
                     │       └─── switch_pressed
                     │       └─── beeper_on
                     │       └─── output_allowed
                     │       └─── output_on
                     │       └─── auto_switchoff_seconds_left
                     │
                     └─── subscribe
                     │       └─── desired_temperature
                     │       └─── auto_switchoff_seconds
                     │       └─── output_toggle
                     │
                     └─── influxdb

Subscribing

This device listens to the above depicted topics to set the desired temperature, auto switch off timeout and you can switch it on/off (toggle).

influxdb topic publishing contents

To make the import in the influxdb from Node-RED as easy as possible the influxdb topic publishes a json document that can immediatly imported using the influxdb in node. They only thing required is to convert it to a json object via the To json node. Node-RED influxDB import

Following the influxdb in node the json is an array where:

  • the first element contains the measurements
  • the second element contains the tags
[  
   {  
      "wifi_rssi"                   : -45,
      "temperature"                 : 45,
      "motion_detected"             : true,
      "switch_pressed"              : false,
      "beeper_on"                   : false,
      "output_allowed"              : true,
      "output_on".                  : true,
      "auto_switchoff_seconds_left" : 768
   },
   {  
      "device_type".                 : "HixPower",
      "device_version".              : "2.2.9",
      "device_tag".                  : "heating",
      "room"                         : "bathroom",
      "wifi_ssid".                   : "public_wifi",
      "desired_temperature".         : "public_wifi",
      "auto_switchoff_seconds_left". : "public_wifi"
   }
]

Configuration web interface

Config web interface

  • Once connectted to the WIFI a normal browser can be used to configure the MQTT details.
  • Just go the the device's ip address with your browser
  • Password is intitially set as bornem1973.
  • At this moment the WIFI SSID and password are hardcoded in the src/secret.cpp file