Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The Divoom Timebox Mini is a Bluetooth speaker with a 11x11 RGB LED matrix.
This component allow to run the following actions on your Timebox Mini from a HomeAssistant service:
- Set the clock automatically from your system clock
- Display the clock
- Set the LED color of clock and weather
- Set the audio volume level
- Set the LED brightness level
- Display the weather information (you have to use Divoom phone app to send weather info to your timebox)
Expand Down
11 changes: 9 additions & 2 deletions custom_components/timebox_mini/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
DOMAIN = "timebox_mini"
ATTR_MAC = "mac_addr"
ATTR_ACTION = "action"
ATTR_COLOR = "color"
ATTR_IMAGE = "image"
ATTR_ANIM = "animation"
ATTR_VOLUME = "volume"
Expand Down Expand Up @@ -253,8 +254,6 @@ def handle_action(call):
_LOGGER.error('Error connecting to %s : %s' % (mac, e))
return

c = color_convert(Color("white").get_rgb())

if action == "image":
image = call.data.get(ATTR_IMAGE, "home_assistant_black")
_LOGGER.debug('Action : image %s' % (dir_path + "/matrices/" + image + ".png"))
Expand Down Expand Up @@ -286,12 +285,20 @@ def handle_action(call):
attributes={'animation': anim})

elif action == "weather":
# Get color from attribute
clr = call.data.get(ATTR_COLOR, "white")
# Convert color in rgb
c = color_convert(Color(clr).get_rgb())
_LOGGER.debug('Action : weather')
dev.send(set_temp_color(c[0], c[1], c[2], 0xff))
hass.states.set(entity_id=DOMAIN + "." + slugify(mac) + "_current_view",
new_state=action)

elif action == "clock":
# Get color from attribute
clr = call.data.get(ATTR_COLOR, "white")
# Convert color in rgb
c = color_convert(Color(clr).get_rgb())
_LOGGER.debug('Action : clock')
dev.send(set_time_color(c[0], c[1], c[2], 0xff))
hass.states.set(entity_id=DOMAIN + "." + slugify(mac) + "_current_view",
Expand Down
18 changes: 18 additions & 0 deletions custom_components/timebox_mini/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ action:
- "set_volume"
- "set_time"
- "set_brightness"

color:
name: Color
description: The color to use for the action
required: true
example: "red"
default: "white"
# Selector (https://www.home-assistant.io/docs/blueprint/selectors/) to control the input UI for this field
selector:
select:
options:
- "white"
- "red"
- "green"
- "blue"
- "yellow"
- "cyan"
- "magenta"

image:
name: Image name
Expand Down