Webserver within plugin? - For receiving external events
Posted: Sunday 26 March 2017 11:02
Hi,
Have just started to explore what can be done with the Python plugin capabilities. An awesome thing if you ask me as it open up much more ways to integrate stuff and in a way that is simpler due to Python vs C++.
I have a device from Teracom that is basically a ethernet connected IO device with relays, 1-wire and digital inputs together with rudimentary automation. For example a relay can be triggered if a temperature is reached on a 1-wire sensor or if a digital input state is changed etc.
The plugin I am planning to write will leverage these capabilities to configure an autonomous control system for a pool heater integrated with heatpump (water-water variant, a type very common the Nordics). Doing the actual configuration should not be the hard part as the device have defined APIs to control pretty much anything in it. The harder part which causes headache for me is to handle events coming from the Teracom unit in the form of SNMP traps or state data sent to an arbitrary URL.
My question is what is the best way to capture state change information coming in from external devices with Domoticz. The optimal way (at least how I think about it) would be to have a tiny webserver running within the plugin that the unit can post changes to and then data is immediately captured by plugin and processed. Not sure what issues this may cause with threading and lockups and before I start looking at I´m interested in hearing about ideas from the community here.
/Magnus
Have just started to explore what can be done with the Python plugin capabilities. An awesome thing if you ask me as it open up much more ways to integrate stuff and in a way that is simpler due to Python vs C++.
I have a device from Teracom that is basically a ethernet connected IO device with relays, 1-wire and digital inputs together with rudimentary automation. For example a relay can be triggered if a temperature is reached on a 1-wire sensor or if a digital input state is changed etc.
The plugin I am planning to write will leverage these capabilities to configure an autonomous control system for a pool heater integrated with heatpump (water-water variant, a type very common the Nordics). Doing the actual configuration should not be the hard part as the device have defined APIs to control pretty much anything in it. The harder part which causes headache for me is to handle events coming from the Teracom unit in the form of SNMP traps or state data sent to an arbitrary URL.
My question is what is the best way to capture state change information coming in from external devices with Domoticz. The optimal way (at least how I think about it) would be to have a tiny webserver running within the plugin that the unit can post changes to and then data is immediately captured by plugin and processed. Not sure what issues this may cause with threading and lockups and before I start looking at I´m interested in hearing about ideas from the community here.
/Magnus