[userModule] Condition Switch (Updated 2017/02/02)

Tips, Tricks and Scripts to enhance your home automation and workaround known device bugs, limitations and incompatibilities
kandalf
Posts: 54
Joined: 13 May 2016 11:10

Re: [userModule] Condition Switch (Updated 2016/06/01)

Post by kandalf »

Hello, sorry but i read some Dokumentation but find no answer why it doesn't work as i want. After all i install a complete new system reset all devices and start at point zero. And now? It works as i want. Logical rules work perfect with altitude and all other stuff also.
So i don't know what was the bug for all the problems but at this Moment it is running.
Raspberry PI with Z-Wave.me Board
2 x Fibaro Double Relay-Switch FGS 222
2 x Fibaro Shutter FGR 222
Fibaro Multi Sensor
Z-Wave.me RemoteControl
nievox
Posts: 6
Joined: 04 May 2016 19:11

Re: [userModule] Condition Switch (Updated 2016/06/01)

Post by nievox »

Hi Maros,
congratulation for your app. i would like to use this app to scheduling start and stop on water pumps.
I have some problems, i have set condition as time, select all days of week, set hours, define switch as type device and set my binary switch. Probably i'm making a mistake because my device don't start. Can you help me? This same rules without device (with your automated virtual device) switch on and off perfectly.

Code: Select all

[2016-07-14 11:59:04.705] [D] [zway] Delivered to Z-Wave stack
[2016-07-14 11:59:05.262] [I] [core] --- Stopping module Condition Switch
[2016-07-14 11:59:05.266] [I] [core] Deleting device sensorBinary ConditionSwitch_26
[2016-07-14 11:59:05.311] [I] [core] --- Starting module Condition Switch
[2016-07-14 11:59:05.355] [I] [core] Creating device sensorBinary ConditionSwitch_26

Code: Select all

[2016-07-14 11:59:17.434] [I] [core] [ConditionSwitch-26] Calculating switch condition
maros
Posts: 103
Joined: 05 Apr 2014 11:21

Re: [userModule] Condition Switch (Updated 2016/06/01)

Post by maros »

Please send me the full configuration you are using. You can obtain the config by calling http://YOURZWAYHOST/ZAutomation/api/v1/ ... URMODULEID
Z-Way 2.2.4 on Raspi B | My Zway GitHub repos | Amazon Wishlist to support module development
nievox
Posts: 6
Joined: 04 May 2016 19:11

Re: [userModule] Condition Switch (Updated 2016/06/01)

Post by nievox »

Thanks a lot, json object:

Code: Select all

{

    "data": [
        {
            "instanceId": "0",
            "moduleId": "ConditionSwitch",
            "active": "true",
            "title": "Condition Switch",
            "params": {
                "switches": [
                    {
                        "type": "switchBinary",
                        "switchBinary": {
                            "device": "ZWayVDev_zway_25-0-37",
                            "status": "on"
                        }
                    }
                ],
                "condition": {
                    "type": "time",
                    "time": [
                        {
                            "dayofweek": [
                                "0",
                                "1",
                                "2",
                                "3",
                                "4",
                                "5",
                                "6"
                            ],
                            "timeFrom": "12:15",
                            "timeTo": "12:23"
                        }
                    ]
                }
            },
            "id": 26,
            "creationTime": 1468420838,
            "state": null,
            "module": "Condition Switch"
        }
    ],
    "code": 200,
    "message": "200 OK",
    "error": null

}
nievox
Posts: 6
Joined: 04 May 2016 19:11

Re: [userModule] Condition Switch (Updated 2016/06/01)

Post by nievox »

I suppose some problem on ZWay Cron System. Do you know some but about this? You can See ConditionSwitch Cron Log, weekDay array is empty. Why?

Code: Select all

[2016-07-19 09:25:06.081] [I] [core] Demotic Cron:ConditionSwitch.check.26;{"minute":[38],"hour":[9],"day":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"weekDay":[],"month":[0,1,2,3,4,5,6,7,8,9,10,11]}
[2016-07-19 09:25:06.082] [I] [core] Demotic Cron:ConditionSwitch.check.26;{"minute":[35],"hour":[22],"day":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"weekDay":[],"month":[0,1,2,3,4,5,6,7,8,9,10,11]}
And the difference with Presence

Code: Select all

[2016-07-19 09:24:39.148] [I] [core] Demotic Cron:Presence.nightStart;{"minute":[0],"hour":[20],"day":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"weekDay":[0,1,2,3,4,5,6],"month":[0,1,2,3,4,5,6,7,8,9,10,11]}
[2016-07-19 09:24:39.149] [I] [core] [Presence-25] Switch nightEnd at 5:0
[2016-07-19 09:24:39.150] [I] [core] Demotic Cron:Presence.nightEnd;{"minute":[0],"hour":[5],"day":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],"weekDay":[0,1,2,3,4,5,6],"month":[0,1,2,3,4,5,6,7,8,9,10,11]}
nievox
Posts: 6
Joined: 04 May 2016 19:11

Re: [userModule] Condition Switch (Updated 2016/06/01)

Post by nievox »

I fixed bug: cron.addTask, in weekDay dictionary voice, accept only integer or null or array formatted like [start,stop,step] (see manual for further information). So i fixed in this way:

Code: Select all

                        var wds = time.dayofweek.map(function (x){return parseInt(x);} );

                        console.log("[ConditionSwitch] Length: " + wds.length + " - Array: " + wds);

                        if (wds.length == 7) {
                            wds = [null]; // same as all - hack to add single cron record. NB! changes type of wd elements from integer to null
                        }

                        _.each(wds,function(wd){
                            console.log("[ConditionSwitch] wd: " + wds);
                            self.controller.emit("cron.addTask",self.cronName, {
                                minute:     date.getMinutes(),
                                hour:       date.getHours(),
                                weekDay:    wd,
                                day:        null,
                                month:      null,
                            });
                        });

For each day of week you have to create a new cron rule.
maros
Posts: 103
Joined: 05 Apr 2014 11:21

Re: [userModule] Condition Switch (Updated 2017/02/02)

Post by maros »

The latest version of this module (1.11) also has support for date conditions. Also support for two new actions was added: Thermostats (set to a given setpoint if the condition is met, otherwise set back to the original value) as well as Events which can be processed by the EventWatcher module.
Z-Way 2.2.4 on Raspi B | My Zway GitHub repos | Amazon Wishlist to support module development
froggy
Posts: 10
Joined: 02 Jan 2019 22:36

Re: [userModule] Condition Switch (Updated 2017/02/02)

Post by froggy »

Hi,
I have an issue using this module. I've set a rule for garden lights. I wanted to be able to switch them also manually so I created a virtual switch for them. The rule is: Virtual switch on OR ( solar attitude < 5 AND time between 12pm and 0:00).
This works fine overall, but when the lights are in off condition they blink for a fraction of second every minute. What could be the cause?
Post Reply