Newbie help Just send temperature to prowl or email every morning 06:00

Easy to use, 100% Lua-based event scripting framework.
Post Reply
rich710
Posts: 17
Joined: Sunday 18 September 2016 11:10
Target OS: Raspberry Pi
Domoticz version:
Contact:

Newbie help Just send temperature to prowl or email every morning 06:00

Post by rich710 » Monday 05 February 2018 15:26

Hello!
Trying to make some simple script to just send the value of one of tempsensors to Prowl or email at 06:00. But I'm stuck
Do I have to have some if-condition?
Thankful for help

Code: Select all

return {
    on = {
        timer = { at '14:12' },
        }
    },
    execute = function(domoticz)
        domoticz.notify('Dagens Utetemperatur!', 'Current value is ' .. 'Utetemp01'.temperature, domoticz.PRIORITY_NORMAL)
        end
    end
}

CaesarPL
Posts: 120
Joined: Tuesday 08 November 2016 15:03
Target OS: Raspberry Pi
Domoticz version:
Location: Poland
Contact:

Re: Newbie help Just send temperature to prowl or email every morning 06:00

Post by CaesarPL » Monday 05 February 2018 15:49

This one works for me:

Code: Select all

return {
    on = {
        ['timer'] = {
                'at sunrise'
           }
    },
    execute = function(domoticz,triggerInfo)

        if (domoticz.devices('Temp outside').temperature < 0)  then
            domoticz.email('Cold!', 'Be careful!', 'email@gmail.com')
        end

    end
}
HW:Raspberry PiB+,Pi3,PiB,RFLink,FA20RF,DCS-930L,DCS-935L,Clarus switches,RF Temp sensors,Owl Micro+,Mi Flora,Kerui,Yeelight,Xiaomi,Broadlink RMM3,Alexa
SF:Jessie,Dmtcz 3.8153,Logitech Media srv,PiCorePlayers,Dashticz,Max2Play,InfluxDB,Grafana,HABridge

rich710
Posts: 17
Joined: Sunday 18 September 2016 11:10
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Newbie help Just send temperature to prowl or email every morning 06:00

Post by rich710 » Monday 05 February 2018 22:01

Yes, thank you, but I want to be told "what" temperature it is 6 o clock with a notice on my phone.
I think your script just tell you IF it's below 0? Or am I wrong?

elmortero
Posts: 193
Joined: Sunday 29 November 2015 21:46
Target OS: Raspberry Pi
Domoticz version: 3.9639
Location: Spain
Contact:

Re: Newbie help Just send temperature to prowl or email every morning 06:00

Post by elmortero » Monday 05 February 2018 23:57

Assuming that Utetemp01 is the exact name of your outside temperature sensor this should work:

Code: Select all

return {
    on = {
        timer = { 'at 6:00' }
    },
    execute = function(domoticz)
	local Ute = round(domoticz.devices('Utetemp01').temperature, 1)
        domoticz.notify('Dagens Utetemperatur!', 'Current value is ' ..Ute, domoticz.PRIORITY_NORMAL)
        end
}

rich710
Posts: 17
Joined: Sunday 18 September 2016 11:10
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Newbie help Just send temperature to prowl or email every morning 06:00

Post by rich710 » Tuesday 06 February 2018 11:16

Perfect! Thank you! But I couldn't get the round-util to work, got this error in the log.
But if i remove round and the 1 for decimals it worked, but I got like 6 decimals in the notice.. but no big deal...
Thanks for your effort!

2018-02-06 10:12:00.298 dzVents: Info: ------ Start internal script: Utetemp:, trigger: at 10:12
2018-02-06 10:12:00.299 dzVents: Error (2.4.1): An error occured when calling event handler Utetemp
2018-02-06 10:12:00.299 dzVents: Error (2.4.1): ...i/domoticz/scripts/dzVents/generated_scripts/Utetemp.lua:6: attempt to call global 'round' (a nil value)
2018-02-06 10:12:00.299 dzVents: Info: ------ Finished Utetemp

welby
Posts: 30
Joined: Monday 20 November 2017 4:24
Target OS: Raspberry Pi
Domoticz version:
Location: Australia
Contact:

Re: Newbie help Just send temperature to prowl or email every morning 06:00

Post by welby » Tuesday 06 February 2018 11:46

This rounding works for me.

Code: Select all

(domoticz.round(myTemp,1)

rich710
Posts: 17
Joined: Sunday 18 September 2016 11:10
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Newbie help Just send temperature to prowl or email every morning 06:00

Post by rich710 » Tuesday 06 February 2018 11:54

Perfect! Now it worked! But for info I got this message in the log.. And I learned some new things, thank you everybody.

2018-02-06 10:51:00.287 dzVents: Info: domoticz.round deprecated. Please use domoticz.utils.round.
2018-02-06 10:51:00.287 dzVents: Info: ------ Finished Utetem

rich710
Posts: 17
Joined: Sunday 18 September 2016 11:10
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Newbie help Just send temperature to prowl or email every morning 06:00

Post by rich710 » Tuesday 06 February 2018 11:56

Here is "my" ;) working script for getting notified daily temp at 06:00 from my temp sensor. With 1 decimal.

Code: Select all

return {
    on = {
        timer = { 'at 06:00' }
    },
    execute = function(domoticz)
	local Ute = domoticz.utils.round(domoticz.devices('Utetemp01').temperature, 1)
        domoticz.notify('Dagens Utetemperatur!', 'Current value is ' ..Ute, domoticz.PRIORITY_NORMAL)
    end
}

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest