Page 1 of 1

notification to defrost car window

Posted: Friday 15 December 2017 15:04
by astrapowerrr
hi there

can someone give me some hint or already don this??
i would like to get a notification on my phone in the morning(for example 7 o clock) when is has frozen the night before.
so i would like to trigger outside temperatuur longer then for example 2 hours frost and not only at only 7 o clock...

coluld someone help me with this?

Re: notification to defrost car window

Posted: Friday 15 December 2017 15:39
by DutchHans
Hi, I've done a similar thing:

Code: Select all

commandArray = {} 

 sMinusZeroTemp = otherdevices_svalues['Temperature Outside']:match("([^;]+)")
 sMinusZeroTemp = tonumber(sMinusZeroTemp)

MinusZeroAlarmText = "It is " .. sMinusZeroTemp .. " degrees, Dress warm if you have to go outside, and be careful."
MinusZeroAlarmURLtext = string.gsub( MinusZeroAlarmText, " ", "%%20")

local m = os.date('%M')
  if (m % 60 == 0) then

 if(tonumber(sMinusZeroTemp) <  0.0 ) then
    os.execute("curl --connect-timeout 5 -s 'https://autoremotejoaomgcd.appspot.com/sendnotification?key=&title=Message%20of%20the%20house&text="..MinusZeroAlarmURLtext.."&url=http://xxxxxxxxxx.myfritz.net:2211/&icon=http://www.xxxxxxxxx.nl/domoticz_logo.png'&")
	
  end
end
return commandArray
It checks the outside temperature every hour and notifies me when its below zero. My notification is done by Autoremote.

Hope this helps
Cheers, Hans

Re: notification to defrost car window

Posted: Friday 15 December 2017 17:40
by astrapowerrr
Hi hans,

But when I freezes all night you get every hour a notification?

Re: notification to defrost car window

Posted: Friday 15 December 2017 17:53
by DutchHans
Add a few lines of code to use this function.
I believe that Jos gets all the credits for the function.

Code: Select all

function timebetween(s,e)
   timenow = os.date("*t")
   year = timenow.year
   month = timenow.month
   day = timenow.day
   s = s .. ":00"  -- add seconds in case only hh:mm is supplied
   e = e .. ":00"
   shour = string.sub(s, 1, 2)
   sminutes = string.sub(s, 4, 5)
   sseconds = string.sub(s, 7, 8)
   ehour = string.sub(e, 1, 2)
   eminutes = string.sub(e, 4, 5)
   eseconds = string.sub(e, 7, 8)
   t1 = os.time()
   t2 = os.time{year=year, month=month, day=day, hour=shour, min=sminutes, sec=sseconds}
   t3 = os.time{year=year, month=month, day=day, hour=ehour, min=eminutes, sec=eseconds}
   sdifference = os.difftime (t1, t2)
   edifference = os.difftime (t1, t3)
   isbetween = false
   if sdifference >= 0 and edifference <= 0 then
      isbetween = true
   end
--~    print(" s:" .. s  .. "  e:" .. e .. "  sdifference:" .. sdifference.. "  edifference:" .. edifference)
   return isbetween
end
If timebetween("06:00:00","08:00:00") then
Cheers,Hans