[neohub] Add support for WebSocket connection to hub (#12915)
* [neohub] add support for secure web socket connection * [neohub] clean code * [neohub] synchronize api calls * [neohub] rename classes, fix compiler errors, remove SuppressWarnings Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
committed by
GitHub
parent
8d3828a9a4
commit
f60e324229
@@ -33,21 +33,31 @@ It signs on to the hub using the supplied connection parameters, and it polls th
|
||||
The NeoHub supports two Application Programming Interfaces "API" (an older "legacy" one, and a modern one), and this binding can use either of them to communicate with it.
|
||||
Before the binding can communicate with the hub, the following Configuration Parameters must be entered.
|
||||
|
||||
| Configuration Parameter | Description |
|
||||
|-------------------------|---------------------------------------------------------------------------------------------|
|
||||
| hostName | Host name (IP address) of the NeoHub (example 192.168.1.123) |
|
||||
| portNumber | Port number of the NeoHub (Default=4242) |
|
||||
| pollingInterval | Time (seconds) between polling requests to the NeoHub (Min=4, Max=60, Default=60) |
|
||||
| socketTimeout | Time (seconds) to allow for TCP socket connections to the hub to succeed (Min=4, Max=20, Default=5) |
|
||||
| preferLegacyApi | ADVANCED: Prefer the binding to use older API calls; if these are not supported, it switches to the new calls (Default=false) |
|
||||
| Configuration Parameter | Description |
|
||||
|----------------------------|----------------------------------------------------------------------------------------------------------|
|
||||
| hostName | Host name (IP address) of the NeoHub (example 192.168.1.123) |
|
||||
| useWebSocket<sup>1)</sup> | Use secure WebSocket to connect to the NeoHub (example `true`) |
|
||||
| apiToken<sup>1)</sup> | API Access Token for secure connection to hub. Create the token in the Heatmiser mobile App |
|
||||
| pollingInterval | Time (seconds) between polling requests to the NeoHub (Min=4, Max=60, Default=60) |
|
||||
| socketTimeout | Time (seconds) to allow for TCP socket connections to the hub to succeed (Min=4, Max=20, Default=5) |
|
||||
| preferLegacyApi | ADVANCED: Prefer to use older API calls; but if not supported, it switches to new calls (Default=false) |
|
||||
| portNumber<sup>2)</sup> | ADVANCED: Port number for connection to the NeoHub (Default=0 (automatic)) |
|
||||
|
||||
<sup>1)</sup> If `useWebSocket` is false, the binding will connect via an older and less secure TCP connection, in which case `apiToken` is not required.
|
||||
However see the chapter "Connection Refused Errors" below.
|
||||
Whereas if you prefer to connect via more secure WebSocket connections then an API access token `apiToken` is required.
|
||||
You can create an API access token in the Heatmiser mobile App (Settings | System | API Access).
|
||||
|
||||
<sup>2)</sup> Normally the port number is chosen automatically (for TCP it is 4242 and for WebSocket it is 4243).
|
||||
But you can override this in special cases if you want to use (say) port forwarding.
|
||||
|
||||
## Connection Refused Errors
|
||||
|
||||
From early 2022 Heatmiser introduced NeoHub firmware that has the ability to enable / disable the NeoHub `portNumber` 4242.
|
||||
If this port is disabled the OpenHAB binding cannot connect and the binding will report a *"Connection Refused"* warning in the log.
|
||||
In prior firmware versions the port was always enabled.
|
||||
But in the new firmware the port is initially enabled on power up but if no communication occurs for 48 hours it is automatically disabled.
|
||||
Alternatively the Heatmiser mobile App has a setting (Settings | System | API Access | Legacy API Enable | On) whereby the port can be permanently enabled.
|
||||
From early 2022 Heatmiser introduced NeoHub firmware that has the ability to enable / disable connecting to it via a TCP port.
|
||||
If the TCP port is disabled the OpenHAB binding cannot connect and the binding will report a *"Connection Refused"* warning in the log.
|
||||
In prior firmware versions the TCP port was always enabled.
|
||||
But in the new firmware the TCP port is initially enabled on power up but if no communication occurs for 48 hours it is automatically disabled.
|
||||
Alternatively the Heatmiser mobile app has a setting (Settings | System | API Access | Legacy API Enable | On) whereby the TCP port can be permanently enabled.
|
||||
|
||||
## Thing Configuration for "NeoStat" and "NeoPlug"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user