diff --git a/custom_components/duofern/__init__.py b/custom_components/duofern/__init__.py index 32dad02..a12260e 100644 --- a/custom_components/duofern/__init__.py +++ b/custom_components/duofern/__init__.py @@ -132,17 +132,22 @@ def get_device_id(hass_entity_id): get_all = call.data.get('all', None) hass_device_id = call.data.get('device_id', None) if get_all: - device_ids = hass.data[DOMAIN]['stick'].duofern_parser.modules['by_code'] + _LOGGER.info("Asking all devices for update") + device_ids = hass.data[DOMAIN]['stick'].duofern_parser.modules['by_code'].keys() else: + _LOGGER.info("Asking specific devices for update") device_ids = [get_device_id(i) for i in hass_device_id] except Exception: - _LOGGER.exception(f"exception while getting device id {call}, {call.data}, i konw {hass.data[DOMAIN]['deviceByHassId']}, fyi deviceByID is {hass.data[DOMAIN]['devices']}") + _LOGGER.exception(f"Exception while getting device id {call}, {call.data}, i know {hass.data[DOMAIN]['deviceByHassId']}, fyi deviceByID is {hass.data[DOMAIN]['devices']}") for id,dev in hass.data[DOMAIN]['deviceByHassId'].items(): _LOGGER.warning(f"{id}, {dev.__dict__}") raise if device_ids is None: _LOGGER.warning(f"device_id missing from call {call.data}") return + _LOGGER.info(f"Updating these devices {' '.join(device_ids)}") + if not device_ids or all([i is None for i in device_ids]): + _LOGGER.warning("Found no valid device ids???") for device_id in device_ids: if device_id is not None: if device_id not in hass.data[DOMAIN]['stick'].duofern_parser.modules['by_code']: diff --git a/custom_components/duofern/manifest.json b/custom_components/duofern/manifest.json index a6e22ab..4a42806 100644 --- a/custom_components/duofern/manifest.json +++ b/custom_components/duofern/manifest.json @@ -6,6 +6,6 @@ "config_flow": true, "issue_tracker": "https://github.com/gluap/pyduofern-hacs/issues" , "codeowners": ["@gluap"], - "requirements": ["pyduofern==0.35.1"], + "requirements": ["pyduofern==0.35.2"], "version": "0.5.2" } diff --git a/custom_components/duofern/services.yaml b/custom_components/duofern/services.yaml index 7c36ece..ba62126 100644 --- a/custom_components/duofern/services.yaml +++ b/custom_components/duofern/services.yaml @@ -8,7 +8,15 @@ start_pairing: example: 60 sync_devices: - description: re-sync devices (trigger after pairing, if it does not work, a restart of homeassistant may help) + description: Re-sync Devices (trigger after pairing, if it does not work, a restart of homeassistant may help) + +clean_config: + description: Clean the duofern config. Will erase all devices from duofern config. + Paired devices should automatically be re-added after when they speak to duofern stick. + Non-Paired bogous devices not. **Use with caution - not tested.** + If you want to be sure manually edit ``.duofern.json`` and remove unwanted devices there + Be aware that homeassistant might keep its own record of these unwanted devices - you + have to deall with these via homeassistant GUI. dump_device_state: description: dump state of all known devices as a warning. State reflects state considering all @@ -16,10 +24,10 @@ dump_device_state: Purpose is to debug whether there's a discrepancy with state reflected in Homeassistant. ask_for_update: - description: ask the specified device for an update (in case of missed radio transmissions) + description: Ask the specified device for an update (in case of missed radio transmissions). fields: all: - description: update all devices + description: Update all devices. required: false selector: boolean: @@ -33,9 +41,9 @@ ask_for_update: integration: duofern set_update_interval: - description: set the automatically broadcasting a "please send an update" interval. + description: Set the automatically broadcasting a "please send an update" interval. Be aware that this is not persisted. Use an automation to trigger this at Homeassistant - start if you always want it to be set to your custom value + start if you always want it to be set to your custom value. fields: period_minutes: description: approximate forced refresh interval in minutes - defaults to 5, 0 means never