graph by mail

Moderator: leecollings

Post Reply
flyertoon
Posts: 3
Joined: Thursday 16 May 2019 9:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

graph by mail

Post by flyertoon »

Hello,

I would like to receive this by mail. Can you help me? Thanks!!!

see attached file: temp graph
Attachments
chart (1).jpeg
chart (1).jpeg (51.75 KiB) Viewed 1427 times
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: graph by mail

Post by emme »

print it as PDF or save it as image and attach it into an email ;)
The most dangerous phrase in any language is:
"We always done this way"
flyertoon
Posts: 3
Joined: Thursday 16 May 2019 9:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: graph by mail

Post by flyertoon »

Hello, thanks

My question was not clear. I would like to receive this graphic every day in my mailbox. Automatically, by script I think
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: graph by mail

Post by waaren »

flyertoon wrote: Thursday 16 May 2019 20:23 My question was not clear. I would like to receive this graphic every day in my mailbox. Automatically, by script I think
I don't think it's possible to get it as a graphic. Closest you can get is get the underlying data.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
flyertoon
Posts: 3
Joined: Thursday 16 May 2019 9:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: graph by mail

Post by flyertoon »

... how can i get underlying data please ? or where are stored the log ?

thanks
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: graph by mail

Post by waaren »

flyertoon wrote: Friday 17 May 2019 13:07 ... how can i get underlying data please ? or where are stored the log ?
A dzVents script to do this could look like the one in the code window below.

When not yet familiar with dzVents please start with reading Get started Before implementing. Special attention please for
"In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents disabled' is not checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."



Code: Select all

local scriptVar = "mailTemplog"

return  {
            on = { timer = { "every 5 minutes" },
                   httpResponses = { scriptVar .. "*" },
        },

        logging =   {   level   =   domoticz.LOG_DEBUG,    -- change to LOG_ERROR when script executes OK
                        marker  =   scriptVar},

    execute = function(dz, item)
        local temperatureSensor = 842                       -- idx or "name" of your tempSensor
        local emailAddress = '[email protected]'        -- Your Email address
        
        local function resultTable2String(t)
           str = ""
           for _, record in ipairs(t.result) do
                str = str .. record.d .. "," .. record.te .. "\\n" -- convert table to comma / LF separated
            end
            return str
        end

        local function getTempLog(idx)
            url = dz.settings['Domoticz url'] .. "/json.htm?type=graph&sensor=temp&range=day&idx=" ..  idx
            dz.openURL({    url = url,
                            method = "GET",
                            callback = scriptVar .. "_graph"}) -- collect graph data from domoticz
        end

        if item.isTimer or item.isDevice then
            getTempLog(temperatureSensor)            -- Call domoticz API
        else
            dz.email('Temperature log from device ' .. dz.devices(temperatureSensor).name, resultTable2String(item.json) , emailAddress )
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest