My new Smart Home Automation System with OpenHab2 - Work in progress -> Migrating to OpenHAB3 -> Migrating to OpenHAB 4

Hi YuChem,

yes, I did it. Just for one PZEM-004T and a NodeMCU.

I received power consumption data via MQTT in OpenHAB.

You can take a look at my blogsite to get more details.

If you need any assistance, please reply to this post.

Bye

Marco

I’ve discovered that Tasmota supports these. Select PZEM Send for Tx and PZEM Receive for Rx.

Number Electricity_POW_T "Energy kWh" (FirstFloor, Energy) {mqtt="<[mosquitto:tele/sonoff-pzem/SENSOR:state:JSONPATH($.ENERGY.Total)],<[mosquitto:stat/sonoff-pzem//STATUS8:state:JSONPATH($.StatusPWR.Total)]"}
Number Electricity_POW_YDay "Energy Yesterday" (FirstFloor, Energy) {mqtt="<[mosquitto:tele/sonoff-pzem/SENSOR:state:JSONPATH($.ENERGY.Yesterday)],<[mosquitto:stat/sonoff-pzem//STATUS8:state:JSONPATH($.StatusPWR.Yesterday)]"}
Number Electricity_POW_Day "Energy Today" (FirstFloor, Energy) {mqtt="<[mosquitto:tele/sonoff-pzem/SENSOR:state:JSONPATH($.ENERGY.Today)],<[mosquitto:stat/sonoff-pzem//STATUS8:state:JSONPATH($.StatusPWR.Today)]"}
Number Electricity_POW_P "Energy Power" (FirstFloor, Energy) {mqtt="<[mosquitto:tele/sonoff-pzem/SENSOR:state:JSONPATH($.ENERGY.Power)],<[mosquitto:stat/sonoff-pzem//STATUS8:state:JSONPATH($.StatusPWR.Power)]"}
Number Electricity_POW_A "Energy Current" (FirstFloor, Energy) {mqtt="<[mosquitto:tele/sonoff-pzem/SENSOR:state:JSONPATH($.ENERGY.Current)],<[mosquitto:stat/sonoff-pzem//STATUS8:state:JSONPATH($.StatusPWR.Current)]"}
Number Electricity_POW_V "Energy Voltage" (FirstFloor, Energy) {mqtt="<[mosquitto:tele/sonoff-pzem/SENSOR:state:JSONPATH($.ENERGY.Voltage)],<[mosquitto:stat/sonoff-pzem//STATUS8:state:JSONPATH($.StatusPWR.Voltage)]"}

Sitemap

		Text item=Electricity_POW_T label="Energy Total [%.1f kWh]" icon="Energy"
		Text item=Electricity_POW_YDay label="Energy Yesterday [%.1f kWh]" icon="Energy"
		Text item=Electricity_POW_Day label="Energy Today [%.1f kWh]" icon="Energy"
		Text item=Electricity_POW_P label="Energy Power [%.1f W]" icon="Energy"
		Text item=Electricity_POW_A label="Energy Current [%.1f A]" icon="Energy"
		Text item=Electricity_POW_V label="Energy Voltage [%.1f V]" icon="Energy"

Hi @pmknowles

Good news…thanks for sharing.

Hello everybody…I’m back just for a little update on my project.

I used my first Sonoff 4ch to drive some lights. I made some modifications to be able to use the device through my standard wall buttons.

As usual, more details on my blog:

Step n. 2 of my previous post. Integrating Sonoff 4 channel with TASMOTA firmware in OpenHAB.

I use it for 1 internal light and 3 exterior lights.

As usual, details in my blog

Cheers

Hi sir, could you please kindly provide the mq4 sensor ino file? Thanks!

Hi @kevinshane,

Following the example at the following link

https://www.geekstips.com/mq4-sensor-natural-gas-methane-arduino/

I wrote a class to interface MQ4 Gas sensor with my NodeMCU. See files

https://drive.google.com/open?id=14x7qp6Ohoj3SoKq7XhQGH9AtancW81_P

https://drive.google.com/open?id=1zLmphzwmfJ_HfRQDUt8iWYkhCLYuoqAJ

This is an example of utilization:

#define MQ4PIN A0
...
DDMQ4 mq4Sensor(MQ4PIN);
...

void setup() {

	...
	pinMode(MQ4PIN, INPUT);
	...
	
}

void loop() {

	...
	DDMQ4Val gasValue = mq4Sensor.getValue();
	...
	
}

In gasValue .ppm you get the value.

I hope it will be useful.

Cheers

1 Like

Hello everybody…just a little step to keep going on in my setup.

I was able to use two PZEM-004T with a single Nodemcu ESP8266…and, of course, all integrated in OpenHAB!!!

I used two PZEM-004T to monitor my photovoltaic production and the energy consumption of the basement…Then I also added to my device a simple DHT11 for temperature and humidity data (I already know that DHT11 is not a good sensor, but for my purposes it’s enough)

My central unit is a NodeMcu ESP8266 Lolin v.3…and it works perfectly.

This is the output from my Basic UI

And this is the chart in grafana

As usual, details in my blog

Cheers

Another little step forward…

  • Automating a floor lamp…Using SONOFF, TASMOTA and OPENHAB

  • Monitor temperature and humidity using a DHT11 with SONOFF Basic

Details here

Cheers

It’s time to finalize what already done till now in my Home Automation System, based on OpenHAB 2

First thing to do is packaging the custom devices built with ESP8266 and sensors.

image

As usual more detail in my blog

Cheers

A little update on my current cleaning job :slight_smile: on my personal blog.

Two PZEM-004T in one large box and a ESP8266 in a smaller one

Cheers

It’s time to try a google home assistant in my home automation.

I bought a Google Home Mini; I’m still testing it and in some days I will integrate it in OpenHAB

Hi all,

I played a lot with google home and google assistant…and then I integrated it in my OpenHAB setup

8DAuGnTQCLptHK3w4xbU3SMDsfFVWre2qvkWUixoMQf7KSH4yoo8tFNYaUV4J3kNdN8q2sQPrt4JNSHQGMmhUYiE2uQy681d716X9Kw9dFrfgMETfvvQ5fcKAUdZtmEvDVbtT654amFSGtSDAypq4JUN8XNFbbPEpiGPtYsZTRG

Take a look at my blog for details

Cheers

oohhhh…It’s been a long time since my my last post … Exactly one year ago…

My setup keeps growing…just slower than usual…I hope to find time to update my blog with the last additions.

For now I leave a couple of shot about my last installation…the wall mounted HabPanel … using the fantastic Hab Panel Viewer.

Thanks to HabPanelViewer features and a Sonoff I built an autocharging system…So when the battery reaches 20% the sonoff turns on the power to charge till 99%

3 Likes

Last night I made some experiment to use a PZEM004T power meter with a SONOFF 4CH flashed with TASMOTA. It works veri well and so I can integrate in OpenHAB the power meter for the first floor that was missing in my house … the last one …

Using a SONOFF already installed to drive some lights at the first floor I can use a PZEM004T without adding another 5V power adapter to power up the serial of PZEM. I will use the 3.3V from the SONOFF itself.

Details on my blog

Hi,

just an addendum to my last post… I published a video about my experiment with PZEM004T.

Here is it

Now I’m ready to integrate my last PZEM004T in my OpenHab System to monitor the first floor…the last floor without it :slight_smile: I already have a Sonoff 4CH in the right place that is driving some lights…I would attach PZEM004T to it.

Finally I bought my first Sonoff Mini. As always I flashed it with TASMOTA firmware, in order to integrate it in my OpenHAB system. With the DIY mode, it’s very easy to upload a firmware without touch anything (just a jumper :slight_smile: )

More details on my blog:

My Gazebo has lights :slight_smile:



They are controlled by a SONOFF Basic flashed with TASMOTA which has also a temperature sensor (DS18B20)

And naturally it is in my OpenHAB System…

Cheers

1 Like

Another little update. I begin my experiments my my new SONOFF Mini flashed with TASMOTA.

I would like to integrate a DHT11, a very basic and cheap temperature and humidity sensor. So I decided to flash a custom version of TASMOTA Lite with the DHT11 support. I built this custom release from TASMOTA source and with Visual Studio Code and platformIO.

As usual details on my blog

Next part of my test about DHT11 and Sonoff Mini with TASMOTA firmware Lite version compiled from source with the addition of DHT11 support. Here you can find how I interfaced DHT11 to Sonoff Mini

Details on my blog

1 Like