Configurable refreshinterval (#17523)

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This commit is contained in:
lsiepel 2024-10-11 13:12:43 +02:00 committed by GitHub
parent 989093c826
commit 9d97fe4ed0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 6 deletions

View File

@ -14,10 +14,11 @@ No autodiscovery available
## Thing Configuration ## Thing Configuration
| Config | Description | type | Default | | Config | Description | type | Default |
| :------- | :------------ | :----- | :-------- | |:----------------|:-------------------------------------------------------------------------------------------------------------------------------|:--------|:--------|
| hostname | The hostname or ip through which the inverter can be accessed | string | n/a | | hostname | The hostname or ip through which the inverter can be accessed | string | n/a |
| port | TCP port through which the inverter listens on for incoming connections | integer | 8899 | | port | TCP port through which the inverter listens on for incoming connections | integer | 8899 |
| serial | The serial of the wifi module. The Wifi module's SSID contains the number. This is the numerical part only, i.e. without _AP__ | integer | n/a | | serial | The serial of the wifi module. The Wifi module's SSID contains the number. This is the numerical part only, i.e. without _AP__ | integer | n/a |
| refreshInterval | Interval the device is polled in seconds. | integer | 10 |
## Channels ## Channels

View File

@ -24,4 +24,5 @@ public class OmnikInverterConfiguration {
public String hostname = ""; public String hostname = "";
public int port; public int port;
public int serial; public int serial;
public int refreshInterval = 10;
} }

View File

@ -74,7 +74,7 @@ public class OmnikInverterHandler extends BaseThingHandler {
inverter = new OmnikInverter(config.hostname, config.port, config.serial); inverter = new OmnikInverter(config.hostname, config.port, config.serial);
updateStatus(ThingStatus.UNKNOWN); updateStatus(ThingStatus.UNKNOWN);
pollJob = scheduler.scheduleWithFixedDelay(this::updateData, 0, 10, TimeUnit.SECONDS); pollJob = scheduler.scheduleWithFixedDelay(this::updateData, 0, config.refreshInterval, TimeUnit.SECONDS);
} }
@Override @Override

View File

@ -50,6 +50,8 @@ thing-type.config.omnikinverter.omnik.hostname.label = Hostname
thing-type.config.omnikinverter.omnik.hostname.description = The hostname or IP of the Omnik Inverter thing-type.config.omnikinverter.omnik.hostname.description = The hostname or IP of the Omnik Inverter
thing-type.config.omnikinverter.omnik.port.label = Port thing-type.config.omnikinverter.omnik.port.label = Port
thing-type.config.omnikinverter.omnik.port.description = The TCP port of the Omnik inverter, usually 8899 thing-type.config.omnikinverter.omnik.port.description = The TCP port of the Omnik inverter, usually 8899
thing-type.config.omnikinverter.omnik.refreshInterval.label = Refresh Interval
thing-type.config.omnikinverter.omnik.refreshInterval.description = Interval the device is polled in seconds.
thing-type.config.omnikinverter.omnik.serial.label = Serial thing-type.config.omnikinverter.omnik.serial.label = Serial
thing-type.config.omnikinverter.omnik.serial.description = The serial of the Omnik inverter's Wifi module. This the number part only. thing-type.config.omnikinverter.omnik.serial.description = The serial of the Omnik inverter's Wifi module. This the number part only.

View File

@ -103,6 +103,12 @@
<label>Serial</label> <label>Serial</label>
<description>The serial of the Omnik inverter's Wifi module. This the number part only.</description> <description>The serial of the Omnik inverter's Wifi module. This the number part only.</description>
</parameter> </parameter>
<parameter name="refreshInterval" type="integer" unit="s" min="5">
<label>Refresh Interval</label>
<description>Interval the device is polled in seconds.</description>
<default>10</default>
<advanced>true</advanced>
</parameter>
</config-description> </config-description>
</thing-type> </thing-type>