Is there a way to use this in hassio?thank you
Unfortunately, no, this custom component won’t work with hassio right now. The library it depends on uses python stdlib features that aren’t supported by the python distribution hassio runs on.
I don’t know if it can be modified to work. If somebody with hassio and some time would like to try, the key will be trying to get pyBluez running, then it’s fairly trivial to switch to using it.
In my defence, I’m pretty sure that broke because of a change in Home Assistant’s API. No, seriously.
At any rate, I’ve updated the repository with a small change that should make the off mode work again. Please do update and give it a try when you’ve got time.
Yep, it’s working. Thanks!
I have added a notification mode to your script. Nothing fancy, just an alternation between an image and the blank one and switching back to the clock. I’m using it to get a feedback when an automation is called by HA.
import time
elif data.get(PARAM_MODE) == "notification":
image_filename = data.get(PARAM_FILE_NAME)
color = data.get(PARAM_COLOR)
if self.valid_color(color):
color = self.convert_color(color)
else:
color = [255, 255, 255]
for i in range(1, 7):
self.display_image_file(image_filename)
time.sleep(0.5)
self.display_image_file('blank')
time.sleep(0.5)
self._timebox.show_clock(color=color)
I also played a little bit with the animation mode. My idea is to create a subdirectory for each animation with all the files in it and loop over these files. Maybe you had an similar idea.
Just stumbled upon one of these on amazon and was happy to see someone working on HA support ! Great Work!
Has anyone tried this with the official HA Docker Image? (As there were Problems with HASS.IO)
Did someone try to use playback of audio as well as the images?
I had a quick poke at the HA docker image. It’s based on the official python:3.6
image, and a few minutes playing with that show that it also doesn’t have AF_BLUETOOTH
support. Strongly suspect the HA docker image will fail for the same reason the hassio image does.
This custom component doesn’t do anything about using the speaker as a media player in HA, sorry. It might be worth seeing if you can get this component running with your setup instead? TTS on Bluetooth speaker via Raspberry Pi
Thanks for clearing that up, sad it wont work out of the box.
One of the problems I usually have with my timebox-mini is that the clock gets out sync pretty fast, showing an incorrect time after a while.
I’ve implemented a new command to automatically sync the timebox clock from hassio.
As I’m unable to create a proper pull request in the repository (I’m not sure if it’s allowed), here is the code in case you’re interested:
diff --git a/notify/timebox.py b/notify/timebox.py
index 0b3bc64..907cf2a 100644
--- a/notify/timebox.py
+++ b/notify/timebox.py
@@ -9,6 +9,8 @@ import json, os
import logging
+import datetime
+
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
@@ -165,6 +167,12 @@ class TimeBoxNotificationService(BaseNotificationService):
image_filename = data.get(PARAM_FILE_NAME)
self.display_image_file(image_filename)
+ elif mode == "sync-clock":
+ dt = datetime.datetime.now()
+ head = [0x0A, 0x00, 0x18, dt.year % 100, int(dt.year/100),
+ dt.month, dt.day, dt.hour, dt.minute, dt.second]
+ self._timebox.send_payload(head)
+
elif mode == "animation":
# TODO
pass
This is really useful, thanks! Looking at the code, it looks like that would be better included in the python library (and browsing through the different forks of the original timebox script show it already has code to set the time, and it looks very familiar. I’ve run out of time this evening, but will sync up the library code and then update my component in the next day or two.
For what it’s worth, PRs on bitbucket follow the same workflow as github for non-contributors. You fork the repo, make changes in your fork, and then submit a pull request against the original repository. But that’s by the by, now.
I can say that the component works with timebox mini
Anything in particular that you had to do? When I scan it doesn’t find the timebox mini. Tried on both NUC and pi with no luck
Well, I did this on my laptop with Arch linux. I first paired it with blueman (default from xfce) and then started using timebox with this component.
I’m running my main HA on an x86-64 server with Debian 9. I’ll try it there in some time (I don’t have a bluetooth dongle yet) and report my findings.
I should also note that I didn’t test specific functions of timebox mini. I just confirmed that it will display images. I am only about to test if it works while streaming music with mpd into it
data_template it doesn’t work? Is any different option do similar?
- data:
data:
mode: clock
data_template:
color: >
{% if is_state('sensor.x', '0') %}[15,0,0]{% else %}[0,15,0]{% endif %}
message: ''
service: notify.ledbox
This component doesn’t work with Home Assistant 0.92.2. The file structure does not meet new requirements.
just fixed the component. seems to work fine for me.
I made a few additions to the services to interpolate colors by values.
CAVEAT: Unfortunately I don’t have time to document it - and probably will only maintain it at my own leisure.
If anyone wants to use the component: https://github.com/noheton/timebox
i’m trying to integrate your version, but i’m getting this:
Error setting up platform timebox
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/notify/__init__.py", line 78, in async_setup_platform
platform.get_service, hass, p_config, discovery_info
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/timebox/notify.py", line 57, in get_service
image_dir)
File "/home/homeassistant/.homeassistant/custom_components/timebox/notify.py", line 63, in __init__
from timebox import TimeBox
ModuleNotFoundError: No module named 'timebox'
Anyone can help me? thanks
Hi,
i have the same error message:
Error setting up platform timebox
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/notify/init.py”, line 78, in async_setup_platform
platform.get_service, hass, p_config, discovery_info
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/timebox/notify.py”, line 55, in get_service
image_dir)
File “/config/custom_components/timebox/notify.py”, line 61, in init
from timebox import TimeBox
ModuleNotFoundError: No module named ‘timebox’
Any help here, please? I am on hassio HassOS 3.7
Thanks
Anyone managed to get this working in the newer HA versions?
Thanks!