Skip to content

Add Button component#22

Merged
Mossop merged 2 commits intoMossop:mainfrom
medusalix:button
Sep 26, 2025
Merged

Add Button component#22
Mossop merged 2 commits intoMossop:mainfrom
medusalix:button

Conversation

@medusalix
Copy link
Copy Markdown
Contributor

This PR adds a button component for Home Assistant (see docs here). Buttons require a command_topic instead of a state_topic, so I've decided to make both of these fields optional for the Entity struct.

One thing I'm not quite sure about is if returningError::IOError is a good idea when an Entity doesn't have a state_topic. It might make sense to introduce a new error type for that, what do you think?

Copy link
Copy Markdown
Owner

@Mossop Mossop left a comment

Choose a reason for hiding this comment

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

This looks ok. I don't want to get too specific with the errors but I agree that IOError isn't right, how about adding an Error::Invalid?

Also can you remove the command_topic from the light component as it wouldn't be needed any longer?

@medusalix medusalix requested a review from Mossop September 25, 2025 21:58
@Mossop
Copy link
Copy Markdown
Owner

Mossop commented Sep 26, 2025

Looks good, thanks!

@Mossop Mossop merged commit 57d5b9f into Mossop:main Sep 26, 2025
2 of 3 checks passed
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