notification to defrost car window

Moderator: leecollings

Post Reply
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

notification to defrost car window

Post 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?
DutchHans
Posts: 230
Joined: Friday 03 April 2015 20:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany (near dutch border)
Contact:

Re: notification to defrost car window

Post 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
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Re: notification to defrost car window

Post by astrapowerrr »

Hi hans,

But when I freezes all night you get every hour a notification?
DutchHans
Posts: 230
Joined: Friday 03 April 2015 20:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany (near dutch border)
Contact:

Re: notification to defrost car window

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest