Page 1 of 1

[v2.0.0] Solved - error creating own deivces

Posted: 09 Dec 2014 11:39
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?

Re: [v2.0.0] error creating own deivces

Posted: 09 Dec 2014 12:05
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

Re: [v2.0.0] error creating own deivces

Posted: 09 Dec 2014 12:26
by billyboy
Whow, yes I found it, that makes custimize things a lot easier!
Great release, Thanks a lot!

Re: [v2.0.0] error creating own deivces

Posted: 09 Dec 2014 12:29
by billyboy
One small question, where should I put my custum functions? in main.js?

Re: [v2.0.0] error creating own deivces

Posted: 10 Dec 2014 02:28
by PoltoS
In Load Custom Code module. In 99.99999% cases you never need to alter Z-Way Home Automation JS code at all

Re: [v2.0.0] error creating own deivces

Posted: 10 Dec 2014 09:53
by billyboy
Yes it worked! Thank you.