Page 1 of 1

P1 meter results are not showing

Posted: Tuesday 10 February 2015 0:18
by geoffrey
Hi,

I have a P1 DIY cable... which after some tweaking in python I got working to read out..
also the commandline nicely shows my output...

cu -l /dev/ttyUSB0 -s 9600 --parity=none
Connected.
<COMMENTED OUT>

0-0:96.1.1(39373936353532302020202020202020)
1-0:1.8.1(06389.574*kWh)
1-0:1.8.2(08383.062*kWh)
1-0:2.8.1(00000.000*kWh)
1-0:2.8.2(00000.000*kWh)
0-0:96.14.0(0001)
1-0:1.7.0(0000.53*kW)
1-0:2.7.0(0000.00*kW)
0-0:17.0.0(999*A)
0-0:96.3.10(1)
0-0:96.13.1()
0-0:96.13.0()
0-1:96.1.0(3238303131303038323033333632313132)
0-1:24.1.0(03)
0-1:24.3.0(150210000000)(00)(60)(1)(0-1:24.2.0)(m3)
(04293.080)
0-1:24.4.0(1)
!

so I know the cable is working... however in domoticz I only get 0 values for both my gas and electricity.

I added hardware
P1 Smart Meter USB Setup
(on the right USB port)

and activated the devices...

however all the returned values are 0.

I checked the json interface:

Code: Select all

{
5MinuteHistoryDays: 1,
ActTime: 1423523747,
AllowWidgetOrdering: true,
DashboardType: 0,
Latitude: <COMMEnteD OUt>,
Longitude: <COMMEnteD OUt>,
MobileType: 0,
TempScale: 1,
TempSign: "C",
WindScale: 1,
WindSign: "m/s",
dontcachehtml: true,
result: [
{
BatteryLevel: 255,
Counter: "0.000",
CounterDeliv: "0.000",
CounterDelivToday: "0.000 kWh",
CounterToday: "0.000 kWh",
CustomImage: 0,
Data: "0;0;0;0;0;0",
Favorite: 0,
HardwareID: 5,
HardwareName: "Smartmeter",
HaveTimeout: false,
ID: "1",
LastUpdate: "2015-02-10 00:15:45",
Name: "Smartmeter - Electro",
Notifications: "false",
PlanID: "0",
Protected: false,
SignalLevel: 12,
SubType: "Energy",
SwitchTypeVal: 0,
Timers: "false",
Type: "P1 Smart Meter",
TypeImg: "counter",
Unit: 1,
Usage: "0 Watt",
UsageDeliv: "0 Watt",
Used: 1,
XOffset: "0",
YOffset: "0",
idx: "17"
}
],
status: "OK",
title: "Devices"
}
and

Code: Select all

{
5MinuteHistoryDays: 1,
ActTime: 1423523841,
AllowWidgetOrdering: true,
DashboardType: 0,
Latitude: "51.994260",
Longitude: "4.469550",
MobileType: 0,
TempScale: 1,
TempSign: "C",
WindScale: 1,
WindSign: "m/s",
dontcachehtml: true,
result: [
{
BatteryLevel: 255,
Counter: "0.000",
CounterToday: "0.000 m3",
CustomImage: 0,
Data: "0",
Favorite: 0,
HardwareID: 5,
HardwareName: "Smartmeter",
HaveTimeout: false,
ID: "1",
LastUpdate: "2015-02-10 00:14:15",
Name: "Smartmeter - Gas",
Notifications: "false",
PlanID: "0",
Protected: false,
SignalLevel: 12,
SubType: "Gas",
SwitchTypeVal: 1,
Timers: "false",
Type: "P1 Smart Meter",
TypeImg: "counter",
Unit: 2,
Used: 1,
XOffset: "0",
YOffset: "0",
idx: "18"
}
],
status: "OK",
title: "Devices"
}
Any help on how to troubleshoot this?
I could create my python script to call the json and create virtual devices.... but would be great if it worked out of the box :)

Re: P1 meter results are not showing

Posted: Tuesday 10 February 2015 6:36
by antwan
Did you try to change the baudrate in hardware setup?

Re: P1 meter results are not showing

Posted: Tuesday 10 February 2015 6:48
by geoffrey
Yes I did... It should be the default 9600 but I also tried the larger value.

Re: P1 meter results are not showing

Posted: Tuesday 10 February 2015 23:04
by pwhooftman
geoffrey wrote:Yes I did... It should be the default 9600 but I also tried the larger value.
Are you sure? Mine only works when i set baudrate 115200 in Dmomoticz

Re: P1 meter results are not showing

Posted: Tuesday 10 February 2015 23:12
by geoffrey
unfortunately yes...

switching to 15200 gives me:
Tue Feb 10 23:10:30 2015 Error: Smartmeter hardware (5) nothing received for more then 1 Minute!....
Tue Feb 10 23:10:31 2015 Error: Restarting: Smartmeter

while switching to 9600 gives:
Tue Feb 10 23:12:09 2015 (Smartmeter) P1 Smart Meter (Electra)

Re: P1 meter results are not showing

Posted: Tuesday 17 February 2015 9:34
by bbqkees
Can you try to connect to the serial port with PuTTY?

It will show you the raw data of the P1 port. You should see the complete datagrams. If it is OK there, your hardware is fine.
If it shows gibberish or nothing than the problem is in your hardware setup.

You maybe have not correctly connected the RTS line to 5V.
I assume you followed click

Re: P1 meter results are not showing

Posted: Tuesday 17 February 2015 20:32
by geoffrey
Yeah the terminal shows the right results... As does the python script....

Re: P1 meter results are not showing

Posted: Wednesday 18 February 2015 12:35
by bbqkees
What system are you using it on? A Pi with the latest stable?

Re: P1 meter results are not showing

Posted: Wednesday 18 February 2015 20:28
by geoffrey
Yeah correct.... RPi with DomoticzV2.2025

Re: P1 meter results are not showing

Posted: Thursday 19 February 2015 13:47
by bbqkees
And how did you make the cable?

If you use the correct hardware it should work out of the box in domoticz.

Re: P1 meter results are not showing

Posted: Thursday 19 February 2015 13:48
by bbqkees
Maybe a stupid question: did you click on 'Allow hardware for 5 minutes" before adding the hardware?

Re: P1 meter results are not showing

Posted: Sunday 03 July 2016 10:33
by CrashHouse
Found the solution? I'm experiencing exactly the same.

Although I had to set te permissions for ttyUSB0 first, but now 'sudo cu -l /dev/ttyUSB0 -s 9600 --parity=none' gives me the right information, just does't show in Domoticz.

Output:

Code: Select all

Connected.
/XMX5XMXABCD100003654

0-0:96.1.1(4B383257303039373435393037343131)
1-0:1.8.1(08871.778*kWh)
1-0:1.8.2(07177.896*kWh)
1-0:2.8.1(02150.857*kWh)
1-0:2.8.2(05204.918*kWh)
0-0:96.14.0(0001)
1-0:1.7.0(0002.75*kW)
1-0:2.7.0(0000.00*kW)
0-0:96.13.1()
0-0:96.13.0()
0-1:96.1.0(3238303131303038323333313532373132)
0-1:24.1.0(03)
0-1:24.3.0(160703100000)(08)(60)(1)(0-1:24.2.0)(m3)
(07056.183)
!

Start at the beginning...

Posted: Sunday 03 July 2016 13:12
by CrashHouse
Well I made a cable as described at viewtopic.php?f=14&t=4970&hilit=p1+cable. After some fiddling I got the cable working in puTTY. After that I tried to install the cable on my Pi3. But after:

Code: Select all

sudo cu -l /dev/ttyUSB0 -s 9600 --parity=none


I got this message:

Code: Select all

Line in use
Only after I changed permissions

Code: Select all

sudo chmod 666 /dev/ttyUSB0
I got the output as mentioned earlier.

But after a reboot all is adjusted to the prior settings.

So I thought I would set the permissions persistent as described in http://ask.xmodulo.com/change-usb-devic ... linux.html so after a reboot Domoticz could see and connect the USB0 serial adapter.

Domoticz does see my P1 as hardware and I can add devices (Gas and Power) but values are stuck at 0.
If I run

Code: Select all

sudo cu -l /dev/ttyUSB0 -s 9600 --parity=none
on my Pi3 I get reading which is adjusting constantly.

So what am I doing wrong?

Little update...

Posted: Sunday 03 July 2016 13:20
by CrashHouse
Just installed Domoticz on my spare Windows laptop and...

Cable works just fine in Domoticz. Perfect readings...

So why not on the Pi3?