ESP Easy and POW R2

Post Reply
Prutsium
Posts: 70
Joined: Monday 18 June 2018 11:31
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Germany / Netherlands
Contact:

ESP Easy and POW R2

Post by Prutsium » Monday 18 June 2018 11:45

Hello all,

I started already a topic on the ESPEasy forum in regards of the support for the POW R2 and this is implemented now.
But i run in some issues mainly related to Domoticz.

First as ESPEasy sends all 4 values to 1 IDX i had to split them up and thats perfectly working via:

Code: Select all

On POW_2_Sensors#POW_2_Voltage do
SendToHTTP 192.168.99.5,8080,/json.htm?type=command&param=udevice&idx=93&nvalue=0&svalue=[POW_2_Sensors#POW_2_Voltage] //Send the Voltage data to Domoticz
SendToHTTP 192.168.99.5,8080,/json.htm?type=command&param=udevice&idx=94&nvalue=0&svalue=[POW_2_Sensors#POW_2_Power] //Send the Watt data to Domoticz
SendToHTTP 192.168.99.5,8080,/json.htm?type=command&param=udevice&idx=95&nvalue=0&svalue=[POW_2_Sensors#POW_2_Current] //Send the Amp data to Domoticz
SendToHTTP 192.168.99.5,8080,/json.htm?type=command&param=udevice&idx=96&nvalue=0&svalue=[POW_2_Sensors#POW_2_Pulses] //Send the Usage data to Domoticz
endon
And i am able to get all the 4 values in Domoticz.
The tricky part comes for the pulse counter. As ESPEasy is using an rotating pulse counter that counts from 0 - 65535 and then restarts at 0 it seems Domoticz is not able to handle that. (As far as i could figure out 12530 pulses would be 1KW) https://github.com/letscontrolit/ESPEas ... SE7766.ino

Anybody a clue how to add this rotating pulse counter as power meter to Domoticz?

jake
Posts: 492
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi
Domoticz version: beta
Contact:

Re: ESP Easy and POW R2

Post by jake » Monday 18 June 2018 11:56

By adding a couple extra lines to your script: put the current counter in a variable and compare next time. If new < old then usage is (new+65k) - old. New pulse value is current pulse value + usage.
Only send that calculated value to the domoticz idx.

Prutsium
Posts: 70
Joined: Monday 18 June 2018 11:31
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Germany / Netherlands
Contact:

Re: ESP Easy and POW R2

Post by Prutsium » Monday 18 June 2018 12:44

jake wrote:
Monday 18 June 2018 11:56
By adding a couple extra lines to your script: put the current counter in a variable and compare next time. If new < old then usage is (new+65k) - old. New pulse value is current pulse value + usage.
Only send that calculated value to the domoticz idx.
Not sure how to do that within ESPEasy .....

Prutsium
Posts: 70
Joined: Monday 18 June 2018 11:31
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Germany / Netherlands
Contact:

Re: ESP Easy and POW R2

Post by Prutsium » Thursday 21 June 2018 15:48

Btw ... this is how Domoticz handles right now the incoming data from the POW (R2)
Image

Keep in mind i did not set any divider yet but its clear to see its not adding but just restarting the counter.

User avatar
sincze
Posts: 995
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: ESP Easy and POW R2

Post by sincze » Sunday 24 June 2018 20:39

Prutsium wrote:
Monday 18 June 2018 12:44
jake wrote:
Monday 18 June 2018 11:56
By adding a couple extra lines to your script: put the current counter in a variable and compare next time. If new < old then usage is (new+65k) - old. New pulse value is current pulse value + usage.
Only send that calculated value to the domoticz idx.
Not sure how to do that within ESPEasy .....
I guess this pointer is for ESPEasy to create a rule under rules to do this for you.
Rules are explained on the https://www.letscontrolit.com/wiki/inde ... rial_Rules

Store the 'old' values in a ESP Task with HW Dummy and do the calculation.
Currently I haven't prepared my R2 with ESPEASY as I did not notice the progress that it actually works ;-) now.
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

User avatar
sincze
Posts: 995
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: ESP Easy and POW R2

Post by sincze » Sunday 29 July 2018 18:38

Indeed it is working. POW R2.
Fun part is that the manual is totally wrong regarding the connections.... :oops:
Its L GG L N N in my case looking at it from the front.
Luckily it was mentioned on the PCB as well.

Now I will extract the data using rules and store them in several devices in Domoticz. :D
Sonoff POW R2.JPG
Sonoff POW R2.JPG (47.06 KiB) Viewed 2021 times
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

Prutsium
Posts: 70
Joined: Monday 18 June 2018 11:31
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Germany / Netherlands
Contact:

Re: ESP Easy and POW R2

Post by Prutsium » Sunday 29 July 2018 18:49

sincze wrote:
Sunday 29 July 2018 18:38
Indeed it is working. POW R2.
Fun part is that the manual is totally wrong regarding the connections.... :oops:
Its L GG L N N in my case looking at it from the front.
Luckily it was mentioned on the PCB as well.

Now I will extract the data using rules and store them in several devices in Domoticz. :D
Sonoff POW R2.JPG
Let me know the progress as i switched to Tasmota right now and actually that works flawless and at least support bi-directional MQTT/

User avatar
sincze
Posts: 995
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: ESP Easy and POW R2

Post by sincze » Sunday 29 July 2018 20:36

@Prutsium: Guess you were looking for the KwH right? Or different value? As you mentioned the pulses. I'll be sending the data every 30 sec of 1 minute we can do something with that or count the amount of pulses indeed over a time period and look at the difference.
Sonoff POW R2-vpc.JPG
Sonoff POW R2-vpc.JPG (87.36 KiB) Viewed 2004 times
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

Prutsium
Posts: 70
Joined: Monday 18 June 2018 11:31
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Germany / Netherlands
Contact:

Re: ESP Easy and POW R2

Post by Prutsium » Sunday 29 July 2018 21:06

sincze wrote:
Sunday 29 July 2018 20:36
@Prutsium: Guess you were looking for the KwH right? Or different value? As you mentioned the pulses. I'll be sending the data every 30 sec of 1 minute we can do something with that or count the amount of pulses indeed over a time period and look at the difference.

Sonoff POW R2-vpc.JPG
Yupp the Total usage (pulses) as they are a rolling counter (goes to 65xxx and then back to 0) You must do a lot of tricks to get them stored.
Thats why i went on the dark side of Tasmota (i run about 25 different devices with ESP Easy in my house but only the ones requiring current or bi-directional MQTT are on Tasmota)

With Tasmota its plug and play for the POW(R2) and for the bi-directional MQTT i need it on some devices due power outages so when they come back (pi runs on a UPS but not the plugs) Domoticz will set them back to their old state (MQTT Remain state) Since in ESP Easy its not possible to send data to it over MQTT.

User avatar
sincze
Posts: 995
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: ESP Easy and POW R2

Post by sincze » Sunday 29 July 2018 21:37

Prutsium wrote:
Sunday 29 July 2018 21:06
sincze wrote:
Sunday 29 July 2018 20:36
@Prutsium: Guess you were looking for the KwH right? Or different value? As you mentioned the pulses. I'll be sending the data every 30 sec of 1 minute we can do something with that or count the amount of pulses indeed over a time period and look at the difference.

Sonoff POW R2-vpc.JPG
Yupp the Total usage (pulses) as they are a rolling counter (goes to 65xxx and then back to 0) You must do a lot of tricks to get them stored.
Thats why i went on the dark side of Tasmota (i run about 25 different devices with ESP Easy in my house but only the ones requiring current or bi-directional MQTT are on Tasmota)

With Tasmota its plug and play for the POW(R2) and for the bi-directional MQTT i need it on some devices due power outages so when they come back (pi runs on a UPS but not the plugs) Domoticz will set them back to their old state (MQTT Remain state) Since in ESP Easy its not possible to send data to it over MQTT.
Ok so we got the amount of pulses between measurements. I guess??
Sonoff POW R2-pulses.JPG
Sonoff POW R2-pulses.JPG (67.91 KiB) Viewed 1997 times
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

Prutsium
Posts: 70
Joined: Monday 18 June 2018 11:31
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Germany / Netherlands
Contact:

Re: ESP Easy and POW R2

Post by Prutsium » Monday 30 July 2018 8:49

sincze wrote:
Sunday 29 July 2018 21:37
Prutsium wrote:
Sunday 29 July 2018 21:06
sincze wrote:
Sunday 29 July 2018 20:36
@Prutsium: Guess you were looking for the KwH right? Or different value? As you mentioned the pulses. I'll be sending the data every 30 sec of 1 minute we can do something with that or count the amount of pulses indeed over a time period and look at the difference.

Sonoff POW R2-vpc.JPG
Yupp the Total usage (pulses) as they are a rolling counter (goes to 65xxx and then back to 0) You must do a lot of tricks to get them stored.
Thats why i went on the dark side of Tasmota (i run about 25 different devices with ESP Easy in my house but only the ones requiring current or bi-directional MQTT are on Tasmota)

With Tasmota its plug and play for the POW(R2) and for the bi-directional MQTT i need it on some devices due power outages so when they come back (pi runs on a UPS but not the plugs) Domoticz will set them back to their old state (MQTT Remain state) Since in ESP Easy its not possible to send data to it over MQTT.
Ok so we got the amount of pulses between measurements. I guess??
Sonoff POW R2-pulses.JPG
Yes but also did you handle the fact that the total pulses will jump to 0 when they reach 65xxx? So you must create a virtual Previous + New.

User avatar
sincze
Posts: 995
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: ESP Easy and POW R2

Post by sincze » Monday 30 July 2018 11:02

Prutsium wrote:
Monday 30 July 2018 8:49

Yes but also did you handle the fact that the total pulses will jump to 0 when they reach 65xxx? So you must create a virtual Previous + New.
Yes I did, that was the tricky part right ??
Store the value of the pulses in new variable and then the magic starts.
It was described a few posts back on how to do it.

Now I need to figure out what we want to do with the pulses. :D
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

User avatar
sincze
Posts: 995
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: ESP Easy and POW R2

Post by sincze » Monday 30 July 2018 18:46

I've been looking into Tasmota as well. Pretty nice.
I'll backup my configuration for now and try Tasmota,
But maybe not I'm not using MQTT.. Nor MQTT Client..

Tasmota:

Code: Select all

Message   | Unit | Description
----------|------|-----------------------------------------------------
Total     | kWh  | Total Energy usage including Today
Yesterday | kWh  | Total Energy usage between 00:00 and 24:00 yesterday
Today     | kWh  | Total Energy usage today from 00:00 until now
Period    | Wh   | Energy usage between previous message and now
Power     | W    | Current power load
Factor    |      | The ratio of the real power flowing to the load to
          |      |   the apparent power in the circuit 
Voltage   | V    | Current line voltage
Current   | A    | Current line current
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

User avatar
sincze
Posts: 995
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: ESP Easy and POW R2

Post by sincze » Monday 30 July 2018 20:05

If you just create a virtual sensor Electric (Instant+Counter).

Open the sensor and select 'computed'.
https://www.domoticz.com/wiki/Domoticz_ ... counter.29 it can help to monitor the kwh.
Sonoff POW R2-kwh.JPG
1
Sonoff POW R2-kwh.JPG (19.36 KiB) Viewed 1923 times
In this case I just see no usage anymore for the pulse counting.

Any suggestions?

I now have:
Sonoff POW R2-kwh-final.JPG
2
Sonoff POW R2-kwh-final.JPG (50.57 KiB) Viewed 1923 times
tnx.
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

michass
Posts: 23
Joined: Tuesday 27 March 2018 14:39
Target OS: NAS (Synology & others)
Domoticz version: 4.10064
Location: Gdynia
Contact:

Re: ESP Easy and POW R2

Post by michass » Tuesday 16 October 2018 8:05

Hi, is there compiled packege for POW R2?
Please tell me, which is proper for this item
Synology NAS
Heating: eq-3 MAX!
Vent: by Sonoff POW R2 & Espeasy
Cam: Foscam C1

Prutsium
Posts: 70
Joined: Monday 18 June 2018 11:31
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Germany / Netherlands
Contact:

Re: ESP Easy and POW R2

Post by Prutsium » Tuesday 16 October 2018 8:46

michass wrote:
Tuesday 16 October 2018 8:05
Hi, is there compiled packege for POW R2?
Please tell me, which is proper for this item
Just grab Tasmota this is the most easy way to get the values into domoticz (MQTT Required)

michass
Posts: 23
Joined: Tuesday 27 March 2018 14:39
Target OS: NAS (Synology & others)
Domoticz version: 4.10064
Location: Gdynia
Contact:

Re: ESP Easy and POW R2

Post by michass » Tuesday 16 October 2018 9:14

Thanks, but my hardware (NAS) are not compatible with mosquitto yet.
I need to use HTTP communication with Domoticz.
Synology NAS
Heating: eq-3 MAX!
Vent: by Sonoff POW R2 & Espeasy
Cam: Foscam C1

User avatar
sincze
Posts: 995
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: ESP Easy and POW R2

Post by sincze » Tuesday 16 October 2018 11:35

michass wrote:
Tuesday 16 October 2018 9:14
Thanks, but my hardware (NAS) are not compatible with mosquitto yet.
I need to use HTTP communication with Domoticz.
Please Have a look at [http://www.letscontrolit.com/forum/viewtopic.php?t=5246]

Did the job for me just fine. Still up and running.
Using Pass2php since 2016-12
LAN: RFLink, P1-Port, OTGW, MySensors
USB: RFXCom, ZWave
WIFI: Mi-light Wifi-Bridge, Sonoff, ESP8266, Xiaomi Gateway
Solar: Omnik Inverter, PVOutput
Video: Kodi clients with Harmony HUB
Sensors: You name it I probably got 1.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests