Skip to content

Conversation

@acyr
Copy link

@acyr acyr commented Jan 24, 2026

This endpoint can be used to start and stop a SolarEdge EV charger.

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)
Copy link
Collaborator

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}",
Copy link
Collaborator

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:
Copy link
Collaborator

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:
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants