mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[semsportal] Allow confiuration with thing file (#10842)
* [semsportal] Allow portal and station cofiguration with .things file Signed-off-by: Iwan Bron <bron@olisa.eu> * Fix README.md warning Signed-off-by: Iwan Bron <bron@olisa.eu> * Make thing type better visible in documentation Signed-off-by: Iwan Bron <bron@olisa.eu> Co-authored-by: Iwan Bron <bron@olisa.eu>
This commit is contained in:
parent
1a06d78f22
commit
cb256f6676
@ -8,8 +8,8 @@ It requires a power station that is connected through the internet to the SEMS p
|
||||
## Supported Things
|
||||
|
||||
This binding provides two Thing types: a bridge to the SEMS Portal, and the Power Stations which are found at the Portal.
|
||||
The Portal (semsportal:portal) represents your account in the SEMS portal.
|
||||
The Power Station (semsportal:station) is an installation of a Power Station or inverter that reports to the SEMS portal and is available to your account.
|
||||
The Portal (``semsportal:portal``) represents your account in the SEMS portal.
|
||||
The Power Station (``semsportal:station``) is an installation of a Power Station or inverter that reports to the SEMS portal and is available to your account.
|
||||
|
||||
## Discovery
|
||||
|
||||
@ -29,6 +29,24 @@ The default is 5 minutes.
|
||||
|
||||
Power Stations have no settings and will be auto discovered when you add a Portal Bridge.
|
||||
|
||||
If you prefer manual configuration of things in thing files, you need to supply the power station UUID.
|
||||
It can be found in the SEMS portal URL after you have logged in.
|
||||
The URL will look like this:
|
||||
|
||||
```
|
||||
https://www.semsportal.com/PowerStation/PowerStatusSnMin/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
```
|
||||
|
||||
Where the part after the last / character is the UUID to be used.
|
||||
|
||||
Example portal configuration with a station:
|
||||
|
||||
```
|
||||
Bridge semsportal:portal:myPortal [ username="my@username.com", password="MyPassword" ] {
|
||||
station solarPanels "Solar Panels" [ stationUUID="xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ]
|
||||
}
|
||||
```
|
||||
|
||||
## Channels
|
||||
|
||||
The Portal(Bridge) has no channels.
|
||||
@ -46,14 +64,21 @@ The Power Station Thing has the following channels:
|
||||
|
||||
## Parameters
|
||||
|
||||
The PowerStation Thing has no parameters.
|
||||
Only the Bridge has the following configuration parameters:
|
||||
The Power Station Thing has no configuration parameters when auto discovered.
|
||||
When using thing files you need to provide the station UUID.
|
||||
|
||||
|
||||
| Parameter | Required? | Description |
|
||||
| ----------- |:---------:| ---------------------------------------------------------------------------------------------------------- |
|
||||
| username | X | Account name (email address) at the SEMS portal. Account must have been used at least once to log in. |
|
||||
| stationUUID | X | UUID of the station. Can be found on the SEMS portal URL (see description above) |
|
||||
|
||||
The Bridge has the following configuration parameters:
|
||||
|
||||
| Parameter | Required? | Description |
|
||||
| ----------- |:---------:| ---------------------------------------------------------------------------------------------------------- |
|
||||
| username | X | Account name (email address) at the SEMS portal. Account must have been used at least once to log in. |
|
||||
| password | X | Password of the SEMS portal |
|
||||
| update | | Number of minutes between two updates. Between 1 and 60 minutes, defaults to 5 minutes |
|
||||
| interval | | Number of minutes between two updates. Between 1 and 60 minutes, defaults to 5 minutes |
|
||||
|
||||
## Credits
|
||||
|
||||
|
@ -200,7 +200,7 @@ public class PortalHandler extends BaseBridgeHandler {
|
||||
}
|
||||
|
||||
public long getUpdateInterval() {
|
||||
return config.update;
|
||||
return config.interval;
|
||||
}
|
||||
|
||||
public List<Station> getAllStations() {
|
||||
|
@ -32,5 +32,5 @@ public class SEMSPortalConfiguration {
|
||||
*/
|
||||
public String username = "";
|
||||
public String password = "";
|
||||
public int update = SEMSPortalBindingConstants.DEFAULT_UPDATE_INTERVAL_MINUTES;
|
||||
public int interval = SEMSPortalBindingConstants.DEFAULT_UPDATE_INTERVAL_MINUTES;
|
||||
}
|
||||
|
@ -156,6 +156,12 @@ public class StationHandler extends BaseThingHandler {
|
||||
|
||||
private String getStationUUID() {
|
||||
String uuid = getThing().getProperties().get(STATION_UUID);
|
||||
if (uuid == null) {
|
||||
Object uuidObj = getThing().getConfiguration().get(STATION_UUID);
|
||||
if (uuidObj instanceof String) {
|
||||
uuid = (String) uuidObj;
|
||||
}
|
||||
}
|
||||
return uuid == null ? "" : uuid;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user