misko903 wrote: Monday 22 October 2018 5:01
Perfect

I will test it from the work. To change it to Monday till Friday (work days) should be a piece of cake also for me

("at 05:40 on mon,tue,wed,thu,fri")
That should work
There is "prediction: cloudy" part missing. How should the code part for it looks like?
there seem to be an inconsistency in domoticz wrt the to the behavior of this value.
For now I added the function fromBarometerForecastInfo to ensure a correct prediction string. (see new code)
How to send the messages to the specific user?
This is out of control for dzVents. In the script you can choose to which notification systems you want to send the information but you have to define in domoticz notification setup page who the addressee will be.
Code: Select all
return {
on = { timer = { "at 09:07"}},
execute = function(dz)
local myDevice = dz.devices(1103) -- change this to the ID of your device or the name in quotes
local toLog = true -- switch between true/false when you want/don't want an entry in logfile
local email = false -- switch between true/false when you want/don't want to be Emailed
local notify = true -- switch between true/false when you want/don't want a notification
local myNotificationTable = {dz.NSS_GOOGLE_CLOUD_MESSAGING, dz.NSS_PUSHOVER} -- table with one or more notification system. Can be one or more of
-- dz.NSS_GOOGLE_CLOUD_MESSAGING,
-- dz.NSS_HTTP,
-- dz.NSS_KODI,
-- dz.NSS_LOGITECH_MEDIASERVER,
-- dz.NSS_NMA,
-- dz.NSS_PROWL,
-- dz.NSS_PUSHALOT,
-- dz.NSS_PUSHBULLET,
-- dz.NSS_PUSHOVER,
-- dz.NSS_PUSHSAFER
local function fromBarometerForecastInfo(pressure) -- Return text
if pressure == nil then return nil -- Should not happen
elseif pressure < 966 then return "Thunderstorm"
elseif pressure < 993 then return "Cloudy / Rain"
elseif pressure < 1007 then return "Cloudy"
elseif pressure < 1013 then return "Unstable"
elseif pressure < 1033 then return "Stable"
end
return "Sunny"
end
local degree = '°'
local notifyString = "Today it will be " .. fromBarometerForecastInfo(myDevice.barometer) ..
" (" .. myDevice.barometer .." hPa). The expected temperature will be " ..
dz.utils.round(myDevice.temperature,1) .. degree .. " and the humidity will feel as " .. myDevice.humidityStatus
if toLog then dz.log(notifyString:gsub(degree," degrees"),dz.LOG_INFO) end
if email then dz.email("Weather forecast",notifyString,"[email protected]") end
if notify then dz.notify("Weather forecast", notifyString, dz.PRIORITY_NORMAL,dz.SOUND_DEFAULT, "" , myNotificationTable ) end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>>
dzVents wiki