Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[somfytahoma] bug fixes for the V2 API #6699

Merged
merged 15 commits into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 58 additions & 40 deletions bundles/org.openhab.binding.somfytahoma/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public class SomfyTahomaBindingConstants {
public static final ThingTypeUID THING_TYPE_ROLLERSHUTTER_SILENT = new ThingTypeUID(BINDING_ID,
"rollershutter_silent");

// Uno Roller Shutter
public static final ThingTypeUID THING_TYPE_ROLLERSHUTTER_UNO = new ThingTypeUID(BINDING_ID,
"rollershutter_uno");

// Screen
public static final ThingTypeUID THING_TYPE_SCREEN = new ThingTypeUID(BINDING_ID, "screen");

Expand Down Expand Up @@ -82,12 +86,19 @@ public class SomfyTahomaBindingConstants {
// Occupancy sensor
public static final ThingTypeUID THING_TYPE_OCCUPANCYSENSOR = new ThingTypeUID(BINDING_ID, "occupancysensor");

// Water sensor
public static final ThingTypeUID THING_TYPE_WATERSENSOR = new ThingTypeUID(BINDING_ID, "watersensor");

// Humidity sensor
public static final ThingTypeUID THING_TYPE_HUMIDITYSENSOR = new ThingTypeUID(BINDING_ID, "humiditysensor");

// Window
public static final ThingTypeUID THING_TYPE_WINDOW = new ThingTypeUID(BINDING_ID, "window");

// Alarm
public static final ThingTypeUID THING_TYPE_INTERNAL_ALARM = new ThingTypeUID(BINDING_ID, "internalalarm");
public static final ThingTypeUID THING_TYPE_EXTERNAL_ALARM = new ThingTypeUID(BINDING_ID, "externalalarm");
public static final ThingTypeUID THING_TYPE_MYFOX_ALARM = new ThingTypeUID(BINDING_ID, "myfoxalarm");

// Pod
public static final ThingTypeUID THING_TYPE_POD = new ThingTypeUID(BINDING_ID, "pod");
Expand Down Expand Up @@ -126,6 +137,12 @@ public class SomfyTahomaBindingConstants {
// Adjustable slats roller shutter
public static final ThingTypeUID THING_TYPE_ADJUSTABLE_SLATS_ROLLERSHUTTER = new ThingTypeUID(BINDING_ID, "adjustableslatsrollershutter");

// MyFox Camera
public static final ThingTypeUID THING_TYPE_MYFOX_CAMERA = new ThingTypeUID(BINDING_ID, "myfoxcamera");

// Thermostat
public static final ThingTypeUID THING_TYPE_THERMOSTAT = new ThingTypeUID(BINDING_ID, "thermostat");

// List of all Channel ids
// Gateway
public static final String STATUS = "status";
Expand All @@ -152,9 +169,12 @@ public class SomfyTahomaBindingConstants {
public static final String LOCK = "lock";
public static final String OPEN = "open";

// Smoke sensor, Occupancy sensor, Contact sensor
// Smoke sensor, Occupancy sensor, Contact sensor, Water sensor
public static final String CONTACT = "contact";

// Humidity sensor
public static final String HUMIDITY = "humidity";

// Smoke sensor
public static final String ALARM_CHECK = "alarm_check";

Expand Down Expand Up @@ -182,6 +202,11 @@ public class SomfyTahomaBindingConstants {
public static final String BATTERY_LEVEL = "battery_level";
public static final String TARGET_HEATING_LEVEL = "target_heating_level";

// Thermostat
public static final String HEATING_MODE = "heating_mode";
public static final String DEROGATION_HEATING_MODE = "derogation_heating_mode";
public static final String DEROGATION_ACTIVATION = "derogation_activation";

// Window handle
public static final String HANDLE_STATE = "handle_state";

Expand All @@ -203,11 +228,22 @@ public class SomfyTahomaBindingConstants {
public static final String ONOFF_STATE = "onoff";
public static final String BATTERY = "battery";

//Constants
// Myfox Alarm
public static final String MYFOX_ALARM_COMMAND = "myfox_alarm_command";

// Myfox Alarm & Camera
public static final String CLOUD_STATUS = "cloud_status";

// Myfox Camera
public static final String SHUTTER = "shutter";

// Constants
public static final String TAHOMA_API_URL = "https://www.tahomalink.com/enduser-mobile-web/enduserAPI/";
public static final String TAHOMA_EVENTS_URL = TAHOMA_API_URL + "events/";
public static final String SETUP_URL = TAHOMA_API_URL + "setup/gateways/";
public static final String REFRESH_URL = TAHOMA_API_URL + "setup/devices/states/refresh";
public static final String SETUP_URL = TAHOMA_API_URL + "setup/";
public static final String GATEWAYS_URL = SETUP_URL + "gateways/";
public static final String DEVICES_URL = SETUP_URL + "devices/";
public static final String REFRESH_URL = DEVICES_URL + "states/refresh";
public static final String EXEC_URL = TAHOMA_API_URL + "exec/";
public static final String DELETE_URL = EXEC_URL + "current/setup/";
public static final String TAHOMA_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36";
Expand All @@ -217,6 +253,13 @@ public class SomfyTahomaBindingConstants {
public static final int TYPE_DECIMAL = 2;
public static final int TYPE_STRING = 3;
public static final int TYPE_BOOLEAN = 6;
public static final String UNAVAILABLE = "unavailable";
public static final String AUTHENTICATION_CHALLENGE = "HTTP protocol violation: Authentication challenge without WWW-Authenticate header";
public static final String TOO_MANY_REQUESTS = "Too many requests, try again later";
public static final int SUSPEND_TIME = 120;
public static final int RECONCILIATION_TIME = 600;

// Commands
public static final String COMMAND_MY = "my";
public static final String COMMAND_SET_CLOSURE = "setClosure";
public static final String COMMAND_SET_DEPLOYMENT = "setDeployment";
Expand All @@ -232,51 +275,61 @@ public class SomfyTahomaBindingConstants {
public static final String COMMAND_STOP = "stop";
public static final String COMMAND_OFF = "off";
public static final String COMMAND_CHECK_TRIGGER = "checkEventTrigger";

// States
public static final String STATUS_STATE = "core:StatusState";
public static final String ENERGY_CONSUMPTION_STATE = "core:ElectricEnergyConsumptionState";
public static final String CYCLIC_BUTTON_STATE = "core:CyclicButtonState";
public static final String BATTERY_STATUS_STATE = "internal:BatteryStatusState";
public static final String UNAVAILABLE = "unavailable";
public static final String AUTHENTICATION_CHALLENGE = "HTTP protocol violation: Authentication challenge without WWW-Authenticate header";
public static final String TOO_MANY_REQUESTS = "Too many requests, try again later";
public static final int SUSPEND_TIME = 120;
public static final String SLATE_ORIENTATION_STATE = "core:SlateOrientationState";
public static final String CLOSURE_OR_ROCKER_STATE = "core:ClosureOrRockerPositionState";
public static final String MYFOX_SHUTTER_STATUS_STATE = "myfox:ShutterStatusState";
public static final String TARGET_CLOSURE_STATE = "core:TargetClosureState";
public static final String WATER_DETECTION_STATE = "core:WaterDetectionState";
public static final String CLOUD_DEVICE_STATUS_STATE = "core:CloudDeviceStatusState";
public static final String BATTERY_LEVEL_STATE = "core:BatteryLevelState";
public static final String SIREN_STATUS_STATE = "internal:SirenStatusState";
public static final String TARGET_TEMPERATURE_STATE = "core:TargetTemperatureState";

// supported uiClasses
public static final String THING_ROLLER_SHUTTER = "RollerShutter";
public static final String THING_SCREEN = "Screen";
public static final String THING_VENETIAN_BLIND = "VenetianBlind";
public static final String THING_EXTERIOR_SCREEN = "ExteriorScreen";
public static final String THING_EXTERIOR_VENETIAN_BLIND = "ExteriorVenetianBlind";
public static final String THING_GARAGE_DOOR = "GarageDoor";
public static final String THING_AWNING = "Awning";
public static final String THING_ON_OFF = "OnOff";
public static final String THING_LIGHT = "Light";
public static final String THING_LIGHT_SENSOR = "LightSensor";
public static final String THING_SMOKE_SENSOR = "SmokeSensor";
public static final String THING_CONTACT_SENSOR = "ContactSensor";
public static final String THING_OCCUPANCY_SENSOR = "OccupancySensor";
public static final String THING_WINDOW = "Window";
public static final String THING_ALARM = "Alarm";
public static final String THING_POD = "Pod";
public static final String THING_HEATING_SYSTEM = "HeatingSystem";
public static final String THING_DOOR_LOCK = "DoorLock";
public static final String THING_PERGOLA = "Pergola";
public static final String THING_WINDOW_HANDLE = "WindowHandle";
public static final String THING_TEMPERATURE_SENSOR = "TemperatureSensor";
public static final String THING_GATE = "Gate";
public static final String THING_CURTAIN = "Curtain";
public static final String THING_ELECTRICITY_SENSOR = "ElectricitySensor";
public static final String THING_DOCK = "Dock";
public static final String THING_SIREN = "Siren";
public static final String THING_ADJUSTABLE_SLATS_ROLLER_SHUTTER = "AdjustableSlatsRollerShutter";
public static final String CLASS_ROLLER_SHUTTER = "RollerShutter";
public static final String CLASS_SCREEN = "Screen";
public static final String CLASS_VENETIAN_BLIND = "VenetianBlind";
public static final String CLASS_EXTERIOR_SCREEN = "ExteriorScreen";
public static final String CLASS_EXTERIOR_VENETIAN_BLIND = "ExteriorVenetianBlind";
public static final String CLASS_GARAGE_DOOR = "GarageDoor";
public static final String CLASS_AWNING = "Awning";
public static final String CLASS_ON_OFF = "OnOff";
public static final String CLASS_LIGHT = "Light";
public static final String CLASS_LIGHT_SENSOR = "LightSensor";
public static final String CLASS_SMOKE_SENSOR = "SmokeSensor";
public static final String CLASS_CONTACT_SENSOR = "ContactSensor";
public static final String CLASS_OCCUPANCY_SENSOR = "OccupancySensor";
public static final String CLASS_HUMIDITY_SENSOR = "HumiditySensor";
public static final String CLASS_WINDOW = "Window";
public static final String CLASS_ALARM = "Alarm";
public static final String CLASS_POD = "Pod";
public static final String CLASS_HEATING_SYSTEM = "HeatingSystem";
public static final String CLASS_DOOR_LOCK = "DoorLock";
public static final String CLASS_PERGOLA = "Pergola";
public static final String CLASS_WINDOW_HANDLE = "WindowHandle";
public static final String CLASS_TEMPERATURE_SENSOR = "TemperatureSensor";
public static final String CLASS_GATE = "Gate";
public static final String CLASS_CURTAIN = "Curtain";
public static final String CLASS_ELECTRICITY_SENSOR = "ElectricitySensor";
public static final String CLASS_DOCK = "Dock";
public static final String CLASS_SIREN = "Siren";
public static final String CLASS_ADJUSTABLE_SLATS_ROLLER_SHUTTER = "AdjustableSlatsRollerShutter";
public static final String CLASS_CAMERA = "Camera";

// unsupported uiClasses
public static final String THING_PROTOCOL_GATEWAY = "ProtocolGateway";
public static final String THING_REMOTE_CONTROLLER = "RemoteController";
public static final String THING_NETWORK_COMPONENT = "NetworkComponent";

// cache timeout
public static final int CACHE_EXPIRY = 10000;
// Event states
public static final String FAILED_EVENT = "FAILED";
public static final String COMPLETED_EVENT = "COMPLETED";

// supported thing types for discovery
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<>(Arrays.asList(
Expand All @@ -287,7 +340,9 @@ public class SomfyTahomaBindingConstants {
THING_TYPE_WINDOW, THING_TYPE_INTERNAL_ALARM, THING_TYPE_EXTERNAL_ALARM, THING_TYPE_POD,
THING_TYPE_HEATING_SYSTEM, THING_TYPE_ONOFF_HEATING_SYSTEM, THING_TYPE_DOOR_LOCK, THING_TYPE_PERGOLA,
THING_TYPE_WINDOW_HANDLE, THING_TYPE_TEMPERATURESENSOR, THING_TYPE_GATE, THING_TYPE_CURTAIN,
THING_TYPE_ELECTRICITYSENSOR, THING_TYPE_DOCK, THING_TYPE_SIREN, THING_TYPE_ADJUSTABLE_SLATS_ROLLERSHUTTER));
THING_TYPE_ELECTRICITYSENSOR, THING_TYPE_DOCK, THING_TYPE_SIREN, THING_TYPE_ADJUSTABLE_SLATS_ROLLERSHUTTER,
THING_TYPE_MYFOX_CAMERA, THING_TYPE_ROLLERSHUTTER_UNO, THING_TYPE_WATERSENSOR, THING_TYPE_HUMIDITYSENSOR,
THING_TYPE_MYFOX_ALARM, THING_TYPE_THERMOSTAT));

//somfy gateways
public static Map<Integer, String> gatewayTypes = new HashMap<Integer, String>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ protected ThingHandler createHandler(Thing thing) {
return new SomfyTahomaRollerShutterHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_ROLLERSHUTTER_SILENT)) {
return new SomfyTahomaSilentRollerShutterHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_ROLLERSHUTTER_UNO)) {
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_VENETIANBLIND) || thingTypeUID.equals(THING_TYPE_EXTERIORVENETIANBLIND)) {
Expand All @@ -104,6 +106,10 @@ protected ThingHandler createHandler(Thing thing) {
return new SomfyTahomaOccupancySensorHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_CONTACTSENSOR)) {
return new SomfyTahomaContactSensorHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_WATERSENSOR)) {
return new SomfyTahomaWaterSensorHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_HUMIDITYSENSOR)) {
return new SomfyTahomaHumiditySensorHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_WINDOW)) {
return new SomfyTahomaWindowHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_INTERNAL_ALARM)) {
Expand All @@ -126,7 +132,7 @@ protected ThingHandler createHandler(Thing thing) {
return new SomfyTahomaTemperatureSensorHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_GATE)) {
return new SomfyTahomaGateHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_CURTAIN)){
} else if (thingTypeUID.equals(THING_TYPE_CURTAIN)) {
return new SomfyTahomaCurtainHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_ELECTRICITYSENSOR)) {
return new SomfyTahomaElectricitySensorHandler(thing);
Expand All @@ -136,7 +142,13 @@ protected ThingHandler createHandler(Thing thing) {
return new SomfyTahomaSirenHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_ADJUSTABLE_SLATS_ROLLERSHUTTER)) {
return new SomfyTahomaAdjustableSlatsRollerShutterHandler(thing);
}else {
} else if (thingTypeUID.equals(THING_TYPE_MYFOX_CAMERA)) {
return new SomfyTahomaMyfoxCameraHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_MYFOX_ALARM)) {
return new SomfyTahomaMyfoxAlarmHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_THERMOSTAT)) {
return new SomfyTahomaThermostatHandler(thing);
} else {
return null;
}
}
Expand Down
Loading