Skip to content
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

Improve error handling on startup #280

Merged
merged 7 commits into from Oct 5, 2020
Merged

Conversation

iMicknl
Copy link
Owner

@iMicknl iMicknl commented Sep 29, 2020

We now raise ConfigEntryNotReady on some exceptions, to make it retry. Not 100% sure if this will work for too_many_requests as well.

2020-09-29 23:59:35 ERROR (MainThread) [custom_components.tahoma] too_many_requests
2020-09-29 23:59:35 WARNING (MainThread) [homeassistant.config_entries] Config entry for tahoma not ready yet. Retrying in 20 seconds
2020-09-29 23:59:56 ERROR (MainThread) [custom_components.tahoma] too_many_requests
2020-09-29 23:59:56 WARNING (MainThread) [homeassistant.config_entries] Config entry for tahoma not ready yet. Retrying in 40 seconds
2020-09-30 00:00:36 ERROR (MainThread) [custom_components.tahoma] too_many_requests
2020-09-30 00:00:36 WARNING (MainThread) [homeassistant.config_entries] Config entry for tahoma not ready yet. Retrying in 80 seconds

Signed-off-by: Mick Vleeshouwer <mick@imick.nl>
Signed-off-by: Mick Vleeshouwer <mick@imick.nl>
Signed-off-by: Mick Vleeshouwer <mick@imick.nl>
Signed-off-by: Mick Vleeshouwer <mick@imick.nl>
Signed-off-by: Mick Vleeshouwer <mick@imick.nl>
Signed-off-by: Mick Vleeshouwer <mick@imick.nl>
@iMicknl iMicknl marked this pull request as ready for review October 4, 2020 20:54
@iMicknl iMicknl linked an issue Oct 4, 2020 that may be closed by this pull request
1 task
@iMicknl iMicknl changed the title Enhancement/better handle errors Improve error handling on startup Oct 4, 2020
Comment on lines +87 to +88
devices = await client.get_devices()
scenarios = await client.get_scenarios()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why create 2 variables? We only use them once.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to have those two API calls in the try, catch {} as well, however I don't want to duplicate the exception logic 3 times. This was the only solution I could think of.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you don't use them in your except blocks. Or perhaps you suggest that these exceptions can happen when we retrieve the devices and scenarios?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these exceptions can happen on retrieval of the devices and scenarios. They are needed later on in the init, however this won't be reached in case of any errors.

See #277.

@iMicknl iMicknl merged commit 4ba6694 into master Oct 5, 2020
@iMicknl iMicknl deleted the enhancement/better_handle_errors branch October 5, 2020 09:26
iMicknl added a commit that referenced this pull request Jan 17, 2021
commit 93f34a9
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Sat Jan 16 14:01:40 2021 +0100

    fix bug in hvac modes introduced in #336 (#348)

    * fix bug in hvac modes introduced in #336

    * Update atlantic_electrical_heater.py

    remove unnecessary map

commit 740f40f
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Wed Jan 13 11:56:41 2021 +0100

    Support Cozytouch, Rexel and Connexoon RTS. (#332)

    Co-authored-by: Vincent Le Bourlot <vlebourl@gmail.com>

commit 9efda58
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jan 12 23:46:15 2021 +0100

    Use constant for source (#338)

commit c9aafec
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jan 12 22:46:05 2021 +0100

    Clean up code for climate devices (#336)

commit 88325ec
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Tue Jan 12 22:13:09 2021 +0100

    Support 'suddenDropMode' state for Somfy Thermostat (#327)

    Co-authored-by: Mick Vleeshouwer <mick@imick.nl>

commit d50dd11
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Jan 12 21:50:31 2021 +0100

    Change MIN_UPDATE_INTERVAL (#335)

    as agreed with Somfy

commit f8ae6e0
Author: Thibaut <thibaut@etienne.pw>
Date:   Fri Dec 18 23:05:48 2020 +0100

    Use existing web session (#329)

commit e13699d
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Fri Dec 18 11:55:34 2020 +0100

    fixed a typo (#326)

commit ffa26fb
Author: Thibaut <thibaut@etienne.pw>
Date:   Tue Dec 15 20:20:59 2020 +0100

    Fix wrong position for awning valance (#325)

    * Fix wrong position for awning valance

    * Add awning valence in more places

    * Refactor common condition

commit 2378a6a
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Thu Dec 10 11:33:30 2020 +0100

    Log the deviceurl for all devices (#323)

    * Log the deviceurl for all devices

    Add a log line in debug for added devices.
    Add the device url to the debug log for added and unsupported devices.

    * fix style

commit 70b339c
Author: Thibaut <thibaut@etienne.pw>
Date:   Mon Dec 7 14:33:25 2020 +0100

    Update minimal homeassistant required version (#321)

    See #320

commit 2d731be
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Sat Dec 5 12:26:18 2020 +0100

    Print HomeKit code in log while in debug mode (#318)

commit f78b6d8
Author: Thibaut <thibaut@etienne.pw>
Date:   Thu Dec 3 16:27:51 2020 +0100

    Implement Coordinator entity (#316)

commit c56560e
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Thu Dec 3 14:23:03 2020 +0100

    Revert "Reverse open/close for all Awning devices" (#314)

    This reverts commit d81fc1b.

commit 50f352b
Author: Jerome Garec <jerome.garec@gmail.com>
Date:   Thu Oct 29 00:00:31 2020 +0100

    Add support for AtlanticPassAPCDHW (WaterHeatingSystem) (#281)

    Co-authored-by: Mick Vleeshouwer <mick@imick.nl>
    Co-authored-by: Vincent Le Bourlot <vlebourl@gmail.com>

commit 68e36d2
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Wed Oct 28 11:37:31 2020 +0100

    Fix auto / manual mode detection on Somfy's Smart Thermostat. (#311)

    * fix auto / manual mode detection.

    * simplify reverse map syntax

commit 1be9c7e
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Tue Oct 27 09:43:17 2020 +0100

    Improve handling of errors when Somfy server is in maintenance. (#306)

    Co-authored-by: Thibaut Etienne <thibaut@etienne.pw>

commit 48bef61
Author: Thibaut <thibaut@etienne.pw>
Date:   Mon Oct 26 21:41:37 2020 +0100

    Update pre-commit version (#309)

    Co-authored-by: Mick Vleeshouwer <mick@imick.nl>

commit c1ecde0
Author: Thibaut <thibaut@etienne.pw>
Date:   Mon Oct 26 21:34:00 2020 +0100

    Update hacs.json (#310)

commit 86936a6
Author: Thibaut <thibaut@etienne.pw>
Date:   Mon Oct 26 16:10:40 2020 +0100

    Add dev container to ease development (#308)

commit 6294bab
Author: Thibaut <thibaut@etienne.pw>
Date:   Mon Oct 26 15:49:47 2020 +0100

    Run CI/CD job only on pull request (#303)

commit d81fc1b
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Sun Oct 25 15:01:33 2020 +0100

    Reverse open/close for all Awning devices (#293)

    Co-authored-by: Mick Vleeshouwer <mick@imick.nl>

commit 7b7f9b5
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Thu Oct 8 16:17:42 2020 +0200

    Fix position for PositionableExteriorVenetianBlind. (#295)

commit 256c0d8
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Wed Oct 7 10:23:51 2020 +0200

    Improve debug logging in DataUpdateCoordinator (#290)

commit dfb8909
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Mon Oct 5 21:41:50 2020 +0200

    Use round() instead of int() (#288)

    Signed-off-by: Mick Vleeshouwer <mick@imick.nl>

commit 5528c04
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Mon Oct 5 14:28:06 2020 +0200

    Support cancelling cover movement when initiated outside Home Assistant (#263)

commit 7aeba2a
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Mon Oct 5 13:31:33 2020 +0200

    Fix pylint warnings (#287)

commit 17d8a9b
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Mon Oct 5 13:30:49 2020 +0200

    Only remove update listener when unload was succesfull (#276)

    Signed-off-by: Mick Vleeshouwer <mick@imick.nl>

commit 4ba6694
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Mon Oct 5 11:26:31 2020 +0200

    Improve error handling on startup (#280)

commit 85c10ed
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Mon Oct 5 00:15:54 2020 +0200

    Remove unused imports (#286)

commit dfd4c84
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Fri Oct 2 11:18:06 2020 +0200

    Fix PR labeler for forks (#282)

commit 7c1f11d
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Sun Sep 27 22:55:41 2020 +0200

    Strongly type the event types in DataUpdateCoordinator. (#270)

commit f7d81ac
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Mon Sep 21 20:49:38 2020 +0200

    Change CookieJar to use defaults (unsafe=False) (#273)

commit bed586e
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Mon Sep 21 14:08:56 2020 +0200

    Update HACS validation to pull from main.. (#274)

commit 02c0341
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Mon Sep 21 10:48:04 2020 +0200

    Add unit tests for option flow (#272)

    Signed-off-by: Mick Vleeshouwer <mick@imick.nl>

commit e49f013
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Thu Sep 17 11:33:51 2020 +0200

    add some badges (#268)

commit 5574c44
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Thu Sep 17 11:13:11 2020 +0200

    Add a tick box to ensure users have read the readme to the end. (#267)

commit 05b3469
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Thu Sep 17 10:52:30 2020 +0200

    Read model and manufacturer from state (#260)

    Signed-off-by: Mick Vleeshouwer <mick@imick.nl>

commit 7c58f9f
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Thu Sep 17 10:39:18 2020 +0200

    Handle exceptions in execution of commands (#262)

commit 39baced
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Mon Sep 14 10:00:18 2020 +0200

    Improve `stop` and `stop tilt` command for covers (#251)

commit af03275
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Thu Sep 10 12:35:42 2020 +0200

    Rename UNIT_PERCENTAGE to PERCENTAGE (#257)

commit 34eeb61
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Fri Sep 4 11:38:53 2020 +0200

    Add support for StatelessExteriorHeating device. (#244)

    * Add support for StatelessExteriorHeating device.

    * Add support for StatelessExteriorHeating device.

    * Changed unknown property to None. Added SUPPORT_PRESET_MODE.

    * Added services to services.yaml, removed up and down services. #211

    * Fix temperature unit. #211

    * Fix types. #211

    * limit service my to supported devices. #211

    * Added some debug logs.

    * Merge master into branch.

    * fixed wrong import
    #211

    * Add last ha action as preset and hvac mode state.
    #211

    * Renamed service.
    #211

    * Revert "Add last ha action as preset and hvac mode state."

    This reverts commit bdfb6f3
    #211

    * improved debug logging.
    #211

    * improved debug logging.
    #211

    * fix possible circular import. #211

    * Removed service

    * Changed preset to my only

    * Removed commented lines.

    * Cleaned up code.

    * Cleaned up code.

    * Removed unwanted logging message.

    #211

    * Switch mode and preset back to None.

    #211

    * cleanup code.

    #211

commit a95fb73
Author: Vincent Le Bourlot <vlebourl@gmail.com>
Date:   Fri Sep 4 09:57:46 2020 +0200

    Add service to send any command to tahoma. (#252)

    * Add service to send any command to tahoma.

    * Fixed jsons.

    * Update strings.json

    * Applied comments.

    * Add service to send any command to tahoma.

    * Rebased onto master.

    * Cleanup leftovers.

    * Cleanup some more leftovers.

commit 7a19a7c
Author: Mick Vleeshouwer <mick@imick.nl>
Date:   Thu Sep 3 11:39:59 2020 +0200

    Add support for DomesticHotWaterTank (#247)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle ServerDisconnectedError during startup
2 participants