Skip to content

Commit

Permalink
Merge pull request #60 from Hobbit44/main
Browse files Browse the repository at this point in the history
Added button entity class
  • Loading branch information
Garulf authored Jun 27, 2024
2 parents 065e579 + e001a7e commit 0bfb5fb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plugin/homeassistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,15 @@ def _default_action(self):
def activate(self) -> None:
"""Activate scene."""
self._client.call_services("scene", "turn_on", data=self.target)

class Button(BaseEntity):
def __init__(self, client: Client, entity: dict) -> None:
super().__init__(client, entity)

def _default_action(self):
self.press()

@service(icon="gesture-tap")
def press(self) -> None:
"""Press button"""
self._client.call_services("button", "press", data=self.target)
2 changes: 2 additions & 0 deletions plugin/icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
image_broken = "F02ED"
swap_horizontal_bold = "F0BCD"
history = "F02DA"
gesture_tap = "F0741"


DEFAULT_ICONS = {
Expand All @@ -68,6 +69,7 @@
"group_off": checkbox_multiple_blank_outline,
"input_boolean": checkbox_blank_circle_outline,
"input_boolean_on": checkbox_marked,
"button": gesture_tap,
"input_select": form_select,
"input_number": counter,
"input_text": form_textbox,
Expand Down

0 comments on commit 0bfb5fb

Please sign in to comment.