P1 smart meter arduino ESP8266

Moderator: leecollings

Post Reply
User avatar
mrefex
Posts: 26
Joined: Tuesday 14 March 2017 14:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7041
Contact:

P1 smart meter arduino ESP8266

Post by mrefex »

Hello,

I just starting to implement all my lights sensors and meters with this system.
With this project i stumbled arround i manage to read the data of the electricity/gas meter.
http://domoticx.com/p1-poort-slimme-met ... z-esp8266/

The only problem i encountered is that it won't write the data to my PI.

This is what i see on the serial output of the Wemos D1:

Code: Select all

1-3:0.2.8(42)
0-0:1.0.0(170314131418W)
0-0:96.1.1(4530303034303031353934343433323134)
1-0:1.8.1(005377.517*kWh)
1-0:2.8.1(000000.000*kWh)
1-0:1.8.2(005608.914*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0002)
1-0:1.7.0(00.531*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00003)
0-0:96.7.9(00001)
1-0:99.97.0(1)(0-0:96.7.19)(150327110946W)(0000005490*s)
1-0:32.32.0(00000)
1-0:32.36.0(00000)
0-0:96.13.1()
0-0:96.13.0()
1-0:31.7.0(003*A)
1-0:21.7.0(00.531*kW)
1-0:22.7.0(00.000*kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303032333430313530393436303134)
0-1:24.2.1(170314130000W)(01428.966*m3)
!5C49

VALID CRC FOUND!
[HTTP] GET... URL: http://192.168.1.129:8080/json.htm?type=command&param=udevice&idx=17&nvalue=0&svalue=5377517;5608914;0;0;531;0
[HTTP] GET... code: 401
[HTTP] GET... URL: http://192.168.1.129:8080/json.htm?type=command&param=udevice&idx=18&nvalue=0&svalue=1428966
[HTTP] GET... code: 401
[/color]

as you can see at the end it collected the correct data and wants it to send it to the domoticz server but it gets a returned 401 code (unauthorized)

And the weird part is when i copy this URL into my browser and send it i get:

Code: Select all

{
   "status" : "OK",
   "title" : "Update Device"
}
so what is wrong ? anybody can help me to fix this issue ?
User avatar
bbqkees
Posts: 407
Joined: Sunday 17 August 2014 21:01
Target OS: Linux
Domoticz version: 4.1x
Location: The Netherlands
Contact:

Re: P1 smart meter arduino ESP8266

Post by bbqkees »

Is the ESP on the same network and IP range as Domoticz?
Seems like a rights issue.
Bosch / Nefit / Buderus / Junkers / Worcester / Sieger EMS bus Wi-Fi MQTT Gateway and interface boards: https://bbqkees-electronics.nl/
User avatar
mrefex
Posts: 26
Joined: Tuesday 14 March 2017 14:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7041
Contact:

Re: P1 smart meter arduino ESP8266

Post by mrefex »

yes it is..it has been given by the router.

I will try another method with an ethernetshield...maybe that will work. But still i hope somebody has this project working and can tell me the sollution.

https://www.domoticz.com/forum/viewtopic.php?t=13667
User avatar
mrefex
Posts: 26
Joined: Tuesday 14 March 2017 14:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7041
Contact:

Re: P1 smart meter arduino ESP8266

Post by mrefex »

I did a new research today and i noticed the following.

If i copy paste the arduino HTTP output and try it on my desktop and my notebook my results are:

Code: Select all

http://192.168.1.129:8080/json.htm?type=command&param=udevice&idx=17&nvalue=0&svalue=5377517;5608914;0;0;531;0
Firefox 52.0 32bit on PC LAN : status OK
IE11 on PC LAN : 401 Unauthorized

Firefox 51.0 32bit on notebook wifi : i see a Domoticz Offline page
IE10 on notebook wifi : 401 Unauthorized
** I updated firefox to 52.0 and then it worked : Status OK
User avatar
bbqkees
Posts: 407
Joined: Sunday 17 August 2014 21:01
Target OS: Linux
Domoticz version: 4.1x
Location: The Netherlands
Contact:

Re: P1 smart meter arduino ESP8266

Post by bbqkees »

Well it coul dbe that you were logged into domoticz in Firefox and not in IE.

Try to include the user and pw in the URL.

Code: Select all

http://username:[email protected]:8080/json.htm?type=command&param=udevice&idx=17&nvalue=0&svalue=5377517;5608914;0;0;531;0
Bosch / Nefit / Buderus / Junkers / Worcester / Sieger EMS bus Wi-Fi MQTT Gateway and interface boards: https://bbqkees-electronics.nl/
User avatar
mrefex
Posts: 26
Joined: Tuesday 14 March 2017 14:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7041
Contact:

Re: P1 smart meter arduino ESP8266

Post by mrefex »

bbqkees wrote:Well it coul dbe that you were logged into domoticz in Firefox and not in IE.

Try to include the user and pw in the URL.

Code: Select all

http://username:[email protected]:8080/json.htm?type=command&param=udevice&idx=17&nvalue=0&svalue=5377517;5608914;0;0;531;0

Indeed. i just tried it and wanted to report it back. and i read your answer.
Even if i am on the same local network i have to use a username:password.

Do you have to set it in Domoticz in settings at : Local Networks (no username/password) ? because now it is empty.
EG: my domoticz is at 192.168.1.129 so i have to enter : 192.168.1.* ?
User avatar
bbqkees
Posts: 407
Joined: Sunday 17 August 2014 21:01
Target OS: Linux
Domoticz version: 4.1x
Location: The Netherlands
Contact:

Re: P1 smart meter arduino ESP8266

Post by bbqkees »

192.168.1.* should do the trick if both your Pi and the ESP are on the same subnet.
Bosch / Nefit / Buderus / Junkers / Worcester / Sieger EMS bus Wi-Fi MQTT Gateway and interface boards: https://bbqkees-electronics.nl/
User avatar
mrefex
Posts: 26
Joined: Tuesday 14 March 2017 14:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7041
Contact:

Re: P1 smart meter arduino ESP8266

Post by mrefex »

*UPDATE*

i adjusted the Local Network settings with my IP safe range (192.168.1.*) and modifed the script with the original code.
The only thing i changed was the update interval. Now it sends a new reading every 10sec. This is beacause the P1 meter does it automatically and the arduino sends new data every time it receives.
So i put in a 1 minute interval in the script which avoid some hangups in the arduino script.
so far so good !
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest