Compare commits

..

5 Commits

Author SHA1 Message Date
Ciprian Pascu
fe8bc9b233
Merge d1fa64fb69 into d36b2a8d82 2025-01-08 19:37:32 +00:00
Ciprian Pascu
d1fa64fb69 [sbus] fix sat issues
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
2025-01-08 21:37:24 +02:00
jimtng
d36b2a8d82
[basicprofiles] Add a table-of-contents at top of README.md (#18058)
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
2025-01-08 20:15:25 +01:00
Mark Herwege
5ac2780749
fix offline when image not available (#18066)
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
2025-01-08 20:03:21 +01:00
Ciprian Pascu
31c409f6ce [sbus] fix sat issues
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
2025-01-08 19:59:36 +02:00
7 changed files with 78 additions and 24 deletions

View File

@ -19,8 +19,28 @@
<groupId>ro.ciprianpascu</groupId>
<artifactId>j2sbus</artifactId>
<version>1.5.4</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>6.0.0</version>
<configuration>
<instructions>
<Import-Package>
ro.ciprianpascu.sbus.facade,
*
</Import-Package>
<Embed-Dependency>j2sbus;scope=compile</Embed-Dependency>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -15,7 +15,6 @@ package org.openhab.binding.sbus.handler;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.sbus.handler.config.SbusBridgeConfig;
import org.openhab.binding.sbus.internal.SbusServiceImpl;
import org.openhab.core.thing.Bridge;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.ThingStatus;
@ -69,14 +68,8 @@ public class SbusBridgeHandler extends BaseBridgeHandler {
"Sbus service not available");
return;
}
try {
((SbusServiceImpl) service).initialize(config.host, config.port);
updateStatus(ThingStatus.ONLINE);
} catch (Exception e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
}
service.initialize(config.host, config.port);
updateStatus(ThingStatus.ONLINE);
} catch (Exception e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
}

View File

@ -83,4 +83,6 @@ public interface SbusService {
* Closes the service and releases resources.
*/
void close();
void initialize(String host, int port) throws Exception;
}

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0
https://openhab.org/schemas/thing-description-1.0.0.xsd">
https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Switch Device -->
<thing-type id="switch">
@ -17,8 +17,10 @@
<label>SubnetId</label>
<description>Slave subnet id. Can take any value between 1 and 255. 255 for broadcast.</description>
<default>1</default>
<min>1</min>
<max>255</max>
<options>
<option value="1">1</option>
<option value="255">255</option>
</options>
</parameter>
<parameter name="id" type="integer" required="true">
<label>Device ID</label>
@ -28,6 +30,7 @@
<label>Refresh Interval</label>
<description>Refresh interval in seconds</description>
<default>30</default>
<unitLabel>s</unitLabel>
</parameter>
</config-description>
</thing-type>
@ -44,8 +47,10 @@
<label>SubnetId</label>
<description>Slave subnet id. Can take any value between 1 and 255. 255 for broadcast.</description>
<default>1</default>
<min>1</min>
<max>255</max>
<options>
<option value="1">1</option>
<option value="255">255</option>
</options>
</parameter>
<parameter name="id" type="integer" required="true">
<label>Device ID</label>
@ -55,6 +60,7 @@
<label>Refresh Interval</label>
<description>Refresh interval in seconds</description>
<default>30</default>
<unitLabel>s</unitLabel>
</parameter>
</config-description>
</thing-type>
@ -71,8 +77,10 @@
<label>SubnetId</label>
<description>Slave subnet id. Can take any value between 1 and 255. 255 for broadcast.</description>
<default>1</default>
<min>1</min>
<max>255</max>
<options>
<option value="1">1</option>
<option value="255">255</option>
</options>
</parameter>
<parameter name="id" type="integer" required="true">
<label>Device ID</label>
@ -82,6 +90,7 @@
<label>Refresh Interval</label>
<description>Refresh interval in seconds</description>
<default>30</default>
<unitLabel>s</unitLabel>
</parameter>
</config-description>
</thing-type>
@ -114,7 +123,8 @@
<label>Timer</label>
<description>Timer in seconds to automatically turn off the switch (0 = disabled)</description>
<default>0</default>
<min>0</min>
<advanced>true</advanced>
<unitLabel>s</unitLabel>
</parameter>
</config-description>
</channel-type>

View File

@ -365,13 +365,19 @@ public class SpeedtestHandler extends BaseThingHandler {
isp = tmpCont.getIsp();
interfaceInternalIp = tmpCont.getInterface().getInternalIp();
interfaceExternalIp = tmpCont.getInterface().getExternalIp();
resultUrl = tmpCont.getResult().getUrl();
String url = String.valueOf(resultUrl) + ".png";
logger.debug("Downloading result image from: {}", url);
RawType image = HttpUtil.downloadImage(url);
if (image != null) {
resultImage = image;
if (tmpCont.getResult().isPersisted()) {
resultUrl = tmpCont.getResult().getUrl();
String url = String.valueOf(resultUrl) + ".png";
logger.debug("Downloading result image from: {}", url);
RawType image = HttpUtil.downloadImage(url);
if (image != null) {
resultImage = image;
} else {
resultImage = UnDefType.NULL;
}
} else {
logger.debug("Result image not persisted");
resultUrl = "";
resultImage = UnDefType.NULL;
}

View File

@ -263,6 +263,9 @@ public class ResultContainer {
@SerializedName("url")
@Expose
private String url;
@SerializedName("persisted")
@Expose
private boolean persisted;
public String getId() {
return id;
@ -279,6 +282,14 @@ public class ResultContainer {
public void setUrl(String url) {
this.url = url;
}
public boolean isPersisted() {
return persisted;
}
public void setPersisted(boolean persisted) {
this.persisted = persisted;
}
}
public class Server {

View File

@ -1,6 +1,18 @@
# Basic Profiles
This bundle provides a list of useful Profiles.
This bundle provides a list of useful Profiles:
| Profile | Description |
| --------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| [Generic Command Profile](#generic-command-profile) | Sends a Command towards the Item when an event is triggered |
| [Generic Toggle Switch Profile](#generic-toggle-switch-profile) | Toggles a Switch Item when an event is triggered |
| [Debounce (Counting) Profile](#debounce-counting-profile) | Counts and skip a number of State changes |
| [Debounce (Time) Profile](#debounce-time-profile) | Reduces the frequency of commands/state updates |
| [Invert / Negate Profile](#invert--negate-profile) | Inverts or negate a Command / State |
| [Round Profile](#round-profile) | Reduces the number of decimal places from input data |
| [Threshold Profile](#threshold-profile) | Translates numeric input data to `ON` or `OFF` based on a threshold value |
| [Time Range Command Profile](#time-range-command-profile) | An enhanced implementation of a follow profile which converts `OnOffType` to a `PercentType` |
| [State Filter Profile](#state-filter-profile) | Filters input data using arithmetic comparison conditions |
## Generic Command Profile