Skip to content

Comments

Fixup service/actions and deprecate old#237

Merged
sveinse merged 2 commits intocustom-components:masterfrom
sveinse:feature-fix-service-deprecated
Jul 24, 2025
Merged

Fixup service/actions and deprecate old#237
sveinse merged 2 commits intocustom-components:masterfrom
sveinse:feature-fix-service-deprecated

Conversation

@sveinse
Copy link
Collaborator

@sveinse sveinse commented Jul 24, 2025

  • Fixup sevice/action calls which didn't work after v0.8 change
  • Mark commands which have button entities as deprecated

Fixes #229

* Fixup sevice/action calls which didn't work
* Mark commands which have button entities as deprecated
@sveinse sveinse added this to the v0.8 milestone Jul 24, 2025
Copy link
Contributor

@steinmn steinmn left a comment

Choose a reason for hiding this comment

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

Minor inconsistencies on the warning messages, and I think we should catch invalid commands before calling the api

_LOGGER.debug("Called stop charging")
_LOGGER.warning(
"The 'stop_charging' action is deprecated and will be removed in a future release. "
"Use the 'stop_charging' botton entity instead"
Copy link
Contributor

Choose a reason for hiding this comment

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

misspelled 'button', and all the case for the button names in the warnings should be consistent

Suggested change
"Use the 'stop_charging' botton entity instead"
"Use the 'Stop charging' button entity instead"

_LOGGER.debug("Called resume charging")
_LOGGER.warning(
"The 'resume_charging' action is deprecated and will be removed in a future release. "
"Use the 'Resume Charging' button entity instead"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Use the 'Resume Charging' button entity instead"
"Use the 'Resume charging' button entity instead"

await coordinator.trigger_poll()

async def service_handle_send_command(service_call: ServiceCall) -> None:
_LOGGER.debug("Called send command")
Copy link
Contributor

@steinmn steinmn Jul 24, 2025

Choose a reason for hiding this comment

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

Should we include an is_command_valid-check on this?̃

Copy link
Contributor

@steinmn steinmn Jul 24, 2025

Choose a reason for hiding this comment

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

🤦 Sorry, just realized we built that into the command-function, nevermind

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I was looking at that iter_objects() function yesterday and was going WTF. It definitely can be made simpler. Its hard to understand as it it, but at this point I don't want to open that box of worms. Goal now is to get v0.8 out.

@sveinse
Copy link
Collaborator Author

sveinse commented Jul 24, 2025

Everything should be fixed now.

Copy link
Contributor

@steinmn steinmn left a comment

Choose a reason for hiding this comment

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

LGTM

@sveinse sveinse merged commit 84c06e3 into custom-components:master Jul 24, 2025
1 check passed
@sveinse sveinse deleted the feature-fix-service-deprecated branch July 24, 2025 18:53
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.

Commands issued via the service call is broken

2 participants