- [Intrusion Detection System](#intrusion-detection-system)
- [Smart Bulb](#smart-bulb)
- [Smoke Detector](#smoke-detector)
+ - [Smoke Detector II](#smoke-detector-ii)
- [User-defined States](#user-defined-states)
- [Universal Switch](#universal-switch)
- [Universal Switch II](#universal-switch-ii)
| ------------------ | -------------------- | :------: | ------------------------------------------------------------------------------------------------- |
| smoke-check | String | ☑ | State of the smoke check. Also used to request a new smoke check. |
+### Smoke Detector II
+
+The smoke detector warns you in case of fire.
+
+**Thing Type ID**: `smoke-detector`
+
+| Channel Type ID | Item Type | Writable | Description |
+|-------------------|-------------| :------: |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| smoke-check | String | ☑ | State of the smoke check. Also used to request a new smoke check. |
+| battery-level | Number | ☐ | Current battery level percentage as integer number. Bosch-specific battery levels are mapped to numbers as follows: `OK`: 100, `LOW_BATTERY`: 10, `CRITICAL_LOW`: 1, `CRITICALLY_LOW_BATTERY`: 1, `NOT_AVAILABLE`: `UNDEF`. |
+| low-battery | Switch | ☐ | Indicates whether the battery is low (`ON`) or OK (`OFF`). |
+| signal-strength | Number | ☐ | Communication quality between the device and the Smart Home Controller. Possible values range between 0 (unknown) and 4 (best signal strength). |
+
### User-defined States
public static final ThingTypeUID THING_TYPE_UNIVERSAL_SWITCH_2 = new ThingTypeUID(BINDING_ID, "universal-switch-2");
public static final ThingTypeUID THING_TYPE_USER_DEFINED_STATE = new ThingTypeUID(BINDING_ID, "user-defined-state");
+ public static final ThingTypeUID THING_TYPE_SMOKE_DETECTOR_2 = new ThingTypeUID(BINDING_ID, "smoke-detector-2");
// List of all Channel IDs
// Auto-generated from thing-types.xml via script, don't modify
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_SMART_BULB;
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_SMART_PLUG_COMPACT;
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_SMOKE_DETECTOR;
+import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_SMOKE_DETECTOR_2;
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_THERMOSTAT;
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_TWINGUARD;
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_UNIVERSAL_SWITCH;
import org.openhab.binding.boschshc.internal.devices.plug.PlugHandler;
import org.openhab.binding.boschshc.internal.devices.shuttercontrol.ShutterControlHandler;
import org.openhab.binding.boschshc.internal.devices.smartbulb.SmartBulbHandler;
+import org.openhab.binding.boschshc.internal.devices.smokedetector.SmokeDetector2Handler;
import org.openhab.binding.boschshc.internal.devices.smokedetector.SmokeDetectorHandler;
import org.openhab.binding.boschshc.internal.devices.thermostat.ThermostatHandler;
import org.openhab.binding.boschshc.internal.devices.twinguard.TwinguardHandler;
new ThingTypeHandlerMapping(THING_TYPE_UNIVERSAL_SWITCH,
thing -> new UniversalSwitchHandler(thing, timeZoneProvider)),
new ThingTypeHandlerMapping(THING_TYPE_UNIVERSAL_SWITCH_2,
- thing -> new UniversalSwitch2Handler(thing, timeZoneProvider)));
+ thing -> new UniversalSwitch2Handler(thing, timeZoneProvider)),
+ new ThingTypeHandlerMapping(THING_TYPE_SMOKE_DETECTOR_2, SmokeDetector2Handler::new));
@Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
--- /dev/null
+/**
+ * Copyright (c) 2010-2024 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.boschshc.internal.devices.smokedetector;
+
+import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.CHANNEL_SIGNAL_STRENGTH;
+
+import java.util.List;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.boschshc.internal.devices.AbstractSmokeDetectorHandler;
+import org.openhab.binding.boschshc.internal.exceptions.BoschSHCException;
+import org.openhab.binding.boschshc.internal.services.communicationquality.CommunicationQualityService;
+import org.openhab.binding.boschshc.internal.services.communicationquality.dto.CommunicationQualityServiceState;
+import org.openhab.core.thing.Thing;
+
+/**
+ * The smoke detector 2 warns you in case of fire.
+ *
+ * @author Patrick Gell - Initial contribution
+ */
+@NonNullByDefault
+public class SmokeDetector2Handler extends AbstractSmokeDetectorHandler {
+
+ public SmokeDetector2Handler(Thing thing) {
+ super(thing);
+ }
+
+ @Override
+ protected void initializeServices() throws BoschSHCException {
+ super.initializeServices();
+
+ this.createService(CommunicationQualityService::new, this::updateChannels, List.of(CHANNEL_SIGNAL_STRENGTH),
+ true);
+ }
+
+ private void updateChannels(CommunicationQualityServiceState communicationQualityServiceState) {
+ updateState(CHANNEL_SIGNAL_STRENGTH, communicationQualityServiceState.quality.toSystemSignalStrength());
+ }
+}
new AbstractMap.SimpleEntry<>("SWD2", BoschSHCBindingConstants.THING_TYPE_WINDOW_CONTACT_2),
new AbstractMap.SimpleEntry<>("TRV", BoschSHCBindingConstants.THING_TYPE_THERMOSTAT),
new AbstractMap.SimpleEntry<>("WRC2", BoschSHCBindingConstants.THING_TYPE_UNIVERSAL_SWITCH),
- new AbstractMap.SimpleEntry<>("SWITCH2", BoschSHCBindingConstants.THING_TYPE_UNIVERSAL_SWITCH_2)
+ new AbstractMap.SimpleEntry<>("SWITCH2", BoschSHCBindingConstants.THING_TYPE_UNIVERSAL_SWITCH_2),
+ new AbstractMap.SimpleEntry<>("SMOKE_DETECTOR2", BoschSHCBindingConstants.THING_TYPE_SMOKE_DETECTOR_2)
// Future Extension: map deviceModel names to BoschSHC Thing Types when they are supported
// new AbstractMap.SimpleEntry<>("SMOKE_DETECTION_SYSTEM", BoschSHCBindingConstants.),
// new AbstractMap.SimpleEntry<>("PRESENCE_SIMULATION_SERVICE", BoschSHCBindingConstants.),
thing-type.boschshc.smart-bulb.description = A smart bulb connected via Zigbee.
thing-type.boschshc.smart-plug-compact.label = Compact Smart Plug
thing-type.boschshc.smart-plug-compact.description = A compact smart plug with energy monitoring capabilities.
+thing-type.boschshc.smoke-detector-2.label = Smoke Detector II
+thing-type.boschshc.smoke-detector-2.description = The smoke detector warns you in case of fire.
thing-type.boschshc.smoke-detector.label = Smoke Detector
thing-type.boschshc.smoke-detector.description = The smoke detector warns you in case of fire.
thing-type.boschshc.thermostat.label = Thermostat
<config-description-ref uri="thing-type:boschshc:device"/>
</thing-type>
+ <thing-type id="smoke-detector-2">
+ <supported-bridge-type-refs>
+ <bridge-type-ref id="shc"/>
+ </supported-bridge-type-refs>
+
+ <label>Smoke Detector II</label>
+ <description>The smoke detector warns you in case of fire.</description>
+
+ <channels>
+ <channel id="smoke-check" typeId="smoke-check"/>
+ <channel id="battery-level" typeId="system.battery-level"/>
+ <channel id="low-battery" typeId="system.low-battery"/>
+ <channel id="signal-strength" typeId="system.signal-strength"/>
+ </channels>
+
+ <config-description-ref uri="thing-type:boschshc:device"/>
+ </thing-type>
+
<!-- Channels -->
<channel-type id="system-availability">
--- /dev/null
+/**
+ * Copyright (c) 2010-2024 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.boschshc.internal.devices.smokedetector;
+
+import static org.mockito.Mockito.verify;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.junit.jupiter.api.Test;
+import org.openhab.binding.boschshc.internal.devices.AbstractSmokeDetectorHandlerTest;
+import org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants;
+import org.openhab.core.library.types.DecimalType;
+import org.openhab.core.thing.ChannelUID;
+import org.openhab.core.thing.ThingTypeUID;
+
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+
+/**
+ * Unit Tests for {@link SmokeDetector2Handler}.
+ *
+ * @author Patrick Gell - Initial contribution
+ *
+ */
+@NonNullByDefault
+public class SmokeDetector2HandlerTest extends AbstractSmokeDetectorHandlerTest<SmokeDetector2Handler> {
+
+ @Override
+ protected SmokeDetector2Handler createFixture() {
+ return new SmokeDetector2Handler(getThing());
+ }
+
+ @Override
+ protected String getDeviceID() {
+ return "hdm:ZigBee:70ac08abfe5fe5f9";
+ }
+
+ @Override
+ protected ThingTypeUID getThingTypeUID() {
+ return BoschSHCBindingConstants.THING_TYPE_SMOKE_DETECTOR_2;
+ }
+
+ @Test
+ void testUpdateChannelsCommunicationQualityService() {
+ String json = """
+ {
+ "@type": "communicationQualityState",
+ "quality": "UNKNOWN"
+ }
+ """;
+ JsonElement jsonObject = JsonParser.parseString(json);
+
+ getFixture().processUpdate("CommunicationQuality", jsonObject);
+ verify(getCallback()).stateUpdated(
+ new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_SIGNAL_STRENGTH),
+ new DecimalType(0));
+
+ json = """
+ {
+ "@type": "communicationQualityState",
+ "quality": "NORMAL"
+ }
+ """;
+ jsonObject = JsonParser.parseString(json);
+
+ getFixture().processUpdate("CommunicationQuality", jsonObject);
+ verify(getCallback()).stateUpdated(
+ new ChannelUID(getThing().getUID(), BoschSHCBindingConstants.CHANNEL_SIGNAL_STRENGTH),
+ new DecimalType(3));
+ }
+}