Skip to content

Commit

Permalink
Merge branch 'openhab:main' into add-airthings-wave-gen1-support-1
Browse files Browse the repository at this point in the history
  • Loading branch information
dw-8 authored Jul 25, 2021
2 parents 425a31f + cf6729a commit 0c637df
Show file tree
Hide file tree
Showing 20 changed files with 111 additions and 61 deletions.
2 changes: 1 addition & 1 deletion bundles/org.openhab.binding.deconz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The transition time is the time to move between two states and is configured in
The resolution provided is 1/10s.
If no value is provided, the default value of the device is used.

`extendedcolorlight` and `colorlight` have different modes for setting the color.
`extendedcolorlight`, `colorlight` and `lightgroup` have different modes for setting the color.
Some devices accept only XY, others HSB, others both modes and the binding tries to autodetect the correct mode.
If this fails, the advanced `colormode` parameter can be set to `xy` or `hs`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ public class GroupAction {
public @Nullable Integer ct;
public double @Nullable [] xy;
public @Nullable String alert;
public @Nullable String colormode;
public @Nullable String effect;
public @Nullable Integer colorloopspeed;
public @Nullable Integer transitiontime;

@Override
public String toString() {
return "GroupAction{" + "on=" + on + ", toggle=" + toggle + ", bri=" + bri + ", hue=" + hue + ", sat=" + sat
+ ", ct=" + ct + ", xy=" + Arrays.toString(xy) + ", alert='" + alert + '\'' + ", effect='" + effect
+ '\'' + ", colorloopspeed=" + colorloopspeed + ", transitiontime=" + transitiontime + '}';
return "GroupAction{on=" + on + ", toggle=" + toggle + ", bri=" + bri + ", hue=" + hue + ", sat=" + sat
+ ", ct=" + ct + ", xy=" + Arrays.toString(xy) + ", alert='" + alert + "', colormode='" + colormode
+ "', effect='" + effect + "', colorloopspeed=" + colorloopspeed + ", transitiontime=" + transitiontime
+ "}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,22 @@ public class GroupThingHandler extends DeconzBaseThingHandler {

private Map<String, String> scenes = Map.of();
private GroupState groupStateCache = new GroupState();
private String colorMode = "";

public GroupThingHandler(Thing thing, Gson gson,
DeconzDynamicCommandDescriptionProvider commandDescriptionProvider) {
super(thing, gson, ResourceType.GROUPS);
this.commandDescriptionProvider = commandDescriptionProvider;
}

@Override
public void initialize() {
ThingConfig thingConfig = getConfigAs(ThingConfig.class);
colorMode = thingConfig.colormode;

super.initialize();
}

@Override
public void handleCommand(ChannelUID channelUID, Command command) {
String channelId = channelUID.getId();
Expand All @@ -89,11 +98,17 @@ public void handleCommand(ChannelUID channelUID, Command command) {
case CHANNEL_COLOR:
if (command instanceof HSBType) {
HSBType hsbCommand = (HSBType) command;
Integer bri = Util.fromPercentType(hsbCommand.getBrightness());
newGroupAction.bri = bri;
if (bri > 0) {
// XY color is the implicit default: Use XY color mode if i) no color mode is set or ii) if the bulb
// is in CT mode or iii) already in XY mode. Only if the bulb is in HS mode, use this one.
if ("hs".equals(colorMode)) {
newGroupAction.hue = (int) (hsbCommand.getHue().doubleValue() * HUE_FACTOR);
newGroupAction.sat = Util.fromPercentType(hsbCommand.getSaturation());
} else {
PercentType[] xy = hsbCommand.toXY();
if (xy.length < 2) {
logger.warn("Failed to convert {} to xy-values", command);
}
newGroupAction.xy = new double[] { xy[0].doubleValue() / 100.0, xy[1].doubleValue() / 100.0 };
}
} else if (command instanceof PercentType) {
newGroupAction.bri = Util.fromPercentType((PercentType) command);
Expand Down Expand Up @@ -172,6 +187,16 @@ public void messageReceived(String sensorID, DeconzBaseMessage message) {
thing.getChannels().stream().map(c -> c.getUID().getId()).forEach(c -> valueUpdated(c, groupState));
groupStateCache = groupState;
}
GroupAction groupAction = groupMessage.action;
if (groupAction != null) {
if (colorMode.isEmpty()) {
String cmode = groupAction.colormode;
if (cmode != null && ("hs".equals(cmode) || "xy".equals(cmode))) {
// only set the color mode if it is hs or xy, not ct
colorMode = cmode;
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,19 @@ public void handleCommand(ChannelUID channelUID, Command command) {
}
} else if (command instanceof HSBType) {
HSBType hsbCommand = (HSBType) command;
if ("xy".equals(colorMode)) {
// XY color is the implicit default: Use XY color mode if i) no color mode is set or ii) if the bulb
// is in CT mode or iii) already in XY mode. Only if the bulb is in HS mode, use this one.
if ("hs".equals(colorMode)) {
newLightState.hue = (int) (hsbCommand.getHue().doubleValue() * HUE_FACTOR);
newLightState.sat = Util.fromPercentType(hsbCommand.getSaturation());
} else {
PercentType[] xy = hsbCommand.toXY();
if (xy.length < 2) {
logger.warn("Failed to convert {} to xy-values", command);
}
newLightState.xy = new double[] { xy[0].doubleValue() / 100.0, xy[1].doubleValue() / 100.0 };
newLightState.bri = Util.fromPercentType(hsbCommand.getBrightness());
} else {
// default is colormode "hs" (used when colormode "hs" is set or colormode is unknown)
newLightState.bri = Util.fromPercentType(hsbCommand.getBrightness());
newLightState.hue = (int) (hsbCommand.getHue().doubleValue() * HUE_FACTOR);
newLightState.sat = Util.fromPercentType(hsbCommand.getSaturation());
}
newLightState.bri = Util.fromPercentType(hsbCommand.getBrightness());
} else if (command instanceof PercentType) {
newLightState.bri = Util.fromPercentType((PercentType) command);
} else if (command instanceof DecimalType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@NonNullByDefault
public class ThingConfig {
public String id = "";
public int lastSeenPolling = 1440;
public @Nullable Double transitiontime;
public String colormode = "";
public int lastSeenPolling = 1440;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
<context>network-address</context>
<description>IP address or host name of deCONZ interface.</description>
</parameter>
<parameter name="httpPort" type="integer" required="false" min="1" max="65535">
<parameter name="httpPort" type="integer" min="1" max="65535">
<label>HTTP Port</label>
<description>Port of the deCONZ HTTP interface.</description>
<default>80</default>
</parameter>
<parameter name="port" type="integer" required="false" min="1" max="65535">
<parameter name="port" type="integer" min="1" max="65535">
<label>Websocket Port</label>
<description>Port of the deCONZ Websocket.</description>
<advanced>true</advanced>
</parameter>
<parameter name="apikey" type="text" required="false">
<parameter name="apikey" type="text">
<label>API Key</label>
<context>password</context>
<description>If no API Key is provided, a new one will be requested. You need to authorize the access on the deCONZ
web interface.</description>
</parameter>
<parameter name="timeout" type="integer" required="false" unit="ms" min="0">
<parameter name="timeout" type="integer" unit="ms" min="0">
<label>Timeout</label>
<description>Timeout for asynchronous HTTP requests (in milliseconds).</description>
<advanced>true</advanced>
Expand All @@ -52,7 +52,7 @@
<label>Device ID</label>
<description>The deCONZ bridge assigns an integer number ID to each device.</description>
</parameter>
<parameter name="transitiontime" type="decimal" required="false" min="0" unit="s">
<parameter name="transitiontime" type="decimal" min="0" unit="s">
<label>Transition Time</label>
<description>Time to move between two states. If empty, the default of the device is used. Resolution is 1/10 second.</description>
</parameter>
Expand All @@ -63,11 +63,11 @@
<label>Device ID</label>
<description>The deCONZ bridge assigns an integer number ID to each device.</description>
</parameter>
<parameter name="transitiontime" type="decimal" required="false" min="0" unit="s">
<parameter name="transitiontime" type="decimal" min="0" unit="s">
<label>Transition Time</label>
<description>Time to move between two states. If empty, the default of the device is used. Resolution is 1/10 second.</description>
</parameter>
<parameter name="colormode" type="text" required="false">
<parameter name="colormode" type="text">
<label>Color Mode</label>
<description>Override the default color mode (auto-detect)</description>
<options>
Expand All @@ -78,4 +78,19 @@
</parameter>
</config-description>

<config-description uri="thing-type:deconz:lightgroup">
<parameter name="id" type="text" required="true">
<label>Device ID</label>
<description>The deCONZ bridge assigns an integer number ID to each group.</description>
</parameter>
<parameter name="colormode" type="text">
<label>Color Mode</label>
<description>Override the default color mode (auto-detect)</description>
<options>
<option value="hs">HSB</option>
<option value="xy">XY</option>
</options>
<advanced>true</advanced>
</parameter>
</config-description>
</config-description:config-descriptions>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<representation-property>uid</representation-property>

<config-description-ref uri="thing-type:deconz:sensor"/>
<config-description-ref uri="thing-type:deconz:lightgroup"/>
</thing-type>

<channel-type id="all_on">
Expand Down
29 changes: 17 additions & 12 deletions bundles/org.openhab.binding.fsinternetradio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ This binding integrates internet radios based on the [Frontier Silicon chipset](

Successfully tested are internet radios:

* [Hama IR100](https://de.hama.com/00054823/hama-internetradio-ir110)
* [Hama IR100, IR110](https://de.hama.com/00054823/hama-internetradio-ir110)
* [Hama DIR3100](https://www.conrad.com/p/hama-dir3100-internet-desk-radio-dab-fm-aux-internet-radio-usb-spotify-black-1233624)
* [Medion MD87180, MD86988, MD86955, MD87528](http://internetradio.medion.com/)
* [Silvercrest SMRS18A1, SMRS30A1, SMRS35A1, SIRD 14 C2, SIRD 14 D1](https://www.silvercrest-multiroom.de/en/products/stereo-internet-radio/)
* [Roberts Stream 83i and 93i](https://www.robertsradio.com/uk/products/radio/smart-radio/)
* [Auna Connect 150, Auna KR200](https://www.auna.de/Radios/Internetradios/)
* [Auna Connect 150, Auna KR200, Auna Connect CD](https://www.auna.de/Radios/Internetradios/)
* [TechniSat DIGITRADIO 350 IR and 850](https://www.technisat.com/en_XX/DAB+-Radios-with-Internetradio/352-10996/)
* [TTMicro AS Pinell Supersound](https://www.ttmicro.no/radio)
* [Revo SuperConnect](https://revo.co.uk/products/)
Expand Down Expand Up @@ -67,16 +68,20 @@ All devices support some of the following channels:
The radio mode depends on the internet radio model (and its firmware version!).
This list is just an example how the mapping looks like for some of the devices, please try it out and adjust your sitemap for your particular radio.

| Radio Mode | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
|--------------------------|----------------|-------------------------|-----------|--------------|-----------|----------|--------------|--------------|-----------|-----------|--------|
| Hama IR110 | Internet Radio | Spotify | Player | AUX in | - | - | - | - | - | - |- |
| Medion MD87180 | Internet Radio | Music Player (USB, LAN) | DAB Radio | FM Radio | AUX in | - | - | - | - | - |- |
| Medion MD 86988 | Internet Radio | Music Player | FM Radio | AUX in | - | - | - | - | - | - |- |
| Technisat DigitRadio 580 | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in | CD | Bluetooth | - |- |
| Dual IR 3a | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | Bluetooth | - | - | - |- |
| Silvercrest SIRD 14 C1 | - | Napster | Deezer | Qobuz | Spotify | TIDAL | Spotify | Music Player | DAB Radio | FM Radio | AUX in |
| Silvercrest SIRD 14 C2 | Internet Radio | TIDAL | Deezer | Qobuz | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in |- |
| Auna KR200 Kitchen Radio | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in | - | - | - |- |
| Radio Mode | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
|--------------------------|----------------|-------------------------|--------------|--------------|-----------|----------|--------------|--------------|-----------|-----------|--------|
| Hama IR100 | Internet Radio | Spotify | Music Player | AUX in | - | - | - | - | - | - |- |
| Hama IR110 | Internet Radio | Spotify | Music Player | AUX in | - | - | - | - | - | - |- |
| Hama DIR3100 | Internet Radio | Spotify | Music Player | DAB Radio | FM Radio | AUX in | - | - | - | - |- |
| Medion MD87180 | Internet Radio | Music Player (USB, LAN) | DAB Radio | FM Radio | AUX in | - | - | - | - | - |- |
| Medion MD 86988 | Internet Radio | Music Player | FM Radio | AUX in | - | - | - | - | - | - |- |
| Technisat DigitRadio 580 | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in | CD | Bluetooth | - |- |
| Dual IR 3a | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | Bluetooth | - | - | - |- |
| Silvercrest SIRD 14 C1 | - | Napster | Deezer | Qobuz | Spotify | TIDAL | Spotify | Music Player | DAB Radio | FM Radio | AUX in |
| Silvercrest SIRD 14 C2 | Internet Radio | TIDAL | Deezer | Qobuz | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in |- |
| Auna KR200 Kitchen Radio | Internet Radio | Spotify | - | Music Player | DAB Radio | FM Radio | AUX in | - | - | - |- |
| Auna Connect CD | Internet Radio | Spotify | Music Player | Music Player | DAB Radio | FM Radio | CD | Bluetooth | AUX in | - | - |- |


## Full Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ public void getTelemetry(String xmlResponse) throws HaywardException {
String thingSystemID = getThing().getUID().getId();
for (int i = 0; i < systemIDs.size(); i++) {
if (systemIDs.get(i).equals(thingSystemID)) {
// Operating Mode
data = bridgehandler.evaluateXPath("//Chlorinator/@operatingMode", xmlResponse);
updateData(HaywardBindingConstants.CHANNEL_CHLORINATOR_OPERATINGMODE, data.get(i));

// Valve Position
data = bridgehandler.evaluateXPath("//Filter/@valvePosition", xmlResponse);
updateData(HaywardBindingConstants.CHANNEL_FILTER_VALVEPOSITION, data.get(i));
Expand Down
8 changes: 5 additions & 3 deletions bundles/org.openhab.binding.miio/README.base.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,19 @@ However, for devices that are unsupported, you may override the value and try to
| model | text | false | Device model string, used to determine the subtype |
| refreshInterval | integer | false | Refresh interval for refreshing the data in seconds. (0=disabled) |
| timeout | integer | false | Timeout time in milliseconds |
| communication | test | false | Communicate direct or via cloud (options values: 'direct', 'cloud') |
| communication | text | false | Communicate direct or via cloud (options values: 'direct', 'cloud') |
| cloudServer | text | false | Identifies the country server to use in case of cloud communication |

Note: Suggest to use the cloud communication only for devices that require it. It is unknown at this time if Xiaomi has a rate limit or other limitations on the cloud usage. e.g. if having many devices would trigger some throttling from the cloud side.
Note: Suggest to use the cloud communication only for devices that require it.
It is unknown at this time if Xiaomi has a rate limit or other limitations on the cloud usage. e.g. if having many devices would trigger some throttling from the cloud side.

### Example Thing file

`Thing miio:basic:light "My Light" [ host="192.168.x.x", token="put here your token", deviceId="326xxxx", model="philips.light.bulb", communication="direct" ]`

or in case of unknown models include the model information of a similar device that is supported:

`Thing miio:vacuum:s50 "vacuum" @ "livingroom" [ host="192.168.15.20", token="xxxxxxx", deviceId="326xxxx", model="roborock.vacuum.s4", communication="direct" ]`
`Thing miio:vacuum:s50 "vacuum" @ "livingroom" [ host="192.168.15.20", token="xxxxxxx", deviceId="326xxxx", model="roborock.vacuum.s4", communication="direct", cloudServer="de" ]`

# Advanced: Unsupported devices

Expand Down
Loading

0 comments on commit 0c637df

Please sign in to comment.