Scene Set/Reset

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
victoryred
Posts: 11
Joined: 17 Sep 2015 03:55

Scene Set/Reset

Post by victoryred » 02 Oct 2015 19:15

I'm using the logical rules app to control a particular scene. I'm using a different scene as a qualifier to test some binary switch state. During testing I found that the qualifying state was set a day ago and remains set. I may have overlooked it but I can't find how to reset the state of a scene. For example I may want a scene to be valid for only 2 hours. When I use the term reset I am not implying active/deactivate which I take to mean enable/disable or arm/disarm. The logic should work like a state machine where the output (valid/invalid) is a function of the current state and the state inputs (ie. binary switches).

By the way, this z-wave package is awesome and I have been able to do some amazing things with it. I want to thank you guys for your efforts. Very cool.

victoryred
Posts: 11
Joined: 17 Sep 2015 03:55

Re: Scene Set/Reset

Post by victoryred » 02 Oct 2015 19:23

I would like to follow up with a request for the Scheduled Scene or Scene function to include a means to turn off a scene in the UI.

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Scene Set/Reset

Post by pz1 » 02 Oct 2015 22:02

Have you looked into the Delayed Action app? Or RoundRobin scene

victoryred
Posts: 11
Joined: 17 Sep 2015 03:55

Re: Scene Set/Reset

Post by victoryred » 04 Oct 2015 21:55

In LightScene I found code that confirmed what I was seeing during testing-

this.vDev = this.controller.devices.create({
deviceId: "LightScene_" + this.id,
defaults: {
deviceType: "toggleButton",
metrics: {
level: 'on', // it is always on, but useful to allow bind
icon: '',
title: 'Light Scene ' + this.id
}
},

So a couple of things came to mind when I read this snippet of code.
1.) Scenes are deviceType: "toogleButton" the comment in the code says always 'on'. Hmmm...interesting
2.) which means I should be able to the "change:metrics:level" on/off as needed as I found in the LogicalRules code

LogicalRules.prototype.stop = function () {
var self = this;

if (this.config.eventSource) {
this.config.eventSource.forEach(function(scene) {
self.controller.devices.off(scene, "change:metrics:level", self._testRule);
});
}

Only problem is that the second snippet of code is in .prototype.stop and I may only want to change the level without stopping the devices in the scene.

Are there any side effects to the z-way core or something else by simply doing something equivalent to

self.controller.devices.off(scene, "change:metrics:level", "Off");

when the scene is no longer needed?

User avatar
PoltoS
Posts: 4989
Joined: 26 Jan 2011 19:36

Re: Scene Set/Reset

Post by PoltoS » 02 Nov 2015 03:27

the last argument here is the handler function. .off() is unsubscribing, not turning off

Post Reply