What did you build/automated today (with pictures)?

(Roel) #142

you can find all you need at my github repository

(Simon Lundell) #143

Not this week, but… I used a Wemos D1 Mini to sense the water in the christmas tree “vase”. If it is not detected, a message is posted on MQTT. OpenHAB uses this and blinks the christmas tree lighting once every two minutes til it is watered.

(Vincent Regaud) #144

I added some monitoring of the Hamster cage :hamster:

(Full Name) #145

Over Christmas we had my partner’s parents to stay. I don’t particularly want a commercial voice-controlled system because I don’t really trust Amazon/Google etc completely, and they prefer a physical button interface rather than touchscreens. I therefore built this, which throws away a couple of remote controls, and turns everything on in the right order (it has to do some IR signalling with an Anavi infrared phat on a rPi 0 to talk to the TV), then sets the channel.

The most important user principle is that “one button does one thing”. Because of following this principle it actually turned out way more popular than I expected for the low amount of effort, even with the terrible label printing :slight_smile:

(dalibor) #146

looks nice, I was considering something like this (or perhaps logitech remote).
what does it looks like “zoomed out”? :slight_smile:

(Full Name) #147

Heh, thanks. It’s actually just the “ZRC-90 Scene master” , so searching for that will probably get you far better pictures. In case it’s not clear the 7 “active” buttons will each turn everything on, and the “power” button will turn everything off.

It’s become just “The Way” we turn the TV, satellite box and soundbar on/off now, so I can’t use it for my original intended purpose :slight_smile:

(Stuart Hanlon) #148


To join in the show and tell, I’ve made a little video of some LEDs in our front room.

These are powered by a single 10amp 5v PSU, 2 x DMX to SPi adapters and a 6 universe Art-NET to DMX box (which also drives other LEDs around the house).

This project uses 2 groups of DMX chases in openHAB2, which are available in a HabPanel UI.

However, the whole lot is mapped to a couple of buttons on the main Velbus Oled glass panel in the room.

openHAB2 detects the button presses and switches on or off various chases and feedback LEDs within the glass panel/s.

(Burzin Sumariwalla) #149

Hi Stuart,

Very nice project. Just curious though. Why is the power supply 10 amps. That seems like a lot for LEDs.


(Stuart Hanlon) #150

Hello Burzin,

We’re really happy with the mirror too, it creates a lovely effect.

I’ve recently discovered the SK6812 range of SPi chips, which has a RGBW option. It would have been nice to have the option for a pure white, but it’s nice as it is.

As for why a 10amp 5v (50 w) PSU, the mirror alone pulls a little under 4amps at full brightness.

There are also a few other pixels around the room, so the nearest capacity power supply, that gives enough In-Rush overhead is a 10amp.


(Mikaël) #151

Nice !
Which alarm do you use and how is it integrated with OpenHAB ?

(Allen) #152

What do you want to monitor ?

(Morten Vinding) #153

We had aircondition installed in our rental apartment in Gran Canary, and my wife was very anxious about how much power that would use.
So I made a small powermeter that uploads the status to our VPS server every minute.
It is made by a peacefair pzem016 energy meter, that measures the current using a current transformer (CT) clipped onto the main power cable.
The meter is then connected via modbus to a modbus2usb adapter to a small ZSUN wireless router running OpenWRT.

The advantage of using a current transformer is that you don’t have to make any modifications to the main powerline (high current you don’t want to mess with!).

The data is visualised using Grafana and looks like this:

(Fabien) #154

@MortenVinding Thanks for the hardware tip. I was looking for something similar but other solutions I found were priced too high…
Would you mind sharing your code?

(Morten Vinding) #155

Sorry not much to share, I’m not a programmer so all I did was steal the Python code from https://community.openenergymonitor.org/t/pzem-016-single-phase-modbus-energy-meter/7780/61
and fix it up for my needs like so:

import minimalmodbus
print "Volt Current Power Energy Frequency Powerfactor Alarm Time"
class pzem(minimalmodbus.Instrument):

    def __init__(self, serialPort, slaveAddress=1):

        minimalmodbus.Instrument.__init__(self, serialPort, slaveAddress)
        self.serial.timeout = 0.1
        self.serial.baudrate = 9600

    def getData(self):

      # Retry 5 times incase of timeout
      for i in range(5):
              data = self.read_registers(0,10,4)
          except IOError as e:

      if 'data' in locals():
          return [
              data[0]*0.1,                        # Voltage(0.1V)
              (data[1]+(data[2]*65536)) * .001,   # Current(0.001A)
              (data[3]+(data[4]*65536)) * .1,     # Power(0.1W)
              data[5]+(data[6]*65536),            # Energy(1Wh)
              data[7]*0.1,                        # Frequency(0.1Hz)
              data[8]*0.01,                       # Powerfactor(0.01P)
              data[9]                             # Alarm(0/1)
          return False

if __name__ == "__main__":

  import time
  serialPort = "/dev/ttyUSB0"
  slaveAddress = 1
  pz = pzem(serialPort, slaveAddress)
  #while True:
  print(' '.join(str(v) for v in pz.getData()+[int(time.time())]))

running that gives me a output like:

root@OpenWrt:~# python allpzem-016.py
Volt Current Power Energy Frequency Powerfactor Alarm Time
229.8 1.216 273.3 49695 50.0 0.98 0 1549762651

then I pipe that to my simple shell script (because shell is all I know :grin:) and sends it on to my influxdb:



POWER=$(/usr/bin/python /root/allpzem-016.py | tail -n 1)

echo -ne "Power "
echo -ne "Volt=$(echo $POWER | cut -d " " -f 1),"
echo -ne "Current=$(echo $POWER | cut -d " " -f 2),"
echo -ne "Power=$(echo $POWER | cut -d " " -f 3),"
echo -ne "Energy=$(echo $POWER | cut -d " " -f 4),"
echo -ne "Frequency=$(echo $POWER | cut -d " " -f 5),"
echo -ne "Powerfactor=$(echo $POWER | cut -d " " -f 6),"
echo -ne "Alarm=$(echo $POWER | cut -d " " -f 7) "
echo -ne $POWER | cut -d " " -f 8

# And finaly send it to InfluxDB
curl -sSu $USER:$PASS -X POST "https://$URL/write?db=$DB&precision=s" --data-binary "$DATA"

To reset the power counter I use:

root@OpenWrt:~# cat resetpzem-016.py 
import minimalmodbus
print "Reset consumed energy..."
class pzem(minimalmodbus.Instrument):

    def __init__(self, serialPort, slaveAddress=1):

        minimalmodbus.Instrument.__init__(self, serialPort, slaveAddress)
        self.serial.timeout = 0.1
        self.serial.baudrate = 9600

    def setZeroEnergy(self):
        Reset the energy accumulator total to zero.
        except Exception as e:
            return False
        return True

if __name__ == "__main__":

  import time
  serialPort = "/dev/ttyUSB0"
  slaveAddress = 1
  pz = pzem(serialPort, slaveAddress)

on the openwrt router I installed the needed USB kernel modules (kmod’s for serial and for the controller etc.), python-light and curl
python serial and python MinimalModbus.py is not in opkg, but I just installed it on a desktop and copied all the files (it’s python so not architecture dependent anyway).

I’m sure this could me make much simpler and effective, using pure python fx. but as I said I’m not at programmer :slight_smile:
I did try out using collectd and it’s modbus plugin, but gave up for reasons I can’t remember…

There seems to be some work on using a ESP8266 to work with modbus, but I did not investigate it much further, since I liked the idea of having a small router there is also making a reverse ssh tunnel, to my server so I always can connect to my remote network :slight_smile:

(Gad Ofir) #156

Wow four weeks!

that is allot of progress ,cheers man

(Fabien) #157

@MortenVinding thank you!
That’s a nice day to do it for a remote location without OH local instance. Something I have to keep in mind for my next development…

Soon I will connect one directly to my OH server, so I think I will use the Modbus binding. Will share the configuration when done.

(Stuart Hanlon) #158

I’m not sure how to show a picture of what I’ve created tonight, because it would have to be a very boring 12 hour video.

What I’ve done is turn the pixels around my mirror into a clock :slight_smile:

The mirror can look like this…

But with the rule that I’ve posted here - it becomes a subtle clock.


(dalibor) #159

Perhaps you could do a time lapse? Take picture every 5 min or so, and then just join them in some free online gif maker, I think that might look cool.
(of course, you would need a tripod or some fixed place where to put phone/camera for 1h)

(Stuart Hanlon) #160

I’ve discussed this with my minister for financial and domestic affairs, who said…

“You don’t have time for that, just take a picture and suggest that a little imagination is applied…”

So here’s a picture with the clock showing 10:25 pm. (Or is it 10:25 am?)

(B K) #161

Very cool idea!

Perhaps use LED color for AM/PM indication (or get even more fancy and use the astro binding/sun elevation angle to subtly change the hue of the ‘hour’ hand depending on the time of day/night) :slight_smile: