OK… Here goes
I have written a plugin (I think it qualifies) to the CBUS system from scratch. I recently purchased a house which has some Cbus stuff in it, and replacing all of it would be silly, so I just made it play nice with my VERA and other zwave modules.
WARNING: I knew very little about LUA code before writing this, and even less about writing vera plugins with LUUP and UPnP. I consier this still an Alpha in terms of other people using it. I have tested it for maybe a couple of hours all-together. If that’s not bad enough I knew nothing about CBUS/CGATE until 5 days ago…
I am 100% sure there are better cleaner ways to do many of the implementation I have done here, and I am quite open to input and code suggestions. As allways, take the code, and do your own thing if you please, but please give me some credit, and if it’s for the benefit of my code, please share
Summary:
This is a master child device, it will create and manage the children automatically
What it needs(prerequisites):
[ul][li]CBUS[/li]
[li]CGATE[/li][/ul]
Configuration:
All Set up via configuration->advanced variables:
[ul][li]IPaddr[/li]
[li]IPport (defaults to 20023)[/li]
[li]ApplicationNum (defaults to 56 for lighting)[/li]
[li]NetworkNum (defaults to 254)[/li]
[li]Project (defaults to HOME)[/li][/ul]
What it does:
[ul][li]Opens Socket Connection to CGATE and Set’s up Defined Project[/li]
[li]Calls the CGATE TREE Function to enumerate the Group and Unit List. Also figures out what type of devices they are DIMMER/RELAY for now.[/li]
[li]Set’s up the Cgate Events to Status changes, then we dont have to poll. [/li]
[li] Create Child devices for each Group created in the CBUS network[/li]
[li] You can control (ON, OFF, DIM) the devices like any other[/li][/ul]
What it doesn’t do:
[ul][li]Does not talk directly to RS232. Have not even investigate this, would be nice, then you could eliminate CGATE server, but then, will have to figure out the CBUS protocol, and won’t have the management of CGATE[/li]
[li]Does not cater for any other devices except Lighting Application at this time[/li][/ul]
TODO:
[ul][li]Initial Load of Devices does not reteive status initially, unless an event comes from CGATE… Need an hour or two to do this still[/li]
[li]More robust Error handling and recovery. I have got most rudimentary recovery for disconnects, power fails etc, but not nearly enough yet I think.[/li]
[li]Learn some more about plugin-ins. So that it conforms to all DO’s and DONT’s. I’m not sure if this plugin is written correctly, or stable.[/li]
[li]Wrap it all up nicely as a proper plugin with install[/li][/ul]
Have a go at it, and let me know how it goes…
PLEASE… give feedback.