I have controller modules with an embedded web server, based on libmicrohttpd. Commands are currently implemented as method POST. This works using a web browser. The web server provides a page with a form that contains keywords and allows to set these to certain values.
Now I want to use that interface for an integration of the controller modules with openHAB. Just for information which is probably not relevant - the controller application with the webserver runs on Manjaro VM on my development computer, and openHAB has been installed via snap in the same VM. The version is 3.3.0 Release Build.
The controller module is configured as a rollershutter controller. I configured openHAB via the webGUI as good as I could. Using the http binding, I configured the controller module thing, one rollershutter, and a channel. Since the rollershutters in my system are addressed via (POST) keyword ShCmd_x_y with x=module index and y=shutter index, I think I will need a dedicated channel for each rollershutter item since openHAB will not know the relation between the labels and the indexes.
The commands up and down are represented by assigning values of 0 and 100, respectively, to the keyword ShCmd_5_0 (for module 5, shutter 0). The URL extension to command module 5 is “/shutter_module_command_5”. I did not find any documentation how to let the http binding assign a value of 0 to keyword ShCmd_5_0 for the up command (and the value of 100 for down command). Hence I tried the configuration as attached below, to get started somehow. Clicking on the up/down controls, an html post to the correct URL was provided, but with no payload. The debug code of the webserver outputs a 0 length with no data for POST processing.
I have 5 questions:
- The webserver does not expect an authentication. Is it a problem that authMode has to be set to some value (BASIC used)?
- How do I get openHAB at all to provide correct POST data in the payload?
- What would be the correct command configuration for the above described set-up?
- Provided that I can extend the functionality of the web server - would it be easier to define another kind of logical interface for commands by openHAB?
- Since I also need to retrieve sensor states via the web server, which approach would be best for that purpose (using GET? Which output format should the web server provide to minimize configuration effort in openHAB)?
I should mention that my programming skill is limited to C, currently. No problem to change the web server, but I would like to avoid complex scripting for openHAB.
UID: http:url:9dbe417ce9 label: C.F. HA. Gateway Computer thingTypeUID: http:url configuration: authMode: BASIC ignoreSSLErrors: false baseURL: http://localhost:8090 password: *** delay: 0 stateMethod: GET refresh: 30 commandMethod: POST contentType: text/html timeout: 3000 bufferSize: 2048 username: controluser channels: - id: Shutter_Command_5_0 channelTypeUID: http:rollershutter label: Sh_Cmd_5_0 description: "" configuration: mode: WRITEONLY escapedUrl: false commandExtension: /shutter_module_command_5 downValue: ShCmd_5_0=100 upValue: ShCmd_5_0=0