-
Notifications
You must be signed in to change notification settings - Fork 1
Add async_set_ev_charging_state endpoint #5
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
base: main
Are you sure you want to change the base?
Conversation
This endpoint can be used to start and stop a SolarEdge EV charger. Signed-off-by: Aric Cyr <3453844+acyr@users.noreply.github.com>
- refactor out common code in _async_ensure_smart_home_session - use exceptions for error handling - clean up comments Signed-off-by: Aric Cyr <3453844+acyr@users.noreply.github.com>
| This is required before accessing home automation APIs. | ||
| Login is performed and the Smart Home page is visited to set up session state if needed. | ||
| """ | ||
| _LOGGER.debug("Fetching home automation devices for site: %s", self.site_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong here. Move it to async_get_home_automation_devices
|
|
||
| url = f"https://monitoring.solaredge.com/services/m/api/homeautomation/v1.0/{self.site_id}/devices/{device_id}/activationState" | ||
| headers = { | ||
| "Cookie": f"SPRING_SECURITY_REMEMBER_ME_COOKIE={cookie.value}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need this? You extracted this cookie value from the session cookie jar so I don't see why you need to explicitly pass it in the header.
| # Ensure smart home session is established | ||
| try: | ||
| await self._async_ensure_smart_home_session() | ||
| except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the try/except block. You already log it in _async_ensure_smart_home_session
| # Ensure smart home session is established | ||
| try: | ||
| await self._async_ensure_smart_home_session() | ||
| except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the try/except block. You already log it in _async_ensure_smart_home_session
This endpoint can be used to start and stop a SolarEdge EV charger.