diff --git a/.homeycompose/flow/actions/send_command_boolean.json b/.homeycompose/flow/actions/send_command_boolean.json index 9e8c2f68..f3175dfd 100644 --- a/.homeycompose/flow/actions/send_command_boolean.json +++ b/.homeycompose/flow/actions/send_command_boolean.json @@ -13,7 +13,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" diff --git a/.homeycompose/flow/actions/send_command_json.json b/.homeycompose/flow/actions/send_command_json.json index e3e0b0e5..22c1bd5f 100644 --- a/.homeycompose/flow/actions/send_command_json.json +++ b/.homeycompose/flow/actions/send_command_json.json @@ -13,7 +13,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" diff --git a/.homeycompose/flow/actions/send_command_number.json b/.homeycompose/flow/actions/send_command_number.json index c95022bc..57b3c985 100644 --- a/.homeycompose/flow/actions/send_command_number.json +++ b/.homeycompose/flow/actions/send_command_number.json @@ -13,7 +13,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" diff --git a/.homeycompose/flow/actions/send_command_string.json b/.homeycompose/flow/actions/send_command_string.json index ef1641df..2951d510 100644 --- a/.homeycompose/flow/actions/send_command_string.json +++ b/.homeycompose/flow/actions/send_command_string.json @@ -13,7 +13,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" diff --git a/.homeycompose/flow/triggers/receive_status_boolean.json b/.homeycompose/flow/triggers/receive_status_boolean.json index 0d497419..a5bc18f6 100644 --- a/.homeycompose/flow/triggers/receive_status_boolean.json +++ b/.homeycompose/flow/triggers/receive_status_boolean.json @@ -13,7 +13,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" diff --git a/.homeycompose/flow/triggers/receive_status_json.json b/.homeycompose/flow/triggers/receive_status_json.json index 12bfae8d..b3f7f06c 100644 --- a/.homeycompose/flow/triggers/receive_status_json.json +++ b/.homeycompose/flow/triggers/receive_status_json.json @@ -13,7 +13,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" diff --git a/.homeycompose/flow/triggers/receive_status_number.json b/.homeycompose/flow/triggers/receive_status_number.json index 867dcfed..590d18b1 100644 --- a/.homeycompose/flow/triggers/receive_status_number.json +++ b/.homeycompose/flow/triggers/receive_status_number.json @@ -13,7 +13,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" diff --git a/.homeycompose/flow/triggers/receive_status_string.json b/.homeycompose/flow/triggers/receive_status_string.json index 92cd940b..60e8dcf1 100644 --- a/.homeycompose/flow/triggers/receive_status_string.json +++ b/.homeycompose/flow/triggers/receive_status_string.json @@ -13,7 +13,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" diff --git a/app.json b/app.json index 31501364..f0d4a12d 100644 --- a/app.json +++ b/app.json @@ -438,7 +438,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" @@ -479,7 +479,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" @@ -520,7 +520,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" @@ -561,7 +561,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" @@ -1311,7 +1311,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" @@ -1349,7 +1349,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" @@ -1387,7 +1387,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" @@ -1425,7 +1425,7 @@ "name": "device", "type": "device", "filter": { - "driver_id": "button|camera|circuit_breaker|curtain|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat" + "driver_id": "button|camera|circuit_breaker|dimmer|doorbell|fan|garage_door|heater|irrigator|light|other|sensor_climate|sensor_contact|sensor_human|sensor_motion|sensor_smoke|siren|socket|thermostat|window_coverings" }, "title": { "en": "Device" @@ -3440,88 +3440,6 @@ } ] }, - { - "capabilities": [ - "windowcoverings_state", - "windowcoverings_set" - ], - "connectivity": [ - "cloud" - ], - "platforms": [ - "local", - "cloud" - ], - "images": { - "small": "/drivers/curtain/assets/images/small.png", - "large": "/drivers/curtain/assets/images/large.png", - "xlarge": "/drivers/curtain/assets/images/xlarge.png" - }, - "pair": [ - { - "id": "welcome", - "navigation": { - "next": "login_oauth2" - } - }, - { - "id": "login_oauth2", - "template": "login_oauth2" - }, - { - "id": "list_devices", - "template": "list_devices", - "navigation": { - "next": "add_devices" - } - }, - { - "id": "add_devices", - "template": "add_devices" - } - ], - "repair": [ - { - "id": "login_oauth2", - "template": "login_oauth2" - } - ], - "class": "curtain", - "name": { - "en": "Curtain", - "nl": "Gordijn" - }, - "id": "curtain", - "settings": [ - { - "type": "group", - "label": { - "en": "NOTE: Some settings are not supported by every device." - }, - "children": [ - { - "id": "inverse", - "type": "checkbox", - "label": { - "en": "Inverse direction" - }, - "value": false - } - ] - }, - { - "id": "deviceSpecification", - "type": "label", - "label": { - "en": "Device Specification" - }, - "hint": { - "en": "The Tuya specification of this device" - }, - "value": "" - } - ] - }, { "capabilities": [ "onoff", @@ -6235,6 +6153,88 @@ "value": "" } ] + }, + { + "capabilities": [ + "windowcoverings_state", + "windowcoverings_set" + ], + "connectivity": [ + "cloud" + ], + "platforms": [ + "local", + "cloud" + ], + "images": { + "small": "/drivers/window_coverings/assets/images/small.png", + "large": "/drivers/window_coverings/assets/images/large.png", + "xlarge": "/drivers/window_coverings/assets/images/xlarge.png" + }, + "pair": [ + { + "id": "welcome", + "navigation": { + "next": "login_oauth2" + } + }, + { + "id": "login_oauth2", + "template": "login_oauth2" + }, + { + "id": "list_devices", + "template": "list_devices", + "navigation": { + "next": "add_devices" + } + }, + { + "id": "add_devices", + "template": "add_devices" + } + ], + "repair": [ + { + "id": "login_oauth2", + "template": "login_oauth2" + } + ], + "class": "windowcoverings", + "name": { + "en": "Window coverings", + "nl": "Raambekleding" + }, + "id": "window_coverings", + "settings": [ + { + "type": "group", + "label": { + "en": "NOTE: Some settings are not supported by every device." + }, + "children": [ + { + "id": "inverse", + "type": "checkbox", + "label": { + "en": "Inverse direction" + }, + "value": false + } + ] + }, + { + "id": "deviceSpecification", + "type": "label", + "label": { + "en": "Device Specification" + }, + "hint": { + "en": "The Tuya specification of this device" + }, + "value": "" + } + ] } ], "capabilities": { diff --git a/drivers/curtain/TuyaCurtainConstants.ts b/drivers/window_coverings/TuyaWindowCoveringsConstants.ts similarity index 66% rename from drivers/curtain/TuyaCurtainConstants.ts rename to drivers/window_coverings/TuyaWindowCoveringsConstants.ts index 5c506554..22bd9845 100644 --- a/drivers/curtain/TuyaCurtainConstants.ts +++ b/drivers/window_coverings/TuyaWindowCoveringsConstants.ts @@ -1,6 +1,6 @@ import TRANSLATIONS from './translations.json'; -export const CURTAIN_CAPABILITY_MAPPING = { +export const WINDOW_COVERINGS_CAPABILITY_MAPPING = { control: 'windowcoverings_state', mach_operate: 'windowcoverings_state', position: 'windowcoverings_set', @@ -8,19 +8,19 @@ export const CURTAIN_CAPABILITY_MAPPING = { percent_state: 'windowcoverings_set', } as const; -export const CURTAIN_CAPABILITIES = { +export const WINDOW_COVERINGS_CAPABILITIES = { read_write: ['control', 'position', 'mach_operate', 'percent_control'], setting: ['opposite', 'control_back'], } as const; -export type HomeyCurtainSettings = { +export type HomeyWindowCoveringsSettings = { inverse: boolean; }; -export type TuyaCurtainSettings = { +export type TuyaWindowCoveringsSettings = { opposite: boolean; // inverse control_back: boolean; // inverse control_back_mode: 'forward' | 'back'; // inverse }; -export const CURTAIN_SETTING_LABELS = TRANSLATIONS.setting_labels; +export const WINDOW_COVERINGS_SETTING_LABELS = TRANSLATIONS.setting_labels; diff --git a/drivers/curtain/assets/icon.svg b/drivers/window_coverings/assets/icon.svg similarity index 100% rename from drivers/curtain/assets/icon.svg rename to drivers/window_coverings/assets/icon.svg diff --git a/drivers/curtain/assets/images/large.png b/drivers/window_coverings/assets/images/large.png similarity index 100% rename from drivers/curtain/assets/images/large.png rename to drivers/window_coverings/assets/images/large.png diff --git a/drivers/curtain/assets/images/small.png b/drivers/window_coverings/assets/images/small.png similarity index 100% rename from drivers/curtain/assets/images/small.png rename to drivers/window_coverings/assets/images/small.png diff --git a/drivers/curtain/assets/images/xlarge.png b/drivers/window_coverings/assets/images/xlarge.png similarity index 100% rename from drivers/curtain/assets/images/xlarge.png rename to drivers/window_coverings/assets/images/xlarge.png diff --git a/drivers/curtain/device.ts b/drivers/window_coverings/device.ts similarity index 84% rename from drivers/curtain/device.ts rename to drivers/window_coverings/device.ts index d04f6a75..64c6c227 100644 --- a/drivers/curtain/device.ts +++ b/drivers/window_coverings/device.ts @@ -3,13 +3,13 @@ import { getFromMap } from '../../lib/TuyaOAuth2Util'; import * as TuyaOAuth2Util from '../../lib/TuyaOAuth2Util'; import { SettingsEvent, TuyaStatus } from '../../types/TuyaTypes'; import { - CURTAIN_CAPABILITY_MAPPING, - CURTAIN_SETTING_LABELS, - HomeyCurtainSettings, - TuyaCurtainSettings, -} from './TuyaCurtainConstants'; + WINDOW_COVERINGS_CAPABILITY_MAPPING, + WINDOW_COVERINGS_SETTING_LABELS, + HomeyWindowCoveringsSettings, + TuyaWindowCoveringsSettings, +} from './TuyaWindowCoveringsConstants'; -module.exports = class TuyaOAuth2DeviceCurtain extends TuyaOAuth2Device { +module.exports = class TuyaOAuth2DeviceWindowCoverings extends TuyaOAuth2Device { async onOAuth2Init(): Promise { await super.onOAuth2Init(); @@ -50,7 +50,7 @@ module.exports = class TuyaOAuth2DeviceCurtain extends TuyaOAuth2Device { for (const tuyaCapability in status) { const value = status[tuyaCapability]; - const homeyCapability = getFromMap(CURTAIN_CAPABILITY_MAPPING, tuyaCapability); + const homeyCapability = getFromMap(WINDOW_COVERINGS_CAPABILITY_MAPPING, tuyaCapability); if (['control', 'mach_operate'].includes(tuyaCapability) && homeyCapability) { let mappedValue; @@ -82,8 +82,8 @@ module.exports = class TuyaOAuth2DeviceCurtain extends TuyaOAuth2Device { } } - async onSettings(event: SettingsEvent): Promise { - const tuyaSettings: SettingsEvent> = { + async onSettings(event: SettingsEvent): Promise { + const tuyaSettings: SettingsEvent> = { newSettings: {}, oldSettings: {}, changedKeys: [], @@ -102,6 +102,6 @@ module.exports = class TuyaOAuth2DeviceCurtain extends TuyaOAuth2Device { } } - return TuyaOAuth2Util.onSettings(this, tuyaSettings, CURTAIN_SETTING_LABELS); + return TuyaOAuth2Util.onSettings(this, tuyaSettings, WINDOW_COVERINGS_SETTING_LABELS); } }; diff --git a/drivers/curtain/driver.compose.json b/drivers/window_coverings/driver.compose.json similarity index 56% rename from drivers/curtain/driver.compose.json rename to drivers/window_coverings/driver.compose.json index 965d8980..4ad71636 100644 --- a/drivers/curtain/driver.compose.json +++ b/drivers/window_coverings/driver.compose.json @@ -1,9 +1,9 @@ { "$extends": "tuya", - "class": "curtain", + "class": "windowcoverings", "name": { - "en": "Curtain", - "nl": "Gordijn" + "en": "Window coverings", + "nl": "Raambekleding" }, "capabilities": ["windowcoverings_state", "windowcoverings_set"] } diff --git a/drivers/curtain/driver.flow.compose.json b/drivers/window_coverings/driver.flow.compose.json similarity index 100% rename from drivers/curtain/driver.flow.compose.json rename to drivers/window_coverings/driver.flow.compose.json diff --git a/drivers/curtain/driver.settings.compose.json b/drivers/window_coverings/driver.settings.compose.json similarity index 100% rename from drivers/curtain/driver.settings.compose.json rename to drivers/window_coverings/driver.settings.compose.json diff --git a/drivers/curtain/driver.ts b/drivers/window_coverings/driver.ts similarity index 66% rename from drivers/curtain/driver.ts rename to drivers/window_coverings/driver.ts index e700f3b9..f95e12c1 100644 --- a/drivers/curtain/driver.ts +++ b/drivers/window_coverings/driver.ts @@ -6,9 +6,9 @@ import { TuyaDeviceResponse, TuyaDeviceSpecificationResponse, } from '../../types/TuyaApiTypes'; -import { CURTAIN_CAPABILITIES, CURTAIN_CAPABILITY_MAPPING } from './TuyaCurtainConstants'; +import { WINDOW_COVERINGS_CAPABILITIES, WINDOW_COVERINGS_CAPABILITY_MAPPING } from './TuyaWindowCoveringsConstants'; -module.exports = class TuyaOAuth2DriverCurtain extends TuyaOAuth2Driver { +module.exports = class TuyaOAuth2DriverWindowCoverings extends TuyaOAuth2Driver { TUYA_DEVICE_CATEGORIES = [DEVICE_CATEGORIES.SMALL_HOME_APPLIANCES.CURTAIN] as const; onTuyaPairListDeviceProperties( @@ -21,13 +21,13 @@ module.exports = class TuyaOAuth2DriverCurtain extends TuyaOAuth2Driver { for (const status of device.status) { const tuyaCapability = status.code; - const homeyCapability = getFromMap(CURTAIN_CAPABILITY_MAPPING, tuyaCapability); - if (constIncludes(CURTAIN_CAPABILITIES.read_write, tuyaCapability) && homeyCapability) { + const homeyCapability = getFromMap(WINDOW_COVERINGS_CAPABILITY_MAPPING, tuyaCapability); + if (constIncludes(WINDOW_COVERINGS_CAPABILITIES.read_write, tuyaCapability) && homeyCapability) { props.store.tuya_capabilities.push(tuyaCapability); props.capabilities.push(homeyCapability); } - if (constIncludes(CURTAIN_CAPABILITIES.setting, tuyaCapability) || tuyaCapability === 'percent_state') { + if (constIncludes(WINDOW_COVERINGS_CAPABILITIES.setting, tuyaCapability) || tuyaCapability === 'percent_state') { props.store.tuya_capabilities.push(tuyaCapability); } } diff --git a/drivers/curtain/pair/welcome.assets/chevron-right.png b/drivers/window_coverings/pair/welcome.assets/chevron-right.png similarity index 100% rename from drivers/curtain/pair/welcome.assets/chevron-right.png rename to drivers/window_coverings/pair/welcome.assets/chevron-right.png diff --git a/drivers/curtain/pair/welcome.assets/logos.png b/drivers/window_coverings/pair/welcome.assets/logos.png similarity index 100% rename from drivers/curtain/pair/welcome.assets/logos.png rename to drivers/window_coverings/pair/welcome.assets/logos.png diff --git a/drivers/curtain/pair/welcome.html b/drivers/window_coverings/pair/welcome.html similarity index 100% rename from drivers/curtain/pair/welcome.html rename to drivers/window_coverings/pair/welcome.html diff --git a/drivers/curtain/translations.json b/drivers/window_coverings/translations.json similarity index 100% rename from drivers/curtain/translations.json rename to drivers/window_coverings/translations.json