Skip to content

Commit

Permalink
added aurabox to supported devices
Browse files Browse the repository at this point in the history
  • Loading branch information
d03n3rfr1tz3 committed Jun 22, 2024
1 parent cef2add commit 35ce2e9
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ notify:
* `mac` (Required): The Bluetooth MAC address for the Divoom device.
* `port` (Optional): The Bluetooth channel for the Divoom device. Typically 1, but might be 2 for some devices with audio features.
* `device_type`: The concrete type of your Divoom device. \
Currently `ditoo`, `pixoo`, `pixoomax`, `timebox`, `timeboxmini`, `tivoo` are supported.
Currently `aurabox`, `ditoo`, `pixoo`, `pixoomax`, `timebox`, `timeboxmini`, `tivoo` are supported.
* `media_directory` (Required): A directory, relative to the configuration dir, containing image
files in GIF format. The component will use these to display static or animated images on the device.
* `escape_payload` (Optional): Adds escaping of the payload, which might be important for some older Divoom devices with
Expand Down Expand Up @@ -639,6 +639,7 @@ UI: \

### Examples per Device
You can find more examples for each mode and all supported devices in separate files: \
Examples for Aurabox: [devices/aurabox.txt](https://github.com/d03n3rfr1tz3/hass-divoom/blob/main/custom_components/divoom/devices/aurabox.txt) \
Examples for Ditoo: [devices/ditoo.txt](https://github.com/d03n3rfr1tz3/hass-divoom/blob/main/custom_components/divoom/devices/ditoo.txt) \
Examples for Pixoo: [devices/pixoo.txt](https://github.com/d03n3rfr1tz3/hass-divoom/blob/main/custom_components/divoom/devices/pixoo.txt) \
Examples for Pixoo Max: [devices/pixoomax.txt](https://github.com/d03n3rfr1tz3/hass-divoom/blob/main/custom_components/divoom/devices/pixoomax.txt) \
Expand Down
11 changes: 7 additions & 4 deletions custom_components/divoom/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async def async_step_user(
for discovery_info in async_discovered_service_info(self.hass, False):
if discovery_info.address in self._discovered_devices:
continue
if discovery_info.name.startswith("Ditoo") or discovery_info.name.startswith("Pixoo") or discovery_info.name.startswith("Timebox") or discovery_info.name.startswith("Tivoo"):
if discovery_info.name.startswith("Aurabox") or discovery_info.name.startswith("Ditoo") or discovery_info.name.startswith("Pixoo") or discovery_info.name.startswith("Timebox") or discovery_info.name.startswith("Tivoo"):
self._discovered_devices[discovery_info.address] = discovery_info

discovered_titles = [
Expand Down Expand Up @@ -172,12 +172,14 @@ async def async_step_device_type(
return await self.async_step_confirm()

device_type = ""
if self._device_name.startswith("PixooMax") or self._device_name.startswith("Pixoo Max"):
if self._device_name.startswith("Aurabox"):
device_type = "aurabox"
elif self._device_name.startswith("Ditoo"):
device_type = "ditoo"
elif self._device_name.startswith("PixooMax") or self._device_name.startswith("Pixoo Max"):
device_type = "pixoomax"
elif self._device_name.startswith("Pixoo"):
device_type = "pixoo"
elif self._device_name.startswith("Ditoo"):
device_type = "ditoo"
elif self._device_name.startswith("TimeboxMini") or self._device_name.startswith("Timebox Mini"):
device_type = "timeboxmini"
elif self._device_name.startswith("Timebox"):
Expand All @@ -187,6 +189,7 @@ async def async_step_device_type(
self._device_type = device_type

device_types = [
"aurabox",
"ditoo",
"pixoo",
"pixoomax",
Expand Down
28 changes: 28 additions & 0 deletions custom_components/divoom/devices/aurabox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Provides class Aurabox that encapsulates the Aurabox Bluetooth communication."""

from .divoom import Divoom

class Aurabox(Divoom):
"""Class Aurabox encapsulates the Aurabox Bluetooth communication."""
def __init__(self, host=None, mac=None, port=1, escapePayload=False, logger=None):
self.type = "Aurabox"
self.size = 10
Divoom.__init__(self, host, mac, port, escapePayload, logger)

def show_scoreboard(self, blue=None, red=None):
"""Show scoreboard on the Divoom device with specific score"""
if blue == None: blue = 0
if isinstance(blue, str): blue = int(blue)
if red == None: red = 0
if isinstance(red, str): red = int(red)

args = [0x06, 0x00]
args += red.to_bytes(2, byteorder='little')
args += blue.to_bytes(2, byteorder='little')
return self.send_command("set view", args)

def show_lyrics(self):
self.logger.warning("{0}: this device does not support lyrics view.".format(self.type))

def send_keyboard(self, value=None):
self.logger.warning("{0}: this device does not support changing the keyboard light.".format(self.type))
138 changes: 138 additions & 0 deletions custom_components/divoom/devices/aurabox.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# turn off the display
message: 'off'
data:

# change brightness of the display
message: 'brightness'
data:
brightness: 75

# activate channel 'clock' in rainbow style with specific components
message: 'clock'
data:
clock: 1
weather: 0
temp: 0
calendar: 1
color: [250, 0, 0]

# activate channel 'clock' in analog style with specific components
message: 'clock'
data:
clock: 5
weather: 1
temp: 1
calendar: 1
color: [0, 250, 0]

# activate light mode with specific color
message: 'light'
data:
brightness: 75
color: [250, 0, 0]

# activate light mode with fading colors
message: 'light'
data:
brightness: 75

# activate channel 'effects' with specific effect
message: 'effects'
data:
number: 2

# activate channel 'visualization' with specific visualization
message: 'visualization'
data:
number: 2

# activate scoreboard with some scores
message: 'scoreboard'
data:
player1: 2
player2: 1

# activate channel 'lyrics'
message: 'lyrics'
data:

# activate an image or animation, depending of the number of frames found in the file
message: 'image'
data:
file: 'ha16.gif'

# update date and time
message: 'datetime'
data:
value: '2024-12-31 18:30:00'

# update weather by setting 25°C and rainy weather
message: 'weather'
data:
value: '25°C'
weather: 6

# change the play/pause state
message: 'playstate'
data:
value: 1

# change the volume
message: 'volume'
data:
volume: 75

# activates the radio and sets the frequency to 100.3
message: 'radio'
data:
value: 1
frequency: 100.3

# activates the countdown with 1 minute and 30 seconds
message: 'countdown'
data:
countdown: '01:30'

# activates the noise meter
message: 'noise'
data:
value: 1

# activates the timer
message: 'timer'
data:
value: 1

# activates the alarm in the first slot for 7:30 in the morning on monday-friday
message: 'alarm'
data:
number: 0
value: '07:30'
weekday:
- mon
- tue
- wed
- thu
- fri

# activates the memorial in the first slot for 0:00 new year
message: 'memorial'
data:
number: 0
value: '2000-12-31 00:00:00'
text: 'Happy New Year!'

# activates the third game, which should be the magic 8 ball
message: 'game'
data:
value: 2

# sends the GO control to the current game
message: 'gamecontrol'
data:
value: 'go'

# sends a raw command which sets brightness to 100%
message: 'raw'
data:
raw: [0x74, 0x64]
9 changes: 9 additions & 0 deletions custom_components/divoom/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"domain": "divoom",
"name": "Divoom",
"bluetooth": [
{
"local_name": "Aurabox*"
},
{
"local_name": "Ditoo*"
},
Expand All @@ -25,6 +28,12 @@
"requirements": [ "pillow>=7.2.0" ],
"version": "1.1.0",
"zeroconf": [
{
"type": "_divoom_esp32._tcp.local.",
"properties": {
"device_name": "aurabox*"
}
},
{
"type": "_divoom_esp32._tcp.local.",
"properties": {
Expand Down
12 changes: 8 additions & 4 deletions custom_components/divoom/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ def __init__(self, host, mac, port, device_type, media_directory, escape_payload
self._device = None
self._media_directory = media_directory

if device_type == 'aurabox':
from .devices.aurabox import Aurabox
self._device = Aurabox(host=host, mac=mac, port=port, escapePayload=escape_payload, logger=_LOGGER)

if device_type == 'ditoo':
from .devices.ditoo import Ditoo
self._device = Ditoo(host=host, mac=mac, port=port, escapePayload=escape_payload, logger=_LOGGER)

if device_type == 'pixoo':
from .devices.pixoo import Pixoo
self._device = Pixoo(host=host, mac=mac, port=port, escapePayload=escape_payload, logger=_LOGGER)
Expand All @@ -188,10 +196,6 @@ def __init__(self, host, mac, port, device_type, media_directory, escape_payload
from .devices.tivoo import Tivoo
self._device = Tivoo(host=host, mac=mac, port=port, escapePayload=escape_payload, logger=_LOGGER)

if device_type == 'ditoo':
from .devices.ditoo import Ditoo
self._device = Ditoo(host=host, mac=mac, port=port, escapePayload=escape_payload, logger=_LOGGER)

if self._device is None:
_LOGGER.error("device_type {0} does not exist, divoom will not work".format(media_directory))
elif not os.path.isdir(media_directory):
Expand Down

0 comments on commit 35ce2e9

Please sign in to comment.