you can find all you need at my github repository
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.
I added some monitoring of the Hamster cage
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
looks nice, I was considering something like this (or perhaps logitech remote).
what does it looks like āzoomed outā?
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
Hi
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.
Hi Stuart,
Very nice project. Just curious though. Why is the power supply 10 amps. That seems like a lot for LEDs.
Regards,
Burzin
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.
Nice !
Which alarm do you use and how is it integrated with OpenHAB ?
What do you want to monitor ?
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:
@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?
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:
#!/usr/bin/python
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):
try:
data = self.read_registers(0,10,4)
break
except IOError as e:
pass
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)
]
else:
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())]))
#time.sleep(2)
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 ) and sends it on to my influxdb:
#!/bin/ash
URL="influx.server.com:8086"
DB="influxdbname"
USER="influxuser"
PASS="influxpass"
POWER=$(/usr/bin/python /root/allpzem-016.py | tail -n 1)
DATA=$(
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
#!/usr/bin/python
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.
"""
try:
self._performCommand(66,'')
except Exception as e:
return False
return True
if __name__ == "__main__":
import time
serialPort = "/dev/ttyUSB0"
slaveAddress = 1
pz = pzem(serialPort, slaveAddress)
pz.setZeroEnergy()
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
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
Wow four weeks!
that is allot of progress ,cheers man
@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.
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
The mirror can look like thisā¦
But with the rule that Iāve posted here - it becomes a subtle clock.
https://community.openhab.org/t/dmx-binding-as-a-clock/67678/2
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)
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?)
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)