How to update Domoticz switches from new hardware and vice versa
Posted: Saturday 19 November 2016 1:02
Hello,
As I explained some days ago, I started to implement a new hardware plugin for an old home automation system which I can communicate through USB/Serial/RS485.
After reading, coding, debugging, I can say that I can understand a bit the Domoticz architecture but I need your help.
At this moment I achieved:
In Domoticz FrontEnd, after following this guide (https://www.domoticz.com/wiki/Developin ... are_plugin) I can see the new hardware in the setup part, I can add it and configure to use the COM port, where I have a USBtoRS485 converter, and I can receive the data from the hardware. I can interpret the messages coming from the hard, in that case I can see the "INPUTS" and the "OUTPUTS" status. And I can test that I can write successfully a message to the hard.
But in the other hand, if I try to add a light/Switch manually in the frontend, I can see the new Hardware device in the first combo, and I can select Switch Type, Type, and depending on the previous options, different combinations of ID, House Code, Unit Code...
My question is, how can "translate" the message from the "Test" button so I can really switch on/off a light that is an "OUPUT" of my system.
In the other hand I know that I need to use the "sDecodeRXMessage" function to decode the info from my hardware and send to Domoticz. But how can I map this info with the corresponding switches added manually in the frontend?
My home automation system, basically have a "controller", then it can have as a maximum 8 modules of 16 inputs each, and a maximum of 16 modules of 8 ouputs each (128 outputs and 128 inputs max). So, in the frontend part, when adding manually the light/switch, would it be perfect to have a new Type of "Switch Type - On/Off", where I could select the module (from 1 to 16) [Module combo], and also select the Output (from 1 to 8) [Output combo]. This way I'll have a total maximum of 128 ouputs I need.
Then, What Is needed to modify in the frontend part so I can see this new Type with 2 combos (module/ouput), and what I need to modify in the backendpart, where I've implemented the new hardware plugin, where I have the Class, StartHardware, StopHardware, Do_Work, OpenSerialDevice, readCallback (where I handle the data coming from the home automation system, and I write to it if necesssary).
I see in other plugins this piece of code
//Webserver helpers
namespace http {
namespace server {
void CWebServer::
is this the key to receive the info from the frontend?
And how I need to format the info in "sDecodeRXMessage" so the switch in the frontend can be updated accordingly ?
Thanks a lot!
As I explained some days ago, I started to implement a new hardware plugin for an old home automation system which I can communicate through USB/Serial/RS485.
After reading, coding, debugging, I can say that I can understand a bit the Domoticz architecture but I need your help.
At this moment I achieved:
In Domoticz FrontEnd, after following this guide (https://www.domoticz.com/wiki/Developin ... are_plugin) I can see the new hardware in the setup part, I can add it and configure to use the COM port, where I have a USBtoRS485 converter, and I can receive the data from the hardware. I can interpret the messages coming from the hard, in that case I can see the "INPUTS" and the "OUTPUTS" status. And I can test that I can write successfully a message to the hard.
But in the other hand, if I try to add a light/Switch manually in the frontend, I can see the new Hardware device in the first combo, and I can select Switch Type, Type, and depending on the previous options, different combinations of ID, House Code, Unit Code...
My question is, how can "translate" the message from the "Test" button so I can really switch on/off a light that is an "OUPUT" of my system.
In the other hand I know that I need to use the "sDecodeRXMessage" function to decode the info from my hardware and send to Domoticz. But how can I map this info with the corresponding switches added manually in the frontend?
My home automation system, basically have a "controller", then it can have as a maximum 8 modules of 16 inputs each, and a maximum of 16 modules of 8 ouputs each (128 outputs and 128 inputs max). So, in the frontend part, when adding manually the light/switch, would it be perfect to have a new Type of "Switch Type - On/Off", where I could select the module (from 1 to 16) [Module combo], and also select the Output (from 1 to 8) [Output combo]. This way I'll have a total maximum of 128 ouputs I need.
Then, What Is needed to modify in the frontend part so I can see this new Type with 2 combos (module/ouput), and what I need to modify in the backendpart, where I've implemented the new hardware plugin, where I have the Class, StartHardware, StopHardware, Do_Work, OpenSerialDevice, readCallback (where I handle the data coming from the home automation system, and I write to it if necesssary).
I see in other plugins this piece of code
//Webserver helpers
namespace http {
namespace server {
void CWebServer::
is this the key to receive the info from the frontend?
And how I need to format the info in "sDecodeRXMessage" so the switch in the frontend can be updated accordingly ?
Thanks a lot!