Raspi IoT

Software #

Hardware #

Meta website #

What is it ? #

  • Hugo : a website as easy to customise as writing markdown
  • Menu : All webapps and websites can be organised in a hierarchical menu
  • Full screen : Each website is embedded on an iframe that can toggle to full screen mode or open in a new page

How does it work ? #

  • create a new file : homeassistant.md
  • call hugo server to test or hugo to generate the website (more details on using hugo)
  • this will already create a new menu entry
  • Fill it with the link to your webapp instance
  • weight : defines the order in the menu entry
  • title : The text that will appear on the menu entry
  • BookToC : Table Of Content not required so that the iframe can be wider
  • ...{< iframe... : call of the iframe html shortcode file that has been added in the layouts\shortcodes directory

Demo video #

Smart home 3D webapp #

Attempt to unify interfaces in one app. Result is quite a success though requires a beast GPU and quite some effort to arrange 3D details and camera positioning to get a nice user experiance out of it.

Led Panel webapp #

Home heating app #

web heat control #

The control of the heating has a feedback that ensures the execution of the command. The green displayed numbers represent the time since the last status of the zigbee device. Once a slider is modified and a command is sent, a feedback shall be received within few seconds and the time since last message should drop to 0 mn

python heat windows monitor #

  1. adjust your mqtt configuration in config.json
  2. adjust the eurotronic heater topic and apertures (apertures are the contact sensors list)
    "heatings":{
        "living heat":{
            "topic":"lzig/living heat/set",
            "Apertures":[
                "balcony door",
                "balcony window right",
                "balcony window left"
            ]
        }
    }
  1. add the contact sensors to the mqtt subscriptions as well
  2. run the script python raspi/heat.py

example eurotronic mqtt payload

zig/living heat {
    "current_heating_setpoint":17,
    "eurotronic_system_mode":1,
    "local_temperature":18.49,
    "occupied_heating_setpoint":21,
    "unoccupied_heating_setpoint":16,
    "eurotronic_error_status":0,
    "pi_heating_demand":0,
    "battery":100,
    "linkquality":44
}

docu references #

Bed Heating app #

Bed Heating hardware #

Roborock chat #

Hue Light control #

  • Controls all the Hue light bulbs from Aquara sensor switches using the HUE rest API
  • custom functions
    • Long press for minimal dimming
    • Toggle on of or Toggle dim states
Config example. Click for details...
{  
    "bridges":{
        "LivingRoom":"10.0.0.38",
        "username_config":"/home/pi/.python_hue"
    },
    "mqtt":{
        "host":"10.0.0.42",
        "port":1883,
        "keepalive":60,
        "client_id":"hue_client",
        "subscriptions":[
                            "mzig/bed light button",
                            "mzig/bed nic button",
                            "mzig/living double switch",
                            "lzig/bedroom switch",
                            "lzig/volume white",
                            "lzig/office switch",
                            "lzig/hallway entrance switch",
                            "lzig/hallway living switch",
                            "lzig/hallway corridor switch"
                        ],
        "actions"   :[],
        "publish" :true,
        "subscribe" :true
    },
    "lightmap":{
        "hallway":{
            "action":"light_list_clicks",
            "sensors":[
                "hallway entrance switch",
                "hallway living switch",
                "hallway corridor switch"
            ],
            "lights":[
                "Entrance White 1",
                "Entrance White 2",
                "Entrance White 3"
            ]
        }
    },
    "log":{
        "logfile":"/home/pi/share/hue(date).log",
        "level":"Info"
    }
}

Phantom Load cut #

  • Some home devices especially device clusters such as TV sets and surroundings or PC and surroundings do have a significant cumulated power usage when in a standby mode.
  • Who likes to pay money for non used electricity ?
  • Who likes to keep remembering each time and toggling switching on locations hard to access ?
  • This scrips js/pc_control comes to the rescue and does this for you in a smart way.

Features #

  • configurable standby power level. For example a TV set with sound system consumes 100 W to 200 W but when on standby, still ~ 11 W
  • a shelly socket provides a real time power usage through mqtt
  • if the device is in standby < 12 W for more than 5 min, the shelly device is ordered to cut the power resulting in 1 W for the shelly device power usage (wifi connection). Therefore a permanent 10 W is saved.
  • Low Motion sensors attached to the chair or to the remote control order the shelly to switch on again. False positive is not a problem and only costs 10W standby consumption for 5 more min before cutting again.
  • If the TV started really to be used and power is > 12 W, then the standby power cut system is not doing anything so that the user enjoys watching TV until the next TV switch off cycle.

Heat cut #

  • Hackaday page : Aquara and Eurotronics hand in hand to save energy

  • Opening a window without remembering to switch the heating off can cost a peak of heat that consists of the major power cost of the whole day !

  • The smart detection based on temperature drop is no reliable and only acts late sometimes when not necessary.

  • With a simple aquara contact switch the system is now reliable

  • Python service : py/heating

Home status #

  • Leaving home, in a hurry, no time to walk through the house or to start smartphone apps to know if the heating is forgotten in one room or if a window is left open in another.
  • With this script, you see the home status right next to the house door before leaving
  • Any window is open : The status light is blue
  • Any heater is active : The status is red
  • Both red and blue can be combined

How does this work. In a controlled environemnt where the wifi is reliable, there is no need for wifi status as it is always on. Therefore the led status disable function can be re-used for another purpose. This provide the nicest integration of led status including power supply, mqtt connection without even blocking the socket for other usage.

Below are the control URLs to turn led color on and off

json Config example. Click for details...
    "status":{
        "red":{
            "on":"http://10.0.0.48/settings/?led_power_disable=false",
            "off":"http://10.0.0.48/settings/?led_power_disable=true"
        },
        "blue":{
            "on":"http://10.0.0.48/settings/?led_status_disable=false",
            "off":"http://10.0.0.48/settings/?led_status_disable=true"
        }
    }

Roborock button #

As Roborock valetudo provides an mqtt interface, all it takes is this script py/hover to order cleaning of a room or a section with a click on an aquara zigbee button.

zigbee/graphview #

zigbee/graph_view

Features #

  • configurable ip, port and mqtt base name
  • multiple hosts for those using mulitple zigbee2mqtt instances.
  • svg pan zoom for simpleefficient viewing. graphs can be so huge that text gets tiny.
  • red buttons for change graph layout algorithm. Depending on the network, some algos can be more convenient than others

Note that the following viewer is hosted on github and has therefore a secure connection that shall not swap to a local home connection.

Inactive hosted page #

link to inactive viewer

In order to use this script, it is required to host it locally on local raspberry py, see deploy script for deployment convenience. Direct usage from the link would require to authorise cross origin on chrome symbol on right of the adress bar.

Logging #

Log.io #

transport-browserconsole #

Support #

Safety warning #

  • Power Sockets have deadly voltage and should not be self altered
  • Usage of certified products such as Shelly or others is recommended for any high voltage product
  • hacking custom scripts to control equipment might improve safety in case you add power cut off to a lower power for each section and device, but might also alter your food if your fridge inadvertantly goes off due to a wrong configuration
    • reboot state
    • safety power too low
  • Any heat power control custom script must necessarily have another safe switch to fully cut the power when away or device is inattended.

Raspberry pi tooling #