New plugin for reading the gas and electricity usage from a Dutch Smart meter

@bfromdruten:

have installed your plugin and have the following querry;

is is possible to have the readings sent by email to a certail email adress at a certain interval; (ie every monday at 12 hrs or so)

the reason is to monitor the consumption and record it in a seperate program
with out having a second pc running 24/7

your respond is highly appriciated

@bfromdruten:

can you how i can find the data for the gas meter and the meter 1 and meter 2

if i read your I_dutchSmartMeter correctly the you save the data in “Gas” and “KWH”

at the moment i have created the scedule to sent once a week at monday at 1200 hrs an email to my self.

my idea is to sent the last taken value of the gas meter, e meter 1 and 2 at that moment

if i repeat the same event the next week i get the readigs from one week later

to get this we need to save the data from Gas en KWH (1&2) every time the data is taken from the serial port and every time overwritten.

can you advise and comment
thanks in advance

@huib: You can use the gas value from the parent device and the kwh values from powermeter1 and powermeter2. You can read the values by using luup code:

local METER_DEV_ID = 139
local METER1_DEV_ID = 140
local METER2_DEV_ID = 141

local gas= luup.variable_get(“urn:brutgrink-com:serviceId:dutchSmartMeter”, “gas”, METER_DEV_ID )
local kwh1= luup.variable_get(“urn:micasaverde-com:serviceId:EnergyMetering1”, “kwh”, METER1_DEV_ID )
local kwh2= luup.variable_get(" urn:micasaverde-com:serviceId:EnergyMetering1 ", “kwh”, METER2_DEV_ID )

I don’t know how to get these values into a e-mail, because e-mail is something I don’t use from the Vera.

Why don’t you use the excelent dataMine plugin to collect all values? If you don’t have storage space you can setup a schedule to ftp the data files to another server.

Thanks,
Bernard

@bfromdruten:

i do not want to run a second server, cause i am dutch, and i have the vera already running 24/7

i will try to fit in your comment in the luup for the mail and will post it here

one observation i faced that for the cable from antratek is is required to teke the driver from the supplier and install manually during the installation proces, otherwise it will not work

@huib: you don’t need a second server for dataMine. Just a usb memorystick where logging is stored. Works perfect.

@bfromdruten;

i have on the verelite only one usb which is now used for the meterkast reading

at the moment i recieve the following email

== Meterstanden van Tue Jun 26 11:23:10 2012, gas = 0, kwh1 = 0, kwh2 = 0 ==

so i get no data from the meterkast

i took the id device from the powermeter (s) but it does not work
which id i have to take

rgds

== quote ==
local smtp = require(“socket.smtp”)

    local SMTP_SERVER = "xxx.xxx.xx"
    local SMTP_PORT = "25"
    local USER_SENDING = "<xxxx.xxx@xxxxx.xxx>"
    local USER_RECEIVING = "<xxxxxxxxx@xxxxx.xxl>"

    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 van " .. os.date("%c")
        },
        body = "Meterstanden van "  .. os.date("%c") .. ", gas = " .. gas .. ", kwh1 = " .. kwh1 .. ", kwh2 = " .. 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("Yikes " ..  e)
    end

Yes…found the issue. The capitals are not correct. The code should be:

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”

About dataMine…why don’t you use a USB hub?

@bfromdruten;

i got it now working

== result of out punt ==
Meterstanden van Tue Jun 26 13:54:04 2012, gas = 268.509, kwh1 = 416.009, kwh2 = 379.405
on weekly bases i enter the data in to ECOHOME and see the results

thanks for the assistance
about the datamine will be next puzzle

the luup is now as follows;

== quote ==
local smtp = require(“socket.smtp”)

    local SMTP_SERVER = "xxx.xxx.xxl"    -- < local server
    local SMTP_PORT = "25"
    local USER_SENDING = "<veralite@xxx.xxx>"  --< from 
    local USER_RECEIVING = "<xxx@xxxxxxl>"  -- < to 

    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 van " .. os.date("%c")
        },
        body = "Meterstanden van "  .. os.date("%c") .. ", gas = " .. gas .. ", kwh1 = " .. kwh1 .. ", kwh2 = " .. 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("Yikes " ..  e)
    end

@bfromdruten;
what i have to do to not show ''Powermeter ExportRate 1 & 2"

is it only modify the I_dutchSmartMeter and put –

        -- Create devices needed if not exist
        addPowerMeterDevice("ImportRate1")
        addPowerMeterDevice("ImportRate2")
     --   addPowerMeterDevice("ExportRate1")
     --   addPowerMeterDevice("ExportRate2")

or do i need todo more?

please advise

rgds
huib

@huib
Yes…you are correct.

In a few days I will add this functionality as device setting, so you can configure the device to have import and/or export meters. I’m also planning to add an average use to the gas meter value (instead of only the total meter value).

@bfromdruten Still very happy with you plugin for Dutch Smart meter. After some calling and mailing with my energyprovider I finally get the gasmeter values to my vera.
Next problem: How can i get this value displayed in SQ-remote. Sq-remote only seems to be able to display celsius, watts and kWh? Any idea of suggestion?

@cmbeek: I don’t own a sq-remote, so I really can’t help you on this one.

You can’t. SQRemote can only display a preset list of variable types. Custom plugin variables (as m^3 are) are unknown to SQRemote.

I recall that there was a request with Square Connect to allow users to ask for any custom variable to be displayed. As far as I know it hasn’t been implemented yet.

Hi All,

I am new at this forum and an living in the Netherlands.

I follow this the products of micasaverde now for few months and want to buy an Vera Lite solution for home automation.
One of the first thinks i going to do is to connect it with my dutch smart meter with p1 port and also for security and light switching, the house i’m going to use for it is build at this moment so i do not now yet which smart meter is placed.

Can someone place some screenshots of the graphs that er made with the vera lite. is it also possible to log longterm usage to get nice overview of usage in different periods.

Hopefully can someone place some screenshots of the log results, so i can decide if this is the solution i looking for to monitor and log gas and engergy usage.

Regards,

Alphaxe

Hi,

I am also considering building the cable and requesting a smart meter. In all fairness, it is cheaper and better than hooking up converters from the meters, or buying seperate meters.

The Vera Lite comes with a Ergy Energy plugin (ergyenergy.com) which can be hooked up to any device. I haven’t entered a “global” energy consumption meter yet, but the readback from my switches has proven much insight already. In Vera you can add a expected energy consumption for every switch, even if it doesn’t measure energy consumption. What I can read back from ergy is pretty valuable because it not only shows Watts, but also Watt-hours. I now see my big energy wasters.

The default account is Lite, with almost no data storage. There are bigger accounts, the one for $20 allows you to go back 13 months in history.

Jaap

@bfromdruten;

could a ask for a proposal which might be incorporated in your plug; to have an option to see the total consumption over the last 24 hrs and to see the consumption over the last periode of chosen time.

an idea could be that each hour at X.00 the value of low and high electricity and gas are stored in a file at location {x} and the consumption over the last hour / last 24 hours can be made visible
the same for the the data of midnight and begining of each month. the are stored in a other file, so the daily and monthly trend can be made visible
if the value’s are over write the old data the files wil not become very big.

please be so kind to have a look into it

rgds
huib

I have installed the plugin to read-out my smart meter and it works brilliantly.
Electrical in- and export as well as the gas consumption.
To calculate and log the daily consumption I have made a Scene that runs every day at 07:00 and make use of some VariableContainer plugin’s.
This date is in turn read by and stored in the DataMine plugin.
As I have no particular knowledge in Scene programming I have read the various solutions offered in this forum.
I think it is an appropriate moment to thank all persons offering their knowledge and time to come with these fantastic building blocks for everyone to develop his own home automation.

Jacob

@bfromdruten
Thanks for you’re app, it works perfect!
I have a solar request
In my Vera i see the actual PowerUsage (Watt) 1-0:1.7.0
If possible i would also like to see the value of 1-0:2.7.0 (solarpower to grid)
Maybe its an option that when the 1st is zero the displayed value changes to the power returned to the grid (with a - sign)
to show the actual return to the grid.
If you’re too busy maybe we can do it ourselves when you give us some instructions…
Many thanks!!!

@robvanbrunschot
I don’t have any solar panels, so I can’t test, but isn’t it possible to use and deliver electricity back at the same moment? If so, separate devices is an better option. I also rather not use the same variable for two things, because the datamine data collection would not see the difference.

Thanks

@bfromdruten: Let me rephrase my question: (very politely)
Can u help us to change you’re code that when the variable 1-0:1.7.0 is 0 (not using power from the grid) the variable displayed for actual Power usage will be the negative of 1-0:2.7.0 (being the power returned to the grid?). My goal is to display what my house Is using out of the grid, or feeding back into it. I understand this does not account for the total usage at that moment.

The other way would be to just add 1-0:2.7.0 to the variable list and then rewrite the way it is displayed (may be the easier way from a coding standpoint…

I hope u understand what I mean.
Where not to lazy to do it ourselves :slight_smile: we just don’t know how :slight_smile:
Thanks so much!