[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: 53
Joined: 13 May 2016 11:10

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

Post by kandalf » 25 Jun 2016 13:33

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: 5
Joined: 04 May 2016 19:11

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

Post by nievox » 14 Jul 2016 13:09

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 » 14 Jul 2016 13:27

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: 5
Joined: 04 May 2016 19:11

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

Post by nievox » 14 Jul 2016 13:43

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: 5
Joined: 04 May 2016 19:11

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

Post by nievox » 19 Jul 2016 09:31

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: 5
Joined: 04 May 2016 19:11

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

Post by nievox » 20 Jul 2016 20:20

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 » 04 Feb 2017 15:18

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

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests