Ignoring\Dealing with On On Topic is solved

Moderator: leecollings

Post Reply
jimtrout87
Posts: 16
Joined: Tuesday 12 April 2016 17:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Ignoring\Dealing with On On

Post by jimtrout87 »

Hello,

Can anyone help, i have some lights come one automatically when one of us gets home. Which works fine, the problem i have is that when i put my phone on charge at night it kicks back in location settings and then re-triggers my geogfence, therefore turning on lights. They do go off after a few mins, its just a bit annoying.

Because its multiple people i cant use add a variable for my phone as that would stop it working for others on occasion, I did wonder about lastupdate+1 or something but not sure if there is a syntax for this?

Code: Select all

if (otherdevices['Sunset'] == 'On' and otherdevices['Hallway Lights'] == 'Off' and (devicechanged['Jims Home'] == 'On' or devicechanged['Kaths Home'] == 'On')) then
	print("Coming Home, Setting Hallway lights to 85%")
--	commandArray['Porch Light']='On'
	commandArray['Hallway Lights']='Set Level 85'
	commandArray['Variable:Hallway_Lights'] = '2'
elseif (uservariables["Hallway_Lights"] == 2 and timedifference(otherdevices_lastupdate['Jims Home']) > 180 and timedifference(otherdevices_lastupdate['Kaths Home']) > 180  and otherdevices['Hallway Lights'] ~= 'Off') then
	commandArray['Variable:Hallway_Lights'] = '1'

end

return commandArray
Ittiz
Posts: 48
Joined: Tuesday 03 January 2017 0:37
Target OS: Linux
Domoticz version: 13939
Location: USA
Contact:

Re: Ignoring\Dealing with On On

Post by Ittiz »

Hmm hard to see a good way to fix it with the code you posted. I would think it would need to be done in the code that figures out your home. If it was able to see that your last location is home for instance it ignores it if it says you're home again.

I had a similar problem with a door lock that occasionally would send extra notifications to the controller like and extra "door unlocked" right after it said the door was unlocked a few seconds earlier. How I got around this is when it got the door locked or unlocked message it would check out how long ago the device last changed and if it was less than 60 seconds before it would check the old status against the new one. If the two statuses were the same it would throw away the second status message. The reason why I only did this is it was less then 60 seconds is because some times the lock's status could change and the message never got back to the controller for some reason. So that would appear as two ons or two offs in a row, but usually minutes to hours apart. Different device I know but hopefully that gives you some ideas for you own code.
pvm
Posts: 550
Joined: Tuesday 17 June 2014 22:14
Target OS: NAS (Synology & others)
Domoticz version: 4.10538
Location: NL
Contact:

Re: Ignoring\Dealing with On On

Post by pvm »

I was thinking of a similar solution. Probably the geofence sets a virtual switch?
You can add an extra (hidden?) virtual switch which is controlled by your geofencing and use blockly to check current state of "Jim's Home" and when status has changed change the actual "Jim's home" switch, when extra virtual switch is identical to "Jim's home" then do nothing.
Synology NAS, slave PI3, ZWave (Fibaro), Xiaomi zigbee devices, BTLE plant sensor, DzVents, Dashticz on tablet, Logitech Media Server
sion
Posts: 113
Joined: Friday 08 January 2016 12:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ignoring\Dealing with On On

Post by sion »

Don't know if it helps;
I use a " some one is home" switch. This is the switch that triggers the arriving home scene. And also the leaving home scene - so last one out.

So
if me= on and someonehome = off.
Set some one home on.

If wife = on and some one home = on.
Set someonehome = on.

If me= off and wife= off
Set someonehome = off.

This would help the double on, as someone home would already be on.
running domoticz 3.4834 on rpi2, with
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.

Next: harmony hub.
markjgabb
Posts: 142
Joined: Tuesday 24 January 2017 23:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Australia
Contact:

Re: Ignoring\Dealing with On On

Post by markjgabb »

this is very similar to mine
occupied event.PNG
occupied event.PNG (33.43 KiB) Viewed 1479 times
V 2020.2 RPI 3
RFlink 334 mhz
mysensors
broadlink
Mirabella Genio Globes
jimtrout87
Posts: 16
Joined: Tuesday 12 April 2016 17:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ignoring\Dealing with On On

Post by jimtrout87 »

Thanks all for your assitance and pvm i think thats the solution, yes my curreny dummy is linked to geofence.

As for the other replies i do already have a someone home in place but i dont use it as i want the lights to come on at night when either us come home. The other person may already be home in bed or the back room so someone home is already on. I will make this smarter though and put a if someone home == off like you suggest though as that makes sense :)
jimtrout87
Posts: 16
Joined: Tuesday 12 April 2016 17:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ignoring\Dealing with On On

Post by jimtrout87 »

Quick Update on this. All working now using a seperate "Jims Home - Hidden" which is updated by "Jims Home"

One thing to note is that you cant seem to reference a hidden switch for Geofence. If its hidden you cannot select it and if you select it and then hide it it doesnt work. I kept it as "Jims Home" and changed the lua to look at the hidden switch.
zicht
Posts: 272
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: Ignoring\Dealing with On On

Post by zicht »

just another approach on this.

I have tasker installed on the phones, and on wifi connection home detected it sets a user var for the device (together with geofence) via http get in domoticz. As long as the var is set no change by scipts allowed the the master home/away switch.
That way your double safe as 2 conditions have to be met (--> had issues with GpS being turned off by battery saving on phone and geofences not being switched.)

Later i extended this a bit using also car bluetooth near to detect if in the car (using same vars) --> so we now know when the phone "on the road " avoiding messaging while driving but knowing they are actually on the way home :) so dinner can be cooked.
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest