Skip to content

Commit

Permalink
Fix button entities not accepting command
Browse files Browse the repository at this point in the history
  • Loading branch information
seime committed Apr 16, 2024
1 parent c9b2829 commit aa7f367
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public ButtonMessageHandler(ESPHomeHandler handler) {
@Override
public void handleCommand(Channel channel, Command command, int key) throws ProtocolAPIError {
if (command instanceof OnOffType) {
handler.sendMessage(ButtonCommandRequest.newBuilder().setKey(key).build());
handler.updateState(channel.getUID(), OnOffType.OFF);
handler.sendMessage(ButtonCommandRequest.newBuilder().setKey(key).build());
} else {
logger.warn("Unsupported command type: {}, use OnOffType instead", command);
}
}

public void buildChannels(ListEntitiesButtonResponse rsp) {
Configuration configuration = configuration(rsp.getKey(), null, "Switch");
Configuration configuration = configuration(rsp.getKey(), null, "Button");

String icon = getChannelIcon(rsp.getIcon(), "switch");

Expand Down

0 comments on commit aa7f367

Please sign in to comment.