update: new updated files attached (3rd update) after a few hickups
I have made an additional plugin working beside the Dutch Smart Meter as written by bfromdruten.
It will take the data from the plugin, i.e. Low, High and Gas readings.
It takes every minute the values and check’s the time;
if the time is: just after midnight or begin of the month at midnight, or 1 jan just after midnight is it will safe the data
for the last 7 days, last 5 month and for the last 3 years the data is shown and the consumption is presented.
the database will be created in time, so the values are not know yet, to put all the data required i made a scene called reset and in the LUUP i have copied the reset luup in to here and run it
the “this device” in resetluup and I_dutchSmartMeterCounter.xml are the new device
the “LowMeter” & “HighMeter” & "GasMeter"in I_duchSmartMeterCounter.xml are the devices created by the DutchSmartMeter by bfromdruten
(ImportRate1 & ImportRate2 & dutchSmartMeter:1)
If somebody can add an grapical page to the D_dutchSmartMeterCounter.json I would appriciated it, cause that is way over my head
@ScreamHouse;
In the I_ file you have to change the device numbers to your numbers;
Look in the ImportRate1 for the devicenummer for the LowMeter
Look in the ImportRate2 for the devicenummer for the HighMeter
Look in the dutchSmartMeter:1 for the devicenummer for the Gasmeter
Almost there…I see a lot of fields in the new device, but when I run a scene with your luupcode it is not filling the values.
In the I.xml i have changed the device ID’s as well as the this device ID in the reset luup to my newly created device.
if you got a table with a lot of “0” and only the text Today and Yesterday than you got it
Time will fill the data
Every day at midnight a new set of data is taken en filled in
The same on the right side, but than monthly
have it running for a night and look tomorrow if the data from midnight is in the list
to send the readings by mail i have done the following;
1 made a scene and with the time i trigger one a month (or one every monday or so) to trigger a luup
local smtp = require("socket.smtp")
local SMTP_SERVER = "xxx.xxxx.xx"
local SMTP_PORT = "25"
local USER_SENDING = "<xxx@xxx.xx>"
local USER_RECEIVING = "<xxxx@xxx.xx>"
local METER_DEV_ID = 27
local METER1_DEV_ID = 34
local METER2_DEV_ID = 35
local gas= luup.variable_get("urn:brutgrink-com:serviceId:dutchSmartMeter", "Gas", METER_DEV_ID ) or "0"
local kwh1= luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "KWH", METER1_DEV_ID ) or "0"
local kwh2= luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "KWH", METER2_DEV_ID ) or "0"
local from = USER_SENDING
local rcpt = {USER_RECEIVING}
local mesgt = {
headers = {
to = USER_RECEIVING,
subject = "Meterstanden"
},
body = "Meterstanden van :\nGas\t\t\t= " .. gas .. "\nLaag\t\t\t= " .. kwh1 .. "\nHoog\t\t\t= " .. kwh2
}
local r, e = smtp.send{
from = from,
rcpt = rcpt,
source = smtp.message(mesgt),
server = SMTP_SERVER,
port = SMTP_PORT,
}
if (e) then
luup.log("Error " .. e)
end
the ID are the same as in the addtional plug in
you have to change the xxx@xxx.xx to your adress@whatever.com
the server is your own outgoing server (same as in your email account) mail@xxxx. or pop@knp or so
Be advise to update the files of the additional plug in, due to a different interval timing protocol ,
the provious was having some hick ups
Huib, thx i am using that one already. What i am after without any programming skills is to receive the usage (sunday - last sunday). So if last sunday my gas meter was 150m3 and this sundsy 220m3, i want to receive the value 70m3.
local smtp = require("socket.smtp")
local SMTP_SERVER = "xxx.xxxx.xx"
local SMTP_PORT = "25"
local USER_SENDING = "<xxx@xxx.xx>"
local USER_RECEIVING = "<xxxx@xxx.xx>"
local METER_DEV_ID = 27
local METER1_DEV_ID = 34
local METER2_DEV_ID = 35
local ADD_Plugin = 120 -- put the id of the additional plugin
local gas= luup.variable_get("urn:brutgrink-com:serviceId:dutchSmartMeter", "Gas", METER_DEV_ID ) or "0"
local kwh1= luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "KWH", METER1_DEV_ID ) or "0"
local kwh2= luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "KWH", METER2_DEV_ID ) or "0"
local last_gas = luup.variable_get("urn:Kuiper-com:serviceId:dutchSmartMeterCounter", "TodayGas_6", ADD_Plugin ) or "0"
local last_kwh1= luup.variable_get("urn:Kuiper-com:serviceId:dutchSmartMeterCounter", "TodayLow_6", ADD_Plugin ) or "0"
local last_kwh2= luup.variable_get("urn:Kuiper-com:serviceId:dutchSmartMeterCounter", "TodayHigh_6", Add_Plugin ) or "0"
local gas = gas - last_gas
local kwh1 = kwh1 - last_kwh1
local kwh2 = kwh2 - last_kwh2
local from = USER_SENDING
local rcpt = {USER_RECEIVING}
local mesgt = {
headers = {
to = USER_RECEIVING,
subject = "Meterstanden"
},
body = "Verbruik standen van :\nGas\t\t\t= " .. gas .. "\nLaag\t\t\t= " .. kwh1 .. "\nHoog\t\t\t= " .. kwh2
}
local r, e = smtp.send{
from = from,
rcpt = rcpt,
source = smtp.message(mesgt),
server = SMTP_SERVER,
port = SMTP_PORT,
}
if (e) then
luup.log("Error " .. e)
end
i did not yet tried it but if you look at the script it must work
do change the ID of the different plugins
i do not see any error in the script
the only thing i can think of is that in the line
local last_kwh2= luup.variable_get(“urn:Kuiper-com:serviceId:dutchSmartMeterCounter”, “TodayHigh_6”, Add_Plugin ) or “0”
some thing is not correct and the value of “0” is taken
further the value _6 has to be _7 to take the reading from one week a go
what do you mean of (If you could add Year to date as well, it would be great, I did try myself, but messed it up)
I think because I run it in a weekend the High tarif is 0 is the reason. Let me run it during the week.
What I would like to have send as well is the year consumption in a same mail. This way I know when I get the mail how much my total consumption was up till now. Just a nice to have, really happy with the plugin as is