Refactor RainMachine switch platform (#31148)

* Import constants sanely

* Linting

* Rename data constants for consistency

* Refactor RainMachine switch platform

* Comments

* Cleanup

* Refactor switch and sensor API calls to be separate

* Linting

* Make sure zones are updated in appropriate service calls

* Correctly decrement

* Linting

* Don't do weird inheritance

* Ensure service calls update data properly

* Docstring

* Docstring

* Errors can be logged without string conversion

* Code review comments
This commit is contained in:
Aaron Bach 2020-01-25 20:27:35 -07:00 committed by GitHub
parent 37d1cdc4cb
commit 4c4f726323
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 295 additions and 260 deletions

View file

@ -7,13 +7,17 @@ LOGGER = logging.getLogger(__package__)
DOMAIN = "rainmachine"
DATA_CLIENT = "client"
DATA_PROGRAMS = "programs"
DATA_PROVISION_SETTINGS = "provision.settings"
DATA_RESTRICTIONS_CURRENT = "restrictions.current"
DATA_RESTRICTIONS_UNIVERSAL = "restrictions.universal"
DATA_ZONES = "zones"
DATA_ZONES_DETAILS = "zones_details"
DEFAULT_PORT = 8080
DEFAULT_SCAN_INTERVAL = timedelta(seconds=60)
DEFAULT_SSL = True
PROVISION_SETTINGS = "provision.settings"
RESTRICTIONS_CURRENT = "restrictions.current"
RESTRICTIONS_UNIVERSAL = "restrictions.universal"
TOPIC_UPDATE = "update_{0}"
PROGRAM_UPDATE_TOPIC = f"{DOMAIN}_program_update"
SENSOR_UPDATE_TOPIC = f"{DOMAIN}_data_update"
ZONE_UPDATE_TOPIC = f"{DOMAIN}_zone_update"