-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Remove use of frontend automations #173
Merged
Merged
Conversation
This file contains 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
icalendar 4.x is effectively deprecated, bump to 5.x Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Inspect the HA state machine directly to get the current defined Keymaster slot definitions to build up the the overrides table. This makes the startup / rental_control_refresh automation redundant Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
* Sets config version to 5 * Causes the automations to be rebuilt and the startup automation to be removed as the logic has moved inside of the integration startup Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Instead of having some functions have entry and others use the more community commont config_entry, just standardize on using config_entry Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Simplify the call to the init routine and also make sure that it is properly annotated. Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
* More annotation of the RentalControl class * Minor cleanup of property loading as there are no (reported) versions that are so old that the guards are needed any more Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Finish cleaning up the RentalControl class annotations Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
https://developers.home-assistant.io/docs/creating_integration_manifest specifies that integration_type needs to be set in the manifest. The current default is 'hub' but RentalControl falls more into either the 'service' (which we're choosing) or possibly 'device' categories. Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Latest changes are only being tested on HA 2023.9.x with HACS >=1.32.1 so set the minimum install requirements to these values Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
* Migrates the RentalControl object to a "coordinator" object that is stored in hass.data as part of a dictionary * Properly updates all sensors for the new location of the coordinator object (and renames it to be consistent) Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
* Moves the slot mapping to an event listener * Removes the update automation as we now listen on the controller side Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
The term coordinator really makes more sense and is more in line with the shift that happened in the main RentalControl class while moving awawy from front end automations. Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
The mapping update is now called during override updates. This allows it to be very responsive to making sure a code is still defined Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
* Move the clear code operation from an automation listenting for a rental_control event to a listener. * Remove the clear_code automation definition Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Build up new overrides handling system and hook it in next to the current one. * Handles overrides in a more correct manner * Has a get_next_available_slot routine to more easily acquire where the next code should be sent. Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Move the event overrides logic to it's own object. This makes the code in RentalControl itself easier to read and also centralizes most of the logic. The majority of the logic is all sync instead of async code to help make sure we're only operating on a given state at a time Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Event sensors no longer call a refresh of the event calendar, instead, the event calendar will trigger a refresh of event sensors making them more responsive to updates in the calendar. Issue: Fixes #163 Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
The MappingSensor has never really worked particularly well. As it never properly worked, all the automations that were expected to start using it never did. Additionally, since the shipped automations are going away, the need for the sensor is even less relevant. Remove the loading of it. Also, fix issues with reload of the integration Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
* Removes the installation of the set_code automation * Triggers slot setting as needed * Is unfortunately much slower to load in all codes when a calendar is first instantiated into empty slots Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Move it out of async_fire_set_code so that it can be used by other functions Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Updates to start/end dates now properly cause updates to slot definitions. Start / stop _times_ still fully override even over date changes. Issue: Fixes #105 Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
* Add type hinting to calendar sensor * Add an available flag that follows the coordinator availability Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
The old event firing is no longer needed as it has been subsumed by more direct methods of setting the slots Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Rental Control no longer uses automations coming from the front end to inform features. As the services that were defined were all related to passing data from the frontend to the backend they are no longer useful. Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
* async_check_overrides - this has moved into the event_overrides module * fire_clear_code - this has been redesigned as async_fire_clear_code to interact directly with HA instead of firing an event to be picked up by an automation Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Remove the last vestiges of the old overrides system and move the new one into the coordinator.event_overrides location Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
Make sure all migrations are happening instead of only one per restart (not certain how I missed this for so long!) Final state has the packages/rental_control directory structure completely removed. Users will have do one more restart of HA before they can completely remove all orphaned entities which will have to be a manual process :( Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
* Detail how custom calendar events should be constructed * Remove information about the removed mapping sensor Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
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.
Move from using frontend automations to populate data into the backend to
talking to the Home Assistant state machine and firing modification events
directly at entities.