Page 1 of 2

Systemmode change turns all lights on

Posted: Thu 18 Jul 2013, 08:24
by cyberde
Hi,

I've been working with systemmodes for a while now (away systemmode detection when leaving the house).
I have two systemmodes for now, Away and Default. The Default systemmode is set up as followed. Devices have a schedule which is set to always on if a datasource is set to On (wall switches), allowing the wall switchs to turn on/off the light like your normal average switch. In the Away systemmode most devices don't have a schedule resulting in turning off the lights and keep them off regardless the state of the datasources (switches).

When I change from Default to Away, lights that were on turn off (I have also written a plugin that turns the datasources to Off as well) and are unable to turn on again by the wall switches because of the lack of schedules. This works as expected.

Now when I change from Away to Default, the schedules are enabled again (while the datasources are still all set to Off). And somehow this results in turning on all devices (and I mean all devices with a schedule). When SK is done turning on all the devices (and the Telldus Duo is done sending the signals), it starts to turn off all of the devices again as I would expect in the beginning.

Now my question is, why is SK turning on all the devices while there's no reason it should do that because all the datasources (which the schedules depend on) are still set to Off?

Cheers :)

Re: Systemmode change turns all lights on

Posted: Thu 18 Jul 2013, 18:37
by Martin
Do you happen to have any events connected to the schedules where the events are marked as "forced"?

Re: Systemmode change turns all lights on

Posted: Thu 18 Jul 2013, 18:57
by cyberde
Hi Martin,

No, none of the events are set to Forced. I can send you more information if you want?

Cheers

Re: Systemmode change turns all lights on

Posted: Thu 18 Jul 2013, 19:19
by Martin
If you can send your db by pm or by email, that would be great.

Re: Systemmode change turns all lights on

Posted: Thu 18 Jul 2013, 20:26
by cyberde
I've sent you the DB by PM :) Thanks!

Re: Systemmode change turns all lights on

Posted: Sun 21 Jul 2013, 19:32
by cyberde
Did you find anything? Also, on another question, I'm receiving a TurnOff from A1 | Code switch every 30 seconds, but I can't find out what it is. I'm suspecting a wireless temperature meter outside since I was receiving weird temperature readings but after I flashed the Telldus duo to firmware 10 I started receiving A1 | Code switch messages.

Re: Systemmode change turns all lights on

Posted: Mon 22 Jul 2013, 21:48
by Martin
Sorry.
I have not yet had the time to look at this.

The A1 problem is nothing we've heard about, but it does not sound that it is Switch King related. Best guess is either interference or misinterpretation of signals by the Duo.

Re: Systemmode change turns all lights on

Posted: Tue 23 Jul 2013, 07:04
by cyberde
Okay thanks! I'll be waiting ;)

I figured it was also a Duo issue, I will start by disabling the temperature sensor and see if the A1 events disappear.

Re: Systemmode change turns all lights on

Posted: Tue 23 Jul 2013, 10:44
by Martin
How to solve
Create an empty schedule with a single "Off" for the devices affected and define that the new schedule is valid only in the Away mode. This will give Switch King a timeline and get around the "fallback issue" mentioned below.

Technical info, feel free to skip ;)
The reason why your lights turns on when switching from Away to Default is due the design of Switch King - that it is based on timelines - i.e. a number of "On" and "Off" events build an internal timeline of events inside the server.
For devices that are connected to schedules, Switch King builds this internal timeline from time to time. When schedule mode is switched, Switch King traverses the timeline to find the expected state of the device.

When you have your schedule mode "Away" active, most of the devices you have does not have a schedule defined for that mode (while they have schedules defined for Default and Night modes).
Due to this, Switch King does not find a timeline for the devices and need to use a fallback procedure to calculate the expected state. In this specific situation, the fallback calculation "thinks" that the devices should be "On" (which is actually wrong).

When schedule mode has been switched, the timeline is being created internally and Switch King then corrects the previous error due to that a timeline is possible to create in the Default mode.

Re: Systemmode change turns all lights on

Posted: Tue 23 Jul 2013, 11:46
by cyberde
Martin,

Thank you very much for the explanation, makes sense now why the lights are being turned on. I will create an Off schedule for all of the devices that don't have one and have a look if this fixes it.

Cheers!

[EDIT]
Worked! :)