diff --git a/bundles/org.openhab.binding.somfytahoma/README.md b/bundles/org.openhab.binding.somfytahoma/README.md index 771b6e31f..da905c186 100644 --- a/bundles/org.openhab.binding.somfytahoma/README.md +++ b/bundles/org.openhab.binding.somfytahoma/README.md @@ -21,6 +21,7 @@ Any home automation system based on the OverKiz API is potentially supported. - awnings (UP, DOWN, STOP control of an awning). IO Homecontrol devices are allowed to set exact position of an awning (0-100%) - windows (UP, DOWN, STOP control of a window). IO Homecontrol devices are allowed to set exact position of a window (0-100%) - pergolas (UP, DOWN, STOP control of a pergola). IO Homecontrol devices are allowed to set exact position of a pergola (0-100%) +- shutters (OPEN, CLOSE, STOP control of a shutter) - on/off switches (connected by RTS, IO protocol or supported by USB stick - z-wave, enocean, ..) - light switches (similar to on/off) - dimmer lights (light switches with intensity setting) @@ -63,116 +64,116 @@ Please see the example below. ## Channels -| Thing | Channel | Note | -|-------------------------------------------------------------------------------|---------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| bridge | N.A | bridge does not expose any channel | -| gateway | status | status of your gateway | -| gateway | scenarios | used to run the scenarios defined in the cloud portal | -| gate | gate_command | used for controlling your gate (open, close, stop, pedestrian) | -| gate | gate_state | get state of your gate (open, closed, pedestrian) | -| gate | gate_position | get position (0-100%) of your gate (where supported) | -| roller shutter, screen, venetian blind, garage door, awning, pergola, curtain | control | device controller which reacts to commands UP/DOWN/ON/OFF/OPEN/CLOSE/MY/STOP + closure 0-100 | -| window | control | device controller which reacts to commands UP/DOWN/ON/OFF/OPEN/CLOSE/STOP + closure 0-100 | -| silent roller shutter | silent_control | similar to control channel but in silent mode | -| venetian blind, adjustable slats roller shutter, bioclimatic pergola | orientation | percentual orientation of the blind's slats, it can have value 0-100. For IO Homecontrol devices only (non RTS) | -| venetian blind, adjustable slats roller shutter | closure_orientation | percentual closure and orientation of the blind's slats, it can have value 0-100. For IO Homecontrol devices only (non RTS) | -| adjustable slats roller shutter | rocker | used for setting the rocker position of the roller shutter, the only position allowing the slats control | -| bioclimatic pergola | slats | slats state (open/closed) | -| bioclimatic pergola | pergola_command | used for controlling biclimatic pergola (closeSlats, openSlats, stop) | -| action group | execute_action | switch which reacts to ON command and triggers the predefined Tahoma action | -| onoff, light | switch | reacts to standard ON/OFF commands | -| dimmer light | light_intensity | sets/gets intensity of the dimmer light or ON/OFF | -| smoke sensor, occupancy sensor, contact sensor, water sensor & rain sensor | contact | normal value is CLOSE, changes to OPEN when detection triggered | -| smoke sensor, occupancy sensor, contact sensor & water sensor | sensor_defect | indicates the health of the sensor (dead, lowBatter, maintenanceRequired, noDefect) | -| smoke sensor | radio_battery | maintenance radio part battery state (low, normal) | -| smoke sensor | sensor_battery | maintenance sensor part battery state (absence, low, normal) | -| smoke sensor | short_check | triggering the smoke sensor's short check | -| smoke sensor | long_check | triggering the smoke sensor's long check | -| light sensor | luminance | light luminance value in luxes | -| electricity sensor | energy_consumption | energy consumption value in watts | -| humidity sensor | humidity | current relative humidity | -| dock | battery_status | indicates running on battery (yes/no) | -| dock | battery_level | remaining battery percentage | -| dock | siren_status | used for controlling and getting siren state (on, off, cyclic) | -| dock | short_beep | testing of dock's siren - short beep | -| dock | long_beep | testing of dock's siren - long beep | -| siren | battery | battery level full/low/normal/verylow | -| siren | onoff | controlling siren status ON/OFF | -| siren | memorized_volume | setting memorized volume (normal/highest) | -| pod | cyclic_button | pod cyclic button state | -| pod | battery_status | pod battery status state | -| pod | lighting_led_pod_mode | lighting LED pod mod state | -| interior alarm | alarm_command | used for sending commands to Somfy alarm device | -| interior alarm | intrusion_control | used for alarm external intrusion controlling | -| interior alarm, myfox alarm | alarm_state | state of the Somfy alarm | -| interior alarm | target_alarm_state | target state of the Somfy alarm | -| interior alarm, myfox alarm | intrusion_state | intrusion state of the Somfy alarm | -| external alarm | active_zones_state | state of external alarm active zones | -| door lock | lock | switch representing unlocked/locked state | -| door lock | open | switch representing open/close state | -| on/off heating system | target_heating_level | target heating level (off, eco, comfort, frostprotection) | -| heating system | current_temperature | current temperature of the heating system | -| heating system | current_state | current state of the heating system | -| heating system, valve heating system, thermostat | target_temperature | target temperature of the heating system | -| heating system, valve heating system, thermostat | battery_level | battery level of the heating system | -| valve heating system, thermostat | derogation_heating_mode | derogation heating mode of the thermostat (away, freeze, manual, ...) | -| valve heating system, thermostat | derogated_target_temperature | target temperature of the heating system | -| valve heating system | current_heating_mode | current heating mode of the thermostatic valve | -| valve heating system | open_closed_valve | current open/closed state of the thermostatic valve | -| valve heating system | operating mode | operating mode of the thermostatic valve | -| thermostat | heating_mode | standard heating mode of the thermostat (away, freeze, manual, ...) | -| thermostat | derogation_activation | derogation activation state (inactive, active) | -| exterior heating system | heating_level | heating level of the exterior heating system or ON/OFF | -| temperature sensor | temperature | temperature reported by the sensor | -| myfox camera, myfox alarm | cloud_status | cloud connection status | -| myfox camera | shutter | controlling of the camera shutter | -| myfox alarm | myfox_alarm_command | used for sending commands to Somfy Myfox alarm device | -| waterheatersystem | middlewater_temperature | Number:Temperature indicating the temperature of the water at the middle of the heater | -| waterheatersystem | boost_mode | Switch allowing to enable or disable the booster. When switching to ON, by default, the Boost duration will be set for 1 day. | -| waterheatersystem | away_mode | Defines if away mode is On or Off (no water heating) | -| waterheatersystem | away_mode_duration | Defines if away mode the duration in days. | -| waterheatersystem | boost_mode_duration | The duration of the Boost mode in days. Valid from 1 to 7. | -| waterheatersystem | power_heatpump | Current consumption/power of the heatpump in Watts. | -| waterheatersystem | power_heatelec | Current consumption/power of the electric resistance in Watts. | -| waterheatersystem | showers | Virtual channel, representing the number of desired showers - between 3 to 5. It actually switches the desired temperature to 50.0, 54.5 or 62.0 Celcius degrees. Please note that in ECO mode, only 3 and 4 showers are allowed. | -| waterheatersystem | heat_pump_operating_time | Number of hours the heatpump has been operating | -| waterheatersystem | electric_booster_operating_time | number of hours the electric booster has been operating. | -| waterheatersystem | mode | The current mode of the boiler. Can be: autoMode / manualEcoInactive / manualEcoActive | -| waterheatersystem | target_temperature | Water target temperature in degrees. Read only. Temperature desired is managed through mode and showers channels. | -| hitachi (yutaki) air to water heating zone, dhw, main component | alarm_number | error number in case of malfunction | -| hitachi (yutaki) air to water heating zone | circuit_control | controls the air-to-water-component (Run, Stop) | -| hitachi (yutaki) air to water heating zone | circuit_status | actual state of the air-to-water-component (Run, Stop) | -| hitachi (yutaki) air to water heating zone | holiday_mode | switch to activate the holiday mode | -| hitachi (yutaki) air to water heating zone | yutaki_mode | actual mode of the heat pump (Eco, Comfort) | -| hitachi (yutaki) air to water heating zone | yutaki_target_mode | sets the mode of the heat pump (Eco, Comfort) | -| hitachi (yutaki) air to water heating zone | zone_mode | sets the zone mode (Auto, Manual) | -| hitachi (yutaki) domestic hot water | anti_legionella | controls the anti legionella mode (Run, Stop) | -| hitachi (yutaki) domestic hot water | anti_legionella_temp | controls the anti legionella temperature | -| hitachi (yutaki) domestic hot water | target_boost_mode | controls the boost mode (No request, Enabled, Disabled) | -| hitachi (yutaki) domestic hot water | boost_mode | boost mode status (Enabled, Disabled) | -| hitachi (yutaki) domestic hot water | dhw | controls the hot water tank (Run, Stop) | -| hitachi (yutaki) domestic hot water | dhw_mode | controls the dhw mode (Standard, High demand) | -| hitachi (yutaki) domestic hot water | dhw_setting_temp | controls the target temperature for hot water | -| hitachi (yutaki) domestic hot water | dhw_temp | current temperature of hot water | -| hitachi (yutaki) air to water main component | auto_manu_mode | controls auto/manual mode (Auto, Manual) | -| hitachi (yutaki) air to water main component | block_menu_control | controls the block menu (No, Block) | -| hitachi (yutaki) air to water main component | comm_alarm_bit_status | alarm bit status (No, Yes) | -| hitachi (yutaki) air to water main component | compressor_running_current | stage of the current compressor running (0, 0.1, 0.2, 0.3, 0.4) | -| hitachi (yutaki) air to water main component | eco_mode_offset | offset for the ECO-Mode | -| hitachi (yutaki) air to water main component | eco_mode_target_offset | controls the offset for the ECO-Mode (0-10 degrees) | -| hitachi (yutaki) air to water main component | liquid_temp | current liquid temperature | -| hitachi (yutaki) air to water main component | liquid_temp_thmi | current liquid temperature THMI | -| hitachi (yutaki) air to water main component | operation | current operation state (Alarm, Off, Heat/Cool thermo on, Heat/Cool thermo off, DHW off, Heat/Cool demand off, Swp off) | -| hitachi (yutaki) air to water main component | outdoor_temp | current outdoor temperature | -| hitachi (yutaki) air to water main component | space_mode | controls space mode (Eco, Comfort) | -| hitachi (yutaki) air to water main component | unit_control | controls unit (Run, Stop) | -| hitachi (yutaki) air to water main component | unit_mode_control | controls unit mode (Heat, Cool) | -| hitachi (yutaki) air to water main component | unit_mode_status | unit mode state (Heat, Cool) | -| hitachi (yutaki) air to water main component | water_inlet_temp | current water inlet temperature | -| hitachi (yutaki) air to water main component | water_outlet_temp | current water outlet temperature | -| hitachi (yutaki) air to water main component | water_outlet_hp_temp | current water outlet hp temperature | -| hitachi (yutaki) air to water main component | water_temp_setting | target heating water temperature | -| hitachi (yutaki) air to water main component | yutaki_operating_mode | yutaki operating mode (Auto, Holidays, Normal, Timer) | +| Thing | Channel | Note | +|------------------------------------------------------------------------------------|---------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| bridge | N.A | bridge does not expose any channel | +| gateway | status | status of your gateway | +| gateway | scenarios | used to run the scenarios defined in the cloud portal | +| gate | gate_command | used for controlling your gate (open, close, stop, pedestrian) | +| gate | gate_state | get state of your gate (open, closed, pedestrian) | +| gate | gate_position | get position (0-100%) of your gate (where supported) | +| roller shutter, shutter, screen, ven. blind, garage door, awning, pergola, curtain | control | device controller which reacts to commands UP/DOWN/ON/OFF/OPEN/CLOSE/MY/STOP + closure 0-100 | +| window | control | device controller which reacts to commands UP/DOWN/ON/OFF/OPEN/CLOSE/STOP + closure 0-100 | +| silent roller shutter | silent_control | similar to control channel but in silent mode | +| venetian blind, adjustable slats roller shutter, bioclimatic pergola | orientation | percentual orientation of the blind's slats, it can have value 0-100. For IO Homecontrol devices only (non RTS) | +| venetian blind, adjustable slats roller shutter | closure_orientation | percentual closure and orientation of the blind's slats, it can have value 0-100. For IO Homecontrol devices only (non RTS) | +| adjustable slats roller shutter | rocker | used for setting the rocker position of the roller shutter, the only position allowing the slats control | +| bioclimatic pergola | slats | slats state (open/closed) | +| bioclimatic pergola | pergola_command | used for controlling biclimatic pergola (closeSlats, openSlats, stop) | +| action group | execute_action | switch which reacts to ON command and triggers the predefined Tahoma action | +| onoff, light | switch | reacts to standard ON/OFF commands | +| dimmer light | light_intensity | sets/gets intensity of the dimmer light or ON/OFF | +| smoke sensor, occupancy sensor, contact sensor, water sensor & rain sensor | contact | normal value is CLOSE, changes to OPEN when detection triggered | +| smoke sensor, occupancy sensor, contact sensor & water sensor | sensor_defect | indicates the health of the sensor (dead, lowBatter, maintenanceRequired, noDefect) | +| smoke sensor | radio_battery | maintenance radio part battery state (low, normal) | +| smoke sensor | sensor_battery | maintenance sensor part battery state (absence, low, normal) | +| smoke sensor | short_check | triggering the smoke sensor's short check | +| smoke sensor | long_check | triggering the smoke sensor's long check | +| light sensor | luminance | light luminance value in luxes | +| electricity sensor | energy_consumption | energy consumption value in watts | +| humidity sensor | humidity | current relative humidity | +| dock | battery_status | indicates running on battery (yes/no) | +| dock | battery_level | remaining battery percentage | +| dock | siren_status | used for controlling and getting siren state (on, off, cyclic) | +| dock | short_beep | testing of dock's siren - short beep | +| dock | long_beep | testing of dock's siren - long beep | +| siren | battery | battery level full/low/normal/verylow | +| siren | onoff | controlling siren status ON/OFF | +| siren | memorized_volume | setting memorized volume (normal/highest) | +| pod | cyclic_button | pod cyclic button state | +| pod | battery_status | pod battery status state | +| pod | lighting_led_pod_mode | lighting LED pod mod state | +| interior alarm | alarm_command | used for sending commands to Somfy alarm device | +| interior alarm | intrusion_control | used for alarm external intrusion controlling | +| interior alarm, myfox alarm | alarm_state | state of the Somfy alarm | +| interior alarm | target_alarm_state | target state of the Somfy alarm | +| interior alarm, myfox alarm | intrusion_state | intrusion state of the Somfy alarm | +| external alarm | active_zones_state | state of external alarm active zones | +| door lock | lock | switch representing unlocked/locked state | +| door lock | open | switch representing open/close state | +| on/off heating system | target_heating_level | target heating level (off, eco, comfort, frostprotection) | +| heating system | current_temperature | current temperature of the heating system | +| heating system | current_state | current state of the heating system | +| heating system, valve heating system, thermostat | target_temperature | target temperature of the heating system | +| heating system, valve heating system, thermostat | battery_level | battery level of the heating system | +| valve heating system, thermostat | derogation_heating_mode | derogation heating mode of the thermostat (away, freeze, manual, ...) | +| valve heating system, thermostat | derogated_target_temperature | target temperature of the heating system | +| valve heating system | current_heating_mode | current heating mode of the thermostatic valve | +| valve heating system | open_closed_valve | current open/closed state of the thermostatic valve | +| valve heating system | operating mode | operating mode of the thermostatic valve | +| thermostat | heating_mode | standard heating mode of the thermostat (away, freeze, manual, ...) | +| thermostat | derogation_activation | derogation activation state (inactive, active) | +| exterior heating system | heating_level | heating level of the exterior heating system or ON/OFF | +| temperature sensor | temperature | temperature reported by the sensor | +| myfox camera, myfox alarm | cloud_status | cloud connection status | +| myfox camera | shutter | controlling of the camera shutter | +| myfox alarm | myfox_alarm_command | used for sending commands to Somfy Myfox alarm device | +| waterheatersystem | middlewater_temperature | Number:Temperature indicating the temperature of the water at the middle of the heater | +| waterheatersystem | boost_mode | Switch allowing to enable or disable the booster. When switching to ON, by default, the Boost duration will be set for 1 day. | +| waterheatersystem | away_mode | Defines if away mode is On or Off (no water heating) | +| waterheatersystem | away_mode_duration | Defines if away mode the duration in days. | +| waterheatersystem | boost_mode_duration | The duration of the Boost mode in days. Valid from 1 to 7. | +| waterheatersystem | power_heatpump | Current consumption/power of the heatpump in Watts. | +| waterheatersystem | power_heatelec | Current consumption/power of the electric resistance in Watts. | +| waterheatersystem | showers | Virtual channel, representing the number of desired showers - between 3 to 5. It actually switches the desired temperature to 50.0, 54.5 or 62.0 Celcius degrees. Please note that in ECO mode, only 3 and 4 showers are allowed. | +| waterheatersystem | heat_pump_operating_time | Number of hours the heatpump has been operating | +| waterheatersystem | electric_booster_operating_time | number of hours the electric booster has been operating. | +| waterheatersystem | mode | The current mode of the boiler. Can be: autoMode / manualEcoInactive / manualEcoActive | +| waterheatersystem | target_temperature | Water target temperature in degrees. Read only. Temperature desired is managed through mode and showers channels. | +| hitachi (yutaki) air to water heating zone, dhw, main component | alarm_number | error number in case of malfunction | +| hitachi (yutaki) air to water heating zone | circuit_control | controls the air-to-water-component (Run, Stop) | +| hitachi (yutaki) air to water heating zone | circuit_status | actual state of the air-to-water-component (Run, Stop) | +| hitachi (yutaki) air to water heating zone | holiday_mode | switch to activate the holiday mode | +| hitachi (yutaki) air to water heating zone | yutaki_mode | actual mode of the heat pump (Eco, Comfort) | +| hitachi (yutaki) air to water heating zone | yutaki_target_mode | sets the mode of the heat pump (Eco, Comfort) | +| hitachi (yutaki) air to water heating zone | zone_mode | sets the zone mode (Auto, Manual) | +| hitachi (yutaki) domestic hot water | anti_legionella | controls the anti legionella mode (Run, Stop) | +| hitachi (yutaki) domestic hot water | anti_legionella_temp | controls the anti legionella temperature | +| hitachi (yutaki) domestic hot water | target_boost_mode | controls the boost mode (No request, Enabled, Disabled) | +| hitachi (yutaki) domestic hot water | boost_mode | boost mode status (Enabled, Disabled) | +| hitachi (yutaki) domestic hot water | dhw | controls the hot water tank (Run, Stop) | +| hitachi (yutaki) domestic hot water | dhw_mode | controls the dhw mode (Standard, High demand) | +| hitachi (yutaki) domestic hot water | dhw_setting_temp | controls the target temperature for hot water | +| hitachi (yutaki) domestic hot water | dhw_temp | current temperature of hot water | +| hitachi (yutaki) air to water main component | auto_manu_mode | controls auto/manual mode (Auto, Manual) | +| hitachi (yutaki) air to water main component | block_menu_control | controls the block menu (No, Block) | +| hitachi (yutaki) air to water main component | comm_alarm_bit_status | alarm bit status (No, Yes) | +| hitachi (yutaki) air to water main component | compressor_running_current | stage of the current compressor running (0, 0.1, 0.2, 0.3, 0.4) | +| hitachi (yutaki) air to water main component | eco_mode_offset | offset for the ECO-Mode | +| hitachi (yutaki) air to water main component | eco_mode_target_offset | controls the offset for the ECO-Mode (0-10 degrees) | +| hitachi (yutaki) air to water main component | liquid_temp | current liquid temperature | +| hitachi (yutaki) air to water main component | liquid_temp_thmi | current liquid temperature THMI | +| hitachi (yutaki) air to water main component | operation | current operation state (Alarm, Off, Heat/Cool thermo on, Heat/Cool thermo off, DHW off, Heat/Cool demand off, Swp off) | +| hitachi (yutaki) air to water main component | outdoor_temp | current outdoor temperature | +| hitachi (yutaki) air to water main component | space_mode | controls space mode (Eco, Comfort) | +| hitachi (yutaki) air to water main component | unit_control | controls unit (Run, Stop) | +| hitachi (yutaki) air to water main component | unit_mode_control | controls unit mode (Heat, Cool) | +| hitachi (yutaki) air to water main component | unit_mode_status | unit mode state (Heat, Cool) | +| hitachi (yutaki) air to water main component | water_inlet_temp | current water inlet temperature | +| hitachi (yutaki) air to water main component | water_outlet_temp | current water outlet temperature | +| hitachi (yutaki) air to water main component | water_outlet_hp_temp | current water outlet hp temperature | +| hitachi (yutaki) air to water main component | water_temp_setting | target heating water temperature | +| hitachi (yutaki) air to water main component | yutaki_operating_mode | yutaki operating mode (Auto, Holidays, Normal, Timer) | To run a scenario inside a rule for example, the ID of the scenario will be required. You can list all the scenarios IDs with the following console command: `somfytahoma scenarios`. diff --git a/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/SomfyTahomaBindingConstants.java b/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/SomfyTahomaBindingConstants.java index b3350cda4..5f5d19fbd 100644 --- a/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/SomfyTahomaBindingConstants.java +++ b/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/SomfyTahomaBindingConstants.java @@ -50,6 +50,9 @@ public class SomfyTahomaBindingConstants { // Uno Roller Shutter public static final ThingTypeUID THING_TYPE_ROLLERSHUTTER_UNO = new ThingTypeUID(BINDING_ID, "rollershutter_uno"); + // Shutter + public static final ThingTypeUID THING_TYPE_SHUTTER = new ThingTypeUID(BINDING_ID, "shutter"); + // Screen public static final ThingTypeUID THING_TYPE_SCREEN = new ThingTypeUID(BINDING_ID, "screen"); @@ -182,7 +185,7 @@ public class SomfyTahomaBindingConstants { public static final String STATUS = "status"; public static final String SCENARIOS = "scenarios"; - // Roller shutter, Awning, Screen, Blind, Garage door, Window, Curtain + // Roller shutter, Shutter, Awning, Screen, Blind, Garage door, Window, Curtain public static final String CONTROL = "control"; // Adjustable slats roller shutter @@ -445,6 +448,7 @@ public class SomfyTahomaBindingConstants { // supported uiClasses public static final String CLASS_ROLLER_SHUTTER = "RollerShutter"; + public static final String CLASS_SHUTTER = "Shutter"; public static final String CLASS_SCREEN = "Screen"; public static final String CLASS_VENETIAN_BLIND = "VenetianBlind"; public static final String CLASS_EXTERIOR_SCREEN = "ExteriorScreen"; @@ -501,7 +505,7 @@ public class SomfyTahomaBindingConstants { THING_TYPE_WATERSENSOR, THING_TYPE_HUMIDITYSENSOR, THING_TYPE_MYFOX_ALARM, THING_TYPE_THERMOSTAT, THING_TYPE_DIMMER_LIGHT, THING_TYPE_EXTERIOR_HEATING_SYSTEM, THING_TYPE_VALVE_HEATING_SYSTEM, THING_TYPE_BIOCLIMATIC_PERGOLA, THING_TYPE_WATERHEATINGSYSTEM, THING_TYPE_HITACHI_ATWHZ, - THING_TYPE_HITACHI_DHW, THING_TYPE_HITACHI_ATWMC, THING_TYPE_RAINSENSOR)); + THING_TYPE_HITACHI_DHW, THING_TYPE_HITACHI_ATWMC, THING_TYPE_RAINSENSOR, THING_TYPE_SHUTTER)); // somfy gateways public static Map gatewayTypes = new HashMap() { diff --git a/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/SomfyTahomaHandlerFactory.java b/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/SomfyTahomaHandlerFactory.java index 1d3a1648a..0b1712031 100644 --- a/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/SomfyTahomaHandlerFactory.java +++ b/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/SomfyTahomaHandlerFactory.java @@ -46,6 +46,7 @@ import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaPergolaHandle import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaPodHandler; import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaRainSensorHandler; import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaRollerShutterHandler; +import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaShutterHandler; import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaSilentRollerShutterHandler; import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaSirenHandler; import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaSmokeSensorHandler; @@ -118,6 +119,8 @@ public class SomfyTahomaHandlerFactory extends BaseThingHandlerFactory { return new SomfyTahomaUnoRollerShutterHandler(thing); } else if (thingTypeUID.equals(THING_TYPE_SCREEN) || thingTypeUID.equals(THING_TYPE_EXTERIORSCREEN)) { return new SomfyTahomaRollerShutterHandler(thing); + } else if (thingTypeUID.equals(THING_TYPE_SHUTTER)) { + return new SomfyTahomaShutterHandler(thing); } else if (thingTypeUID.equals(THING_TYPE_VENETIANBLIND) || thingTypeUID.equals(THING_TYPE_EXTERIORVENETIANBLIND)) { return new SomfyTahomaVenetianBlindHandler(thing); diff --git a/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/discovery/SomfyTahomaItemDiscoveryService.java b/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/discovery/SomfyTahomaItemDiscoveryService.java index 7550d266c..f907a5cd3 100644 --- a/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/discovery/SomfyTahomaItemDiscoveryService.java +++ b/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/discovery/SomfyTahomaItemDiscoveryService.java @@ -213,6 +213,10 @@ public class SomfyTahomaItemDiscoveryService extends AbstractDiscoveryService deviceDiscovered(device, THING_TYPE_ROLLERSHUTTER, place); } break; + case CLASS_SHUTTER: + // widget: DynamicShutter + deviceDiscovered(device, THING_TYPE_SHUTTER, place); + break; case CLASS_SCREEN: // widget: PositionableTiltedScreen deviceDiscovered(device, THING_TYPE_SCREEN, place); @@ -223,7 +227,12 @@ public class SomfyTahomaItemDiscoveryService extends AbstractDiscoveryService break; case CLASS_VENETIAN_BLIND: // widget: DynamicVenetianBlind - deviceDiscovered(device, THING_TYPE_VENETIANBLIND, place); + if (hasCommmand(device, "setOrientation")) { + deviceDiscovered(device, THING_TYPE_VENETIANBLIND, place); + } else { + // simple venetian blind without orientation + deviceDiscovered(device, THING_TYPE_SHUTTER, place); + } break; case CLASS_WINDOW: // widget: PositionableTiltedWindow diff --git a/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/handler/SomfyTahomaShutterHandler.java b/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/handler/SomfyTahomaShutterHandler.java new file mode 100644 index 000000000..a3efe900f --- /dev/null +++ b/bundles/org.openhab.binding.somfytahoma/src/main/java/org/openhab/binding/somfytahoma/internal/handler/SomfyTahomaShutterHandler.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2010-2022 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.somfytahoma.internal.handler; + +import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; +import org.openhab.core.library.types.DecimalType; +import org.openhab.core.thing.ChannelUID; +import org.openhab.core.thing.Thing; +import org.openhab.core.types.Command; +import org.openhab.core.types.RefreshType; + +/** + * The {@link SomfyTahomaShutterHandler} is responsible for handling commands, + * which are sent to one of the channels of the shutter thing. + * + * @author Ondrej Pecta - Initial contribution + */ +@NonNullByDefault +public class SomfyTahomaShutterHandler extends SomfyTahomaBaseThingHandler { + + public SomfyTahomaShutterHandler(Thing thing) { + super(thing); + } + + @Override + public void handleCommand(ChannelUID channelUID, Command command) { + super.handleCommand(channelUID, command); + if (!CONTROL.equals(channelUID.getId())) { + return; + } + + if (command instanceof RefreshType) { + return; + } else { + if (command instanceof DecimalType) { + sendCommand(toInteger(command) == 0 ? COMMAND_OPEN : COMMAND_CLOSE); + } else { + // Shutter understands "open", "close" and "stop" commands + String cmd = getTahomaCommand(command.toString()); + if (cmd != null) { + sendCommand(cmd); + } else { + getLogger().debug("unsupported command: {}", command); + } + } + } + } + + private @Nullable String getTahomaCommand(String command) { + switch (command) { + case "OFF": + case "DOWN": + case "CLOSE": + return COMMAND_CLOSE; + case "ON": + case "UP": + case "OPEN": + return COMMAND_OPEN; + case "STOP": + return COMMAND_STOP; + default: + return null; + } + } +} diff --git a/bundles/org.openhab.binding.somfytahoma/src/main/resources/OH-INF/i18n/somfytahoma.properties b/bundles/org.openhab.binding.somfytahoma/src/main/resources/OH-INF/i18n/somfytahoma.properties index a1bfd983e..3f6fa5681 100644 --- a/bundles/org.openhab.binding.somfytahoma/src/main/resources/OH-INF/i18n/somfytahoma.properties +++ b/bundles/org.openhab.binding.somfytahoma/src/main/resources/OH-INF/i18n/somfytahoma.properties @@ -45,6 +45,7 @@ thing-type.somfytahoma.rollershutter.label = Somfy Roller Shutter thing-type.somfytahoma.rollershutter_silent.label = Somfy Silent Roller Shutter thing-type.somfytahoma.rollershutter_uno.label = Somfy Roller Shutter Uno thing-type.somfytahoma.screen.label = Somfy Screen +thing-type.somfytahoma.shutter.label = Somfy Shutter thing-type.somfytahoma.siren.label = Somfy Siren thing-type.somfytahoma.smokesensor.label = Somfy Smoke Sensor thing-type.somfytahoma.temperaturesensor.label = Somfy Temperature Sensor diff --git a/bundles/org.openhab.binding.somfytahoma/src/main/resources/OH-INF/thing/shutter.xml b/bundles/org.openhab.binding.somfytahoma/src/main/resources/OH-INF/thing/shutter.xml new file mode 100644 index 000000000..e4b8d1a63 --- /dev/null +++ b/bundles/org.openhab.binding.somfytahoma/src/main/resources/OH-INF/thing/shutter.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + url + + + +