Page 1 of 1
After update Stable to 2020.1 Problems with P1
Posted: Monday 23 March 2020 9:40
by Knibor
Hi,
Today I have updated Domoticz Stable to Version 2020.1
Now I have
very high readings from my devices General Counter,incremental.
I use this script for reading several readings from my P1 "slimme meter"
What to do for solve this problem?
Thanks
Code: Select all
--[[ dzVents script to Parse P1 Smart Meter Electricity value into seperated Meter Readings.
]]-- The following need updated for your environment get the 'Idx' or 'Name' of the Device tab.
local fetchIntervalMins = 1 -- (Integer) (Minutes, Range 5-60) How often SE file is fetched
local P1data = 4 -- Electra, P1 Smart Meter device
local idxu1 = 15 -- Meter Usage low, Virtual device, counter incremental
local idxu2 = 16 -- Meter Usage High, Virtual device, counter incremental
local idxr1 = 17 -- Meter Return Low, Virtual device, counter incremental
local idxr2 = 18 -- Meter Return High, Virtual device, counter incremental
local idxcons = 19 -- Meter Actual Usage, Virtual device, counter incremental
local idxprod = 20 -- Meter Actual Production, Virtual device, counter incremental
local ScriptVersion = '0.1.5'
return {
active = true,
logging = {
-- level = domoticz.LOG_DEBUG, -- Uncomment this line to override the dzVents global logging setting
marker = 'SME '.. ScriptVersion
},
on = {
timer = { 'every minute' }
},
execute = function(domoticz, device)
-- Get values from device P1Data of the Smart Meter
local SMdata = domoticz.devices(P1data).rawData
-- Update the device and Debug meassages with the accessory values from table SMdata
domoticz.devices(idxu1).updateCounter(SMdata[1])
domoticz.log('Gebruik laag = '.. SMdata[1], domoticz.LOG_DEBUG)
domoticz.devices(idxu2).updateCounter(SMdata[2])
domoticz.log('Gebruik hoog = '.. SMdata[2], domoticz.LOG_DEBUG)
domoticz.devices(idxr1).updateCounter(SMdata[3])
domoticz.log('Levering laag = '.. SMdata[3], domoticz.LOG_DEBUG)
domoticz.devices(idxr2).updateCounter(SMdata[4])
domoticz.log('Levering hoog = '.. SMdata[4], domoticz.LOG_DEBUG)
domoticz.devices(idxcons).updateCounter(SMdata[5])
domoticz.log('Actuele verbruik = '.. SMdata[5], domoticz.LOG_DEBUG)
domoticz.devices(idxprod).updateCounter(SMdata[6])
domoticz.log('Actuele levering = '.. SMdata[6], domoticz.LOG_DEBUG)
end -- execute
}
Re: After update Stable to 2020.1 Problems with P1
Posted: Monday 23 March 2020 10:34
by waaren
Knibor wrote: ↑Monday 23 March 2020 9:40
Today I have updated Domoticz Stable to Version 2020.1 Now I have
very high readings from my devices General Counter,incremental.
Can you enable logging in the script and show the log / report page for one of the target devices ?
Re: After update Stable to 2020.1 Problems with P1
Posted: Monday 23 March 2020 10:39
by McMelloW
Works all OK with me after the upgrade. Just checked all.
Check your input, what are you receiving from your meter. As you can read, the script does nothing to the values. Just getting the correct value out of the long string, P1data, and update this to the correct device.
Try a stop and start of domoticz?
Re: After update Stable to 2020.1 Problems with P1 [Solved]
Posted: Monday 23 March 2020 10:46
by Knibor
Hi,
Problem solved, I see on this forum they already discussed this problem. I changed device "General Counter,incremental" to
"RFXmeter, RFX Meter Counter" with the same script and now it works perfect.
Re: After update Stable to 2020.1 Problems with P1
Posted: Monday 23 March 2020 12:35
by McMelloW
Knibor wrote: ↑Monday 23 March 2020 10:46
Hi,
Problem solved, I see on this forum they already discussed this problem. I changed device "General Counter,incremental" to
"RFXmeter, RFX Meter Counter" with the same script and now it works perfect.
Good to read all is working.
Just being curious, how did you change the devices?
Re: After update Stable to 2020.1 Problems with P1
Posted: Monday 23 March 2020 13:15
by itsbvka
I'm having the same or similar issue, and tried changing the dummy device.
However, now I get an error code, clues are welcome why this doesn't work for me while reported working above.
2020-03-23 13:14:00.284 Error: dzVents: Error: (3.0.1) SME 0.1.7: Method updateCounter is not available for device "idxcons" (deviceType=General, deviceSubType=kWh). If you believe this is not correct, please report.
2020-03-23 13:14:00.286 Error: dzVents: Error: (3.0.1) SME 0.1.7: Method updateCounter is not available for device "idxprod" (deviceType=General, deviceSubType=kWh). If you believe this is not correct, please report.
UPDATE: used wrong device, should be Counter instead of anything else
Re: After update Stable to 2020.1 Problems with P1
Posted: Saturday 11 April 2020 22:55
by astrapowerrr
Hi,
when running into trouble after updating to stable version 2020.1 a week ago i came at last at this topic.
here i found the solution so thanks!!
1 question remaining how do you transfer the data from the old dummy sensor to the new one?
i have all my history on energy use etc stored now in the old dummy, but i cannot replace it because i think its another type of sensor?
please help.
Re: After update Stable to 2020.1 Problems with P1
Posted: Sunday 12 April 2020 0:01
by waaren
astrapowerrr wrote: ↑Saturday 11 April 2020 22:55
i have all my history on energy use etc stored now in the old dummy, but i cannot replace it because i think its another type of sensor?
please help.
What are the id's, name , types and subtypes of the old and new devices ?
Probably you need to transfer the historical data with a database tool like sqlite. Happy to help if you feel comfortable with that.
Re: After update Stable to 2020.1 Problems with P1
Posted: Sunday 12 April 2020 0:05
by astrapowerrr
Thanks.
Will come back to that tomorrow or day after. Now in my bed!!
After update Stable to 2020.1 Problems with P1
Posted: Sunday 12 April 2020 13:25
by astrapowerrr
waaren wrote:astrapowerrr wrote: ↑Saturday 11 April 2020 22:55
i have all my history on energy use etc stored now in the old dummy, but i cannot replace it because i think its another type of sensor?
please help.
What are the id's, name , types and subtypes of the old and new devices ?
Probably you need to transfer the historical data with a database tool like sqlite. Happy to help if you feel comfortable with that.
Here are 2 screenshot of my devices list. Names are the same list of old en new dummy’s.
This is the info you need?
Verzonden vanaf mijn iPad met Tapatalk
Re: After update Stable to 2020.1 Problems with P1
Posted: Sunday 12 April 2020 14:22
by waaren
astrapowerrr wrote: ↑Sunday 12 April 2020 13:25
This is the info you need?
Yes. Will have a look but could take some time.
Re: After update Stable to 2020.1 Problems with P1
Posted: Monday 13 April 2020 2:10
by waaren
astrapowerrr wrote: ↑Sunday 12 April 2020 13:25
This is the info you need?
This should do the job
Code: Select all
service domoticz stop
cd <domoticz directory>
sudo cp domoticz.db domoticz.keep # make a copy of current database and store it on a safe place
sudo apt install sqlite3 # if you do not have sqlite3 on your system yet
sudo sqlite3 domoticz.db
-- for all devices use the line below these comment lines to copy current status.
-- Replace xxxx with old device id and yyyy with new device id
-- zzz is the factor you can use. Don't know for your situation but start with 1 and you will see in the GUI
-- if that's too low or too high. To increase use 10, 100 or 1000 to decease use 0.1, 0.01 or 0.001
sqlite> update devicestatus set sValue = (select sValue * 10 from devicestatus where id = xxxx ) where id = yyyy; -- Transfer current state to new device
-- for all devices use the line below this comment line to delete short log for new virtual sensors
sqlite> delete from meter where id is yyyy;
-- make a temp copy of the meter_calendar table
sqlite> create table temp as select * from meter_calendar;
-- for all devices use the lines below this comment lines to copy long term history logs for new virtual sensors
sqlite> update temp set devicerowid = yyyy where devicerowid = xxxx;select changes() -- change ID in temp
sqlite> insert into meter_calendar select * from temp where devicerowid = yyyy;select changes(); -- copy all with new ID from temp
sqlite> update meter_calendar set value = value * zzz where devicerowid = yyyy; -- Adjust values only when needed
sqlite> update meter_calendar set counter = counter * zzz where devicerowid = yyyy; -- Adjust values only when needed
-- You don't need temp table
sqlite> drop table temp;
sqlite> .quit
sudo service domoticz start
clear cache
Re: After update Stable to 2020.1 Problems with P1
Posted: Monday 13 April 2020 23:01
by astrapowerrr
not a way to do this in windows? i really dont understand what you want me to do in that text lines..
im really not a Linux here. i hoped it was a copy paste thing..
Re: After update Stable to 2020.1 Problems with P1
Posted: Monday 13 April 2020 23:08
by waaren
astrapowerrr wrote: ↑Monday 13 April 2020 23:01
not a way to do this in windows? i really dont understand what you want me to do in that text lines..
im really not a Linux here. i hoped it was a copy paste thing..
sqlite3 is also available for Windows. The sqlite commands are the same for Windows as for Linux.
Google can be your friend

Re: After update Stable to 2020.1 Problems with P1
Posted: Monday 13 April 2020 23:12
by astrapowerrr
Hmmm ok... well maybe when my Luck is better I’ll give it a shot. Having a lot of fixing right now after new update. Fixing now for about 1 1/2 week every evening to get stuff working again.
Going from one to another problem.
So when I have the peace on my mind I will dive in to this sql thing.
But thanks anyway waaren!
Verzonden vanaf mijn iPhone met Tapatalk
Re: After update Stable to 2020.1 Problems with P1
Posted: Monday 04 May 2020 3:20
by ruudjanse
Knibor wrote: ↑Monday 23 March 2020 10:46
Hi,
Problem solved, I see on this forum they already discussed this problem. I changed device "General Counter,incremental" to
"RFXmeter, RFX Meter Counter" with the same script and now it works perfect.
How can I change the devices to "RFXmeter, RXF Meter Counter", I'm searching for this option. I've tried to make new devices, but can't find RFXmeter options in the menu.
Sorry but I'm a newby on this...
Regards
Re: After update Stable to 2020.1 Problems with P1
Posted: Monday 04 May 2020 8:49
by waaren
ruudjanse wrote: ↑Monday 04 May 2020 3:20
How can I change the devices to "RFXmeter, RXF Meter Counter", I'm searching for this option. I've tried to make new devices, but can't find RFXmeter options in the menu.
Regards
There is no option to change a devicetype from incremental counter to RFXmeter, RFX Meter Counter.
But you can make new "RFXmeter, RFX Meter Counter" by choosing devicetype Counter in the "Create Virtual Sensor" popup.