From f045d80c44a678578777df23bc27fa81dfc7310b Mon Sep 17 00:00:00 2001 From: Claude Gelinas Date: Sun, 20 Mar 2022 13:02:36 -0400 Subject: [PATCH 01/11] Change value for aux_cycle_length --- custom_components/neviweb/climate.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/custom_components/neviweb/climate.py b/custom_components/neviweb/climate.py index 5dbc8c1..2297e39 100644 --- a/custom_components/neviweb/climate.py +++ b/custom_components/neviweb/climate.py @@ -120,13 +120,13 @@ PERIOD_VALUE = {"15 sec", "5 min", "10 min", "15 min", "20 min", "25 min", "30 min"} HA_TO_NEVIWEB_PERIOD = { - "15 sec": 15, - "5 min": 300, - "10 min": 600, - "15 min": 900, - "20 min": 1200, - "25 min": 1500, - "30 min": 1800 + '15 sec': 'short', + '5 min': 'long5min', + '10 min': 'long10min', + '15 min': 'long15min', + '20 min': 'long20min', + '25 min': 'long25min', + '30 min': 'long30min' } UPDATE_ATTRIBUTES = [ @@ -956,8 +956,7 @@ def set_aux_cycle_length(self, value): """Set auxiliary cycle length for low voltage thermostats""" val = value["length"] entity = value["id"] - if val in HA_TO_NEVIWEB_PERIOD: - length = HA_TO_NEVIWEB_PERIOD[val] + length = [v for k, v in HA_TO_NEVIWEB_PERIOD.items() if k == val] if length == "short": output = "shortCycle" else: From 524686a757e2ea1a46b14b297b954c6d323c8a7f Mon Sep 17 00:00:00 2001 From: Claude Gelinas Date: Sun, 20 Mar 2022 14:18:17 -0400 Subject: [PATCH 02/11] Added set_cycle_length service --- custom_components/neviweb/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/custom_components/neviweb/__init__.py b/custom_components/neviweb/__init__.py index f7e987c..ac2d337 100644 --- a/custom_components/neviweb/__init__.py +++ b/custom_components/neviweb/__init__.py @@ -23,6 +23,7 @@ ATTR_AUX_CYCLE_LENGTH, ATTR_AWAY_MODE, ATTR_BACKLIGHT, + ATTR_CYCLE_LENGTH, ATTR_DISPLAY_2, ATTR_EARLY_START, ATTR_FLOOR_MODE, @@ -43,7 +44,7 @@ ) #REQUIREMENTS = ['PY_Sinope==0.1.5'] -VERSION = '1.9.5' +VERSION = '1.9.6' _LOGGER = logging.getLogger(__name__) @@ -425,6 +426,12 @@ def set_aux_heat(self, device_id, heat, cycle, floor): _LOGGER.debug("aux_heat.data = %s", data) self.set_device_attributes(device_id, data) + def set_cycle_length(self, device_id, length): + """Set low voltage thermostats main heating cycle.""" + data = {ATTR_CYCLE_LENGTH: length} + _LOGGER.debug("cycle.data = %s", data) + self.set_device_attributes(device_id, data) + def set_aux_cycle_length(self, device_id, output, length): """Set low voltage thermostats auxiliary heating output and cycle.""" data = {ATTR_AUX_CONFIG: output, ATTR_AUX_CYCLE_LENGTH: length} From 6da0699f87c343d96f025b63506f06aa9c361b9c Mon Sep 17 00:00:00 2001 From: Claude Gelinas Date: Sun, 20 Mar 2022 14:19:13 -0400 Subject: [PATCH 03/11] Added service set_cycle_length --- custom_components/neviweb/const.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/neviweb/const.py b/custom_components/neviweb/const.py index d63b64a..10506e0 100644 --- a/custom_components/neviweb/const.py +++ b/custom_components/neviweb/const.py @@ -81,3 +81,4 @@ SERVICE_SET_SWITCH_AWAY_MODE = "set_switch_away_mode" SERVICE_SET_AIR_FLOOR_MODE = "set_air_floor_mode" SERVICE_SET_AUX_CYCLE_LENGTH = "set_aux_cycle_length" +SERVICE_SET_CYCLE_LENGTH = "set_cycle_length" From 32d923174e2ce9499f69072c20bcf7ffc41713a4 Mon Sep 17 00:00:00 2001 From: Claude Gelinas Date: Sun, 20 Mar 2022 14:28:22 -0400 Subject: [PATCH 04/11] Added service set_cycle_length --- custom_components/neviweb/climate.py | 41 ++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/custom_components/neviweb/climate.py b/custom_components/neviweb/climate.py index 2297e39..3fff57f 100644 --- a/custom_components/neviweb/climate.py +++ b/custom_components/neviweb/climate.py @@ -102,6 +102,7 @@ SERVICE_SET_AUX_CYCLE_LENGTH, SERVICE_SET_BACKLIGHT, SERVICE_SET_CLIMATE_KEYPAD_LOCK, + SERVICE_SET_CYCLE_LENGTH, SERVICE_SET_EARLY_START, SERVICE_SET_SECOND_DISPLAY, SERVICE_SET_SETPOINT_MAX, @@ -235,6 +236,15 @@ } ) +SET_CYCLE_LENGTH_SCHEMA = vol.Schema( + { + vol.Required(ATTR_ENTITY_ID): cv.entity_id, + vol.Required("value"): vol.All( + cv.ensure_list, [vol.In(PERIOD_VALUE)] + ), + } +) + SET_AUX_CYCLE_LENGTH_SCHEMA = vol.Schema( { vol.Required(ATTR_ENTITY_ID): cv.entity_id, @@ -368,8 +378,19 @@ def set_air_floor_mode_service(service): thermostat.schedule_update_ha_state(True) break + def set_cycle_length_service(service): + """set main cycle duration for low voltage thermostats""" + entity_id = service.data[ATTR_ENTITY_ID] + value = {} + for thermostat in entities: + if thermostat.entity_id == entity_id: + value = {"id": thermostat.unique_id, "length": service.data["value"]} + thermostat.set_cycle_length(value) + thermostat.schedule_update_ha_state(True) + break + def set_aux_cycle_length_service(service): - """set aux cycle duration for low voltage thermosstats""" + """set auxiliary cycle duration for low voltage thermostats""" entity_id = service.data[ATTR_ENTITY_ID] value = {} for thermostat in entities: @@ -442,6 +463,13 @@ def set_aux_cycle_length_service(service): schema=SET_AIR_FLOOR_MODE_SCHEMA, ) + hass.services.async_register( + DOMAIN, + SERVICE_SET_CYCLE_LENGTH, + set_cycle_length_service, + schema=SET_CYCLE_LENGTH_SCHEMA, + ) + hass.services.async_register( DOMAIN, SERVICE_SET_AUX_CYCLE_LENGTH, @@ -717,7 +745,7 @@ def extra_state_attributes(self): 'auxiliary_load': self._aux_wattage, 'auxiliary_output_conf': self._aux_cycle_config, 'auxiliary_output_cycle': neviweb_to_ha(self._aux_cycle_length), - 'cycle_length': self._cycle_length, + 'cycle_length': neviweb_to_ha(self._cycle_length), 'floor_sensor_type': self._sensor_type, 'floor_setpoint': self._floor_setpoint, 'floor_temperature': self._floor_temperature, @@ -952,6 +980,15 @@ def set_preset_mode(self, preset_mode): _LOGGER.error("Unable to set preset mode: %s.", preset_mode) self._operation_mode = preset_mode + def set_cycle_length(self, value): + """Set main cycle length for low voltage thermostats""" + val = value["length"] + entity = value["id"] + length = [v for k, v in HA_TO_NEVIWEB_PERIOD.items() if k == val] + self._client.set_cycle_length( + entity, length) + self._cycle_length = length + def set_aux_cycle_length(self, value): """Set auxiliary cycle length for low voltage thermostats""" val = value["length"] From c571bc0846ce765baa8c470b67d81cabc2bf05b4 Mon Sep 17 00:00:00 2001 From: Claude Gelinas Date: Sun, 20 Mar 2022 14:28:45 -0400 Subject: [PATCH 05/11] push version to 1.9.6 --- custom_components/neviweb/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/neviweb/manifest.json b/custom_components/neviweb/manifest.json index a60420c..eaccaf2 100644 --- a/custom_components/neviweb/manifest.json +++ b/custom_components/neviweb/manifest.json @@ -5,5 +5,5 @@ "dependencies": [], "codeowners": ["@claudegel"], "requirements": [], - "version": "1.9.5" + "version": "1.9.6" } From ca18bd14112cf58546ebc7dfcef00d98a344d137 Mon Sep 17 00:00:00 2001 From: Claude Gelinas Date: Sun, 20 Mar 2022 14:29:57 -0400 Subject: [PATCH 06/11] Added service set_cycle_length --- custom_components/neviweb/services.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/custom_components/neviweb/services.yaml b/custom_components/neviweb/services.yaml index b9a6c80..6904ed4 100644 --- a/custom_components/neviweb/services.yaml +++ b/custom_components/neviweb/services.yaml @@ -189,3 +189,13 @@ set_aux_cycle_length: value: description: cycle lencht in minutes. Accepted values are "15 sec", "5 min", "10 min", "15 min", "20 min", "25 min", "30 min". example: "10 min" + +set_cycle_length: + description: Set low voltage thermostats main cycle length in minutes. + fields: + entity_id: + description: Name(s) of neviweb thermostat. + example: "climate.neviweb_climate_kitchen" + value: + description: cycle lencht in minutes. Accepted values are "15 sec", "5 min", "10 min", "15 min", "20 min", "25 min", "30 min". + example: "10 min" From ac93899c30c8ccafdba37484e971d49427497d68 Mon Sep 17 00:00:00 2001 From: Claude Gelinas Date: Sun, 20 Mar 2022 14:30:38 -0400 Subject: [PATCH 07/11] Push version to 1.9.6 --- custom_components.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components.json b/custom_components.json index 246fd6e..b3e8858 100644 --- a/custom_components.json +++ b/custom_components.json @@ -1,6 +1,6 @@ { "neviweb": { - "version": "1.9.5", + "version": "1.9.6", "local_location": "/custom_components/neviweb/__init__.py", "remote_location": "https://github.com/claudegel/sinope-1/tree/master/custom_components/neviweb/__init__.py", "visit_repo": "https://github.com/claudegel/sinope-1", From 97f8bbadf31ab5e91c431f786161dd2cd42d0538 Mon Sep 17 00:00:00 2001 From: Claude Gelinas Date: Sun, 20 Mar 2022 14:33:08 -0400 Subject: [PATCH 08/11] Added description of service set_cycle_length --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index af0d757..f055a70 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ Automations require services to be able to send commande. Ex. light.turn_on. For - neviweb.set_setpoint_max, to set maximum setpoint temperature for thermostats. - neviweb.set_light_away_mode, to set mode for light when occupency is set to away. - neviweb.set_switch_away_mode, to set mode for switch when occupency is set to away. +- neviweb.set_cycle_length, to set low voltage thermostat main cycle length. Values are: "15 sec", "5 min", "10 min", "15 min", "20 min", "25 min", "30 min". - neviweb.set_aux_cycle_length, to set low voltage thermostat auxiliary cycle length and output. Values are: "15 sec", "5 min", "10 min", "15 min", "20 min", "25 min", "30 min". To trun on/off auxiliary heating just use the button at the bottom of the thermostat card. ## Catch Éco Sinopé signal for peak period From c061d73452763b0bff2a9b3ab5a634e2cf0873f9 Mon Sep 17 00:00:00 2001 From: Claude Gelinas Date: Sun, 20 Mar 2022 15:17:07 -0400 Subject: [PATCH 09/11] Fix value error for length --- custom_components/neviweb/climate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/neviweb/climate.py b/custom_components/neviweb/climate.py index 3fff57f..bfc5ef1 100644 --- a/custom_components/neviweb/climate.py +++ b/custom_components/neviweb/climate.py @@ -984,7 +984,7 @@ def set_cycle_length(self, value): """Set main cycle length for low voltage thermostats""" val = value["length"] entity = value["id"] - length = [v for k, v in HA_TO_NEVIWEB_PERIOD.items() if k == val] + length = [v for k, v in HA_TO_NEVIWEB_PERIOD.items() if k == val][0] self._client.set_cycle_length( entity, length) self._cycle_length = length @@ -993,7 +993,7 @@ def set_aux_cycle_length(self, value): """Set auxiliary cycle length for low voltage thermostats""" val = value["length"] entity = value["id"] - length = [v for k, v in HA_TO_NEVIWEB_PERIOD.items() if k == val] + length = [v for k, v in HA_TO_NEVIWEB_PERIOD.items() if k == val][0] if length == "short": output = "shortCycle" else: From ebb60c058079ea1c3208dbae1d8b33448186b093 Mon Sep 17 00:00:00 2001 From: Claude Gelinas Date: Sun, 20 Mar 2022 21:18:08 -0400 Subject: [PATCH 10/11] added debug --- custom_components/neviweb/climate.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/neviweb/climate.py b/custom_components/neviweb/climate.py index bfc5ef1..754e3fe 100644 --- a/custom_components/neviweb/climate.py +++ b/custom_components/neviweb/climate.py @@ -984,6 +984,7 @@ def set_cycle_length(self, value): """Set main cycle length for low voltage thermostats""" val = value["length"] entity = value["id"] + _LOGGER.warning("Val= %s", val) length = [v for k, v in HA_TO_NEVIWEB_PERIOD.items() if k == val][0] self._client.set_cycle_length( entity, length) @@ -993,6 +994,7 @@ def set_aux_cycle_length(self, value): """Set auxiliary cycle length for low voltage thermostats""" val = value["length"] entity = value["id"] + _LOGGER.warning("Val= %s", val) length = [v for k, v in HA_TO_NEVIWEB_PERIOD.items() if k == val][0] if length == "short": output = "shortCycle" From e700b84b7a61ef4bf09f2f2ad6337fb483bae17d Mon Sep 17 00:00:00 2001 From: Claude Gelinas Date: Sun, 20 Mar 2022 22:11:45 -0400 Subject: [PATCH 11/11] Fix value of cycle_length --- custom_components/neviweb/climate.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/custom_components/neviweb/climate.py b/custom_components/neviweb/climate.py index 754e3fe..febb5bd 100644 --- a/custom_components/neviweb/climate.py +++ b/custom_components/neviweb/climate.py @@ -384,7 +384,7 @@ def set_cycle_length_service(service): value = {} for thermostat in entities: if thermostat.entity_id == entity_id: - value = {"id": thermostat.unique_id, "length": service.data["value"]} + value = {"id": thermostat.unique_id, "length": service.data["value"][0]} thermostat.set_cycle_length(value) thermostat.schedule_update_ha_state(True) break @@ -395,7 +395,7 @@ def set_aux_cycle_length_service(service): value = {} for thermostat in entities: if thermostat.entity_id == entity_id: - value = {"id": thermostat.unique_id, "length": service.data["value"]} + value = {"id": thermostat.unique_id, "length": service.data["value"][0]} thermostat.set_aux_cycle_length(value) thermostat.schedule_update_ha_state(True) break @@ -984,7 +984,6 @@ def set_cycle_length(self, value): """Set main cycle length for low voltage thermostats""" val = value["length"] entity = value["id"] - _LOGGER.warning("Val= %s", val) length = [v for k, v in HA_TO_NEVIWEB_PERIOD.items() if k == val][0] self._client.set_cycle_length( entity, length) @@ -994,7 +993,6 @@ def set_aux_cycle_length(self, value): """Set auxiliary cycle length for low voltage thermostats""" val = value["length"] entity = value["id"] - _LOGGER.warning("Val= %s", val) length = [v for k, v in HA_TO_NEVIWEB_PERIOD.items() if k == val][0] if length == "short": output = "shortCycle"