Creating virtual devices in new automation

Discussions about RaZberry - Z-Wave board for Raspberry computer
billyboy
Posts: 61
Joined: 16 Mar 2013 21:33

Creating virtual devices in new automation

Post by billyboy »

Hi all,

I have a problem with the new automation.
I have a shiftregister hoocked up to my Raspberry which drive 8 relais.
by sending "python port.py init" does a init of the shiftregister
"python port.py set 1 1" set port 1 to 1
"python port.py get 1" returns 0 or 1 depending on the state of the port

I added to main.js:
try {
system("python /opt/z-way-server/automation/port.py init");
} catch(err) {
debugPrint("Failed to execute script system call: " + err);
}
This works! So I can control the shift register from the javascript code.


Now I am trying to add 8 virtual devices and bind them to execute the script without succes, like in viewtopic.php?f=3422&t=20282

on change the script should be called like this: system("python /opt/z-way-server/automation/port.py set", port, newState);

Who can help me?
Last edited by billyboy on 10 Apr 2014 17:57, edited 1 time in total.
billyboy
Posts: 61
Joined: 16 Mar 2013 21:33

Re: problems with new automation

Post by billyboy »

IS there nobody who can/will help me?
StatikPulse
Posts: 14
Joined: 06 Mar 2014 22:14

Re: problems with new automation

Post by StatikPulse »

Could you post your whole code? I'm new to this and also playing with triggering events, but I'll help out if I can.
billyboy
Posts: 61
Joined: 16 Mar 2013 21:33

Re: problems with new automation

Post by billyboy »

Please help me getting started.

There is not much code I added to z-wave.
in /opt/z-way-server/automation/main.js

I added:

DemoDevice = function (id, controller) {
DemoDevice.super_.call(this, id, controller);

this.deviceType = "switchBinary"; // switchBinary, switchMultilevel, probe, sensor, ...

}

inherits(SimpleSceneDevice, VirtualDevice);

DemoDevice.prototype.deviceTitle = function () {
return "myTitle"
}

DemoDevice.prototype.performCommand = function (command) {
var handled = true;

//...
return handled ? true : DemoDevice.super_.prototype.performCommand.call(this, command);
}
billyboy
Posts: 61
Joined: 16 Mar 2013 21:33

Re: problems with new automation

Post by billyboy »

Is there realy nobody who can help me?
User avatar
PoltoS
Posts: 7571
Joined: 26 Jan 2011 19:36

Re: Creating virtual devices in new automation

Post by PoltoS »

So, whats' wrong with the Demo code you used? It should work. Except for missing performCommand handler.

We are doing final polishing of vDevs - now it will be easy for you to register new switchBinary vDev. Please wait a bit.
billyboy
Posts: 61
Joined: 16 Mar 2013 21:33

Re: Creating virtual devices in new automation

Post by billyboy »

Hi,

PoltoS, any idea how long I have to wait?
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Creating virtual devices in new automation

Post by pz1 »

On past experience, do not expect anything complete, reliable and sufficiently well documented before the fall of this year.
Since 29-12-2016 I am no longer a moderator for this forum
OnnoH
Posts: 4
Joined: 02 Jul 2013 08:51

Re: Creating virtual devices in new automation

Post by OnnoH »

pz1 wrote:On past experience, do not expect anything complete, reliable and sufficiently well documented before the fall of this year.
That's too bad.

I'm following this forum quite regularly in anticipation of the new version to sink my teeth in. But nothing definitive on the horizon yet. I've read 'soon' somewhere, but that's in the eye of the beholder I guess.

Maybe I have a Razberry for sale pretty soon. Any takers?
User avatar
PoltoS
Posts: 7571
Joined: 26 Jan 2011 19:36

Re: Creating virtual devices in new automation

Post by PoltoS »

We have updated on git the new UI. Now it is easy to do what you want. Follow the forum desciption of the new UI to see changes.

You will need to get new code from github (also documented how to do)
Post Reply