[v2.0.0] Solved - error creating own deivces

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

[v2.0.0] Solved - error creating own deivces

Post by billyboy »

When I add to create my own dummy devices to main.js I get the following error:
Type: core
Timestamp: 9/12/14-09:27
Message:
Can not create vDev based on 6-0-37: TypeError: Cannot read property 'data' of undefined

Code added:
vDev = controller.devices.get("DummyDevice_5");
vDev.on("change:metrics:level", function (vDev) {
var level = vDev.get("metrics:level");
setPortState(1, level);
});

When I look into the web UI the the deviceid= "DummyDevice_5"
What do I need to change?
Last edited by billyboy on 10 Dec 2014 09:53, edited 1 time in total.
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: [v2.0.0] error creating own deivces

Post by PoltoS »

I don't think these are related. The error is about some Z-Wave device, while the Dummy should work independently.

Some suggestions:
1) do not add things in main.js, use Load Custom Code module instead.
2) Are you sure DummyDevice_5 already exists when this line is executed? May be it will return null?
3) There is special module for your task: Code Device
billyboy
Posts: 61
Joined: 16 Mar 2013 21:33

Re: [v2.0.0] error creating own deivces

Post by billyboy »

Whow, yes I found it, that makes custimize things a lot easier!
Great release, Thanks a lot!
billyboy
Posts: 61
Joined: 16 Mar 2013 21:33

Re: [v2.0.0] error creating own deivces

Post by billyboy »

One small question, where should I put my custum functions? in main.js?
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: [v2.0.0] error creating own deivces

Post by PoltoS »

In Load Custom Code module. In 99.99999% cases you never need to alter Z-Way Home Automation JS code at all
billyboy
Posts: 61
Joined: 16 Mar 2013 21:33

Re: [v2.0.0] error creating own deivces

Post by billyboy »

Yes it worked! Thank you.
Post Reply