Remove helper entities on entry unload or options update - #2
Merged
Conversation
Collaborator
|
Good stuff |
FutureTense
approved these changes
Dec 9, 2020
raman325
force-pushed
the
remove_entities
branch
from
December 9, 2020 17:58
c930791 to
1aad777
Compare
github-actions
Bot
force-pushed
the
main
branch
from
December 9, 2020 17:58
775250e to
0505e29
Compare
New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging
New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging
raman325
force-pushed
the
remove_entities
branch
from
December 9, 2020 18:01
1aad777 to
38ccfa6
Compare
Collaborator
Author
|
Can you reopen this? I just resolved the conflicts. |
github-actions Bot
pushed a commit
that referenced
this pull request
Dec 9, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
raman325
added a commit
to raman325/keymaster
that referenced
this pull request
Dec 9, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
FutureTense
pushed a commit
that referenced
this pull request
Dec 9, 2020
* Remove helper entities on entry unload or options update (#2) * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix * fix path migration logic * fix imports * fix imports * fix imports * fix imports * add pyproject.toml to configure black, isort, pytest, etc (from homeassistant repo)
github-actions Bot
pushed a commit
that referenced
this pull request
Dec 9, 2020
* Remove helper entities on entry unload or options update (#2) * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix * fix path migration logic * fix imports * fix imports * fix imports * fix imports * add pyproject.toml to configure black, isort, pytest, etc (from homeassistant repo)
raman325
added a commit
to raman325/keymaster
that referenced
this pull request
Dec 9, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
FutureTense
pushed a commit
that referenced
this pull request
Dec 9, 2020
…, other potential bug fixes (#6) * Remove helper entities on entry unload or options update (#2) * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix * require unique name during config flow, delete base folder when empty, other bug fixes * add missing typehints
raman325
added a commit
to raman325/keymaster
that referenced
this pull request
Dec 9, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
FutureTense
pushed a commit
that referenced
this pull request
Dec 9, 2020
* Remove helper entities on entry unload or options update (#2) * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix * reduce sensor polling frequency significantly
raman325
added a commit
to raman325/keymaster
that referenced
this pull request
Dec 9, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
FutureTense
pushed a commit
that referenced
this pull request
Dec 10, 2020
* Remove helper entities on entry unload or options update (#2) * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix * fix options flow * properly fix options flow and a couple of other bugs * black * await setting unique ID
raman325
added a commit
to raman325/keymaster
that referenced
this pull request
Dec 10, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
FutureTense
pushed a commit
that referenced
this pull request
Dec 13, 2020
* Remove helper entities on entry unload or options update (#2) * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix * move code into submodules to make it easier to write tests for * fix tests and bugfix * forward unload to platforms * change __init__ docstring * add requirements_test.txt
raman325
added a commit
to raman325/keymaster
that referenced
this pull request
Dec 13, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
raman325
added a commit
to raman325/keymaster
that referenced
this pull request
Dec 14, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
raman325
added a commit
to raman325/keymaster
that referenced
this pull request
Dec 22, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
FutureTense
pushed a commit
that referenced
this pull request
Dec 22, 2020
…tions update (#13) * Remove helper entities on entry unload or options update (#2) * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix * delete old files and folders when path or lock name changes during options update * shorten function name
raman325
added a commit
to raman325/keymaster
that referenced
this pull request
Dec 22, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
raman325
added a commit
to raman325/keymaster
that referenced
this pull request
Dec 22, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
raman325
added a commit
to raman325/keymaster
that referenced
this pull request
Dec 23, 2020
* refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * fix typo * refactor, bug fixes, and improvements New Features - cleanup packages folder on entry removal Changes - switch to using relative path for CONF_PATH to reduce changes of error (existing config entries will be updated automatically) Bug Fixes - Switch _generate_package from async to sync because it does I/O on the filesystem - fix output file not being opened with context manager (so never closed) - fix sensor creation loop to only create necessary sensors instead of sensors for all code slots - fix CodeSlotsData sensor (now a DataUpdateCoordinator) logic for OZW integrations Code Cleanup/Improvements - move CodeSlotsData logic into DataUpdateCoordinator since that's what it is being used for - reduce polling frequency significantly by only polling any time a slot is set or cleared with a backup hourly polling in case updates are made outside of KeyMaster (this will significantly improve battery life over current implementation with the same level of accuracy) - Update config entry using update method instead of directly manipulating attributes - use slugify when fixing CONF_NAME - use os.path.join to create paths for better OS compatibility - switch to using f-strings - only attempt cleanup of packages directory if it exists - always rely on entry.data so that options is only used to capture options updates - simplify code and reduced repeat logic by moving things into common functions - raise Exceptions in services when there is a failure (this will be shown in UI) - use more list comprehensions - switch while loops to for loops - added typing - gitignore venv - improve debug messaging * remove helper entities on entry unload or options update * remove counter since it's not actually used, it was just there for futureproofing * bugfix
9 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds cleanup of YAML-package-generated helper entities (input_boolean, input_datetime, input_number, input_select, input_text, timer) when a keymaster config entry is unloaded or when its options change. Previously these helpers persisted on restart, so the integration left orphaned entities behind. The PR also tweaks update_listener so options updates compute slot diffs and remove only the helpers for slots that disappeared.
Changes:
- New
_get_entities_to_remove/_remove_entitieshelpers that parse generated YAML and remove matching entries from the entity registry. async_unload_entrynow removes all helpers (including common ones) beforeshutil.rmtree-ing the package directory.update_listenerremoves helpers for slots present before but absent after an options update, then regenerates packages and reloads.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| custom_components/keymaster/init.py | Adds helper-entity cleanup in unload and options-update paths and the supporting _get_entities_to_remove / _remove_entities helpers. |
| custom_components/keymaster/const.py | Edits ISSUE_URL (introduces a typo: keymaster → keypaster). |
| custom_components/keymaster/config_flow.py | Whitespace-only reordering of imports. |
| custom_components/keymaster/sensor.py | Whitespace-only import reordering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| DOMAIN = "keymaster" | ||
| VERSION = "0.0.45" | ||
| ISSUE_URL = "https://github.com/FutureTense/keymaster" | ||
| ISSUE_URL = "https://github.com/FutureTense/keypaster" |
Comment on lines
500
to
519
| async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: | ||
| """Handle removal of an entry.""" | ||
|
|
||
| # Remove all generated helper entries | ||
| await _remove_entities( | ||
| hass, | ||
| config_entry, | ||
| range(config_entry.data[CONF_START], config_entry.data[CONF_SLOTS] + 1), | ||
| True, | ||
| ) | ||
|
|
||
| # Remove all package files | ||
| output_path = os.path.join( | ||
| hass.config.path(), | ||
| config_entry.data[CONF_PATH], | ||
| config_entry.data[CONF_LOCK_NAME], | ||
| ) | ||
| await hass.async_add_executor_job(shutil.rmtree, output_path) | ||
|
|
||
| return True |
Comment on lines
+522
to
+533
| async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry) -> None: | ||
| """Update listener.""" | ||
| # Get current code slots and new code slots, and remove entities for current code | ||
| # slots that are being removed | ||
| curr_slots = range(config_entry.data[CONF_START], config_entry.data[CONF_SLOTS] + 1) | ||
| new_slots = range( | ||
| config_entry.options[CONF_START], config_entry.options[CONF_SLOTS] + 1 | ||
| ) | ||
|
|
||
| await _remove_entities( | ||
| hass, config_entry, list(set(curr_slots) - set(new_slots)), False | ||
| ) |
Comment on lines
+137
to
+138
| for filename in filenames: | ||
| file_dict = load_yaml(os.path.join(output_path, filename)) |
Comment on lines
+171
to
+172
| for entity_id in entities_to_remove: | ||
| ent_reg.async_remove(entity_id) |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking change
Given that these aren't removed today, this might be considered a breaking change, but I'm not sure.
Proposed change
When removing a
keymasterentry, all helper entities will now be removed. This ensures that on restart, all entities created bykeymasterhave been cleaned up (previously,binary_sensorsandsensorswere removed on restart automatically but helper entities persisted).There is also logic to remove extra helper entities on an options update (when the number of slots or start slot changes).
This PR follows #1 and should only be merged after the first is merged so that I can rebase on it.
Type of change
Additional information
Here are the relevant changes, which are hard to see because this currently includes the diff from #1
keymaster/custom_components/keymaster/__init__.py
Lines 125 to 176 in 67f50bb
keymaster/custom_components/keymaster/__init__.py
Lines 524 to 531 in 67f50bb
keymaster/custom_components/keymaster/__init__.py
Lines 502 to 507 in 67f50bb