From 83da341d35686fe83cd9da94461debfb3f7ef1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kan=20=C3=85kerberg?= Date: Tue, 8 Sep 2020 22:14:16 +0200 Subject: [PATCH] 0.2.0 --- custom_components/shelly/__init__.py | 7 +++++-- custom_components/shelly/binary_sensor.py | 1 - custom_components/shelly/config_flow.py | 2 ++ custom_components/shelly/configuration_schema.py | 2 ++ custom_components/shelly/const.py | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/custom_components/shelly/__init__.py b/custom_components/shelly/__init__.py index b4a9de7..8622388 100755 --- a/custom_components/shelly/__init__.py +++ b/custom_components/shelly/__init__.py @@ -42,7 +42,7 @@ _LOGGER = logging.getLogger(__name__) -__version__ = "0.2.0-b7" +__version__ = "0.2.0" VERSION = __version__ async def async_setup(hass, config): @@ -376,7 +376,8 @@ async def _async_block_updated(self, block): self.add_device("switch", attr) elif update_switch is not None: update_switch.remove() - + + if hass_data['allow_upgrade_beta_switch']: has_beta_update = block.has_fw_update(True) update_beta_switch = getattr(block, 'beta_firmware_switch', None) if has_beta_update: @@ -416,6 +417,8 @@ async def _async_block_added(self, block): block.hass_data = { 'allow_upgrade_switch' : self._get_specific_config_root(CONF_UPGRADE_SWITCH, block.id), + 'allow_upgrade_beta_switch' : + self._get_specific_config_root(CONF_UPGRADE_BETA_SWITCH, block.id), 'sensor_cfg' : self._get_sensor_config(block.id), 'discover': discover_block } diff --git a/custom_components/shelly/binary_sensor.py b/custom_components/shelly/binary_sensor.py index f91ea82..6b46c12 100644 --- a/custom_components/shelly/binary_sensor.py +++ b/custom_components/shelly/binary_sensor.py @@ -113,7 +113,6 @@ def update(self): if self._click_timer is not None: self._click_timer.cancel() diff = millis - self._last_state_change - print(diff) if diff < self._click_delay or self._click_cnt == 0: self._click_cnt += 1 else: diff --git a/custom_components/shelly/config_flow.py b/custom_components/shelly/config_flow.py index 74e5e0e..cb6bd97 100644 --- a/custom_components/shelly/config_flow.py +++ b/custom_components/shelly/config_flow.py @@ -12,6 +12,7 @@ ALL_ATTRIBUTES, CONF_ATTRIBUTES, ALL_SENSORS, CONF_SENSORS, CONF_MDNS, CONF_VERSION, CONF_UPGRADE_SWITCH, + CONF_UPGRADE_BETA_SWITCH, CONF_IGMPFIX, CONF_HOST_IP, CONF_MQTT_PORT, CONF_CLOUD_AUTH_KEY, CONF_CLOUD_SERVER, CONF_TMPL_NAME, CONF_ADDITIONAL_INFO, @@ -117,6 +118,7 @@ async def async_step_config_1(self, user_input=None): self.v(CONF_MDNS): bool, self.v(CONF_VERSION): bool, self.v(CONF_UPGRADE_SWITCH): bool, + self.v(CONF_UPGRADE_BETA_SWITCH): bool, self.v(CONF_IGMPFIX): bool, self.v(CONF_HOST_IP) : str, self.v(CONF_MQTT_PORT) : int diff --git a/custom_components/shelly/configuration_schema.py b/custom_components/shelly/configuration_schema.py index b3d528f..bbe3deb 100644 --- a/custom_components/shelly/configuration_schema.py +++ b/custom_components/shelly/configuration_schema.py @@ -41,6 +41,7 @@ vol.Optional(CONF_SENSORS): vol.All(cv.ensure_list, [vol.In(ALL_SENSORS_W_EXTRA)]), vol.Optional(CONF_UPGRADE_SWITCH): cv.boolean, + vol.Optional(CONF_UPGRADE_BETA_SWITCH): cv.boolean, vol.Optional(CONF_UNAVALABLE_AFTER_SEC) : cv.positive_int, vol.Optional(CONF_ENTITY_ID): cv.string, vol.Optional(CONF_POWER_DECIMALS): cv.positive_int, #deprecated @@ -70,6 +71,7 @@ vol.Optional(CONF_WIFI_SENSOR): cv.boolean, #deprecated vol.Optional(CONF_UPTIME_SENSOR): cv.boolean, #deprecated vol.Optional(CONF_UPGRADE_SWITCH, default=True): cv.boolean, + vol.Optional(CONF_UPGRADE_BETA_SWITCH, default=False): cv.boolean, vol.Optional(CONF_UNAVALABLE_AFTER_SEC, default=90) : cv.positive_int, vol.Optional(CONF_SENSORS, default=DEFAULT_SENSORS): vol.All(cv.ensure_list, [vol.In(ALL_SENSORS_W_EXTRA)]), diff --git a/custom_components/shelly/const.py b/custom_components/shelly/const.py index 4ad9c40..94fda17 100644 --- a/custom_components/shelly/const.py +++ b/custom_components/shelly/const.py @@ -31,6 +31,7 @@ CONF_POWER_DECIMALS = 'power_decimals' CONF_SENSORS = 'sensors' CONF_UPGRADE_SWITCH = 'upgrade_switch' +CONF_UPGRADE_BETA_SWITCH = 'upgrade_beta_switch' CONF_UNAVALABLE_AFTER_SEC = 'unavailable_after_sec' CONF_CLOUD_AUTH_KEY = 'cloud_auth_key' CONF_CLOUD_SERVER = 'cloud_server'