So far, the component is able to switch between the built-in display modes (clock, temperature), and upload and display static images. I’m planning on adding support for animations eventually, as well as tools to make converting and loading images a little less hairy.
As an example automation using this, the Australian Bureau of Meterology publishes weather forecast feeds that include a forecast icon code, just a code representing which icon to use when displaying forecast info. I’m scraping that icon code in to a sensor (sensor.weather_forecast_icon), and using this automation to show an icon for the weather forecast on the TimeBox in the morning:
- id: timebox weather icon
alias: timebox weather icon
trigger:
platform: time
at: 06:30
action:
service: notify.timebox
data_template:
message: blank
data:
mode: image-file
file-name: >
{%- set icons = ['','sunny','clear','mostly-sunny','cloudy','','hazy-foggy','showers','windy','hazy-foggy','showers','rain','scary','scary','scary','storm','showers','showers','scary'] -%}
{%- set index = states.sensor.weather_forecast_icon.state | int -%}
{{ iconx[index] }}
Unfortunately I’m using hass.io so I’m not even able to install the dependencies if I understood correctly. I think I would have to create a component out of your code which I have no experience with up to now. I’m still trying to get started with hass.io…
Sorry, I was afraid that might be the case, but didn’t know enough about hass.io to say for sure.
Sounds like the issue is that the python module to talk to the TimeBox, in turn uses the PyBluez module for Bluetooth communication, which has native code that has to be compiled. I may be able to update the library to only use the Python standard library, but afraid with the holiday season coming up it’ll be a few weeks at least before I can dedicate any time to it.
No worries, I still think you did a great job there. I’m currently trying to use the official hass.io BCM43xx plugin to conect the Timebox at all.
Edit: Okay, I saw that many others had the idea before me but for hass.io it seems that there is no real option currently due to the plugin “limitation”. I did check the HA plugin tutorials and also suceeded with the example. However, unfortunately my skills are not good enough to port your work to a hass.io plugin. I would revert back to hassbian but there are just too many features I like about hass.io.
I’ve just pushed a new version of this custom component that removes the dependency on the PyBluez module - it now connects to the TimeBox using pure python modules. Easier to install and use, and I’m hoping it will now work with hass.io and the Bluetooth add-on. Unfortunately I don’t have a Pi3 to test that on, though.
Hi,
I’m triying to get your library or some of the others that i’ve found on Github to work with a timebox mini but no results.
The connection seems to be ok but nothing is displaying, I’m wonderring if the protocol might be different. @bigbemme did you manage to display something?
You’re almost certainly using different forks of the library I’m using for this component. Sorry, I don’t have the hardware to test the Mini, and can’t really help get it working
ATTENTION: I had some error messages that an image named ha-logo.json was missing and it was indeed not located in the images folder. I simply copied one of the existing images and adjusted it with all 15 so that you basically get a white image. Then simply rename it with ha-logo.json and that will image will be loaded after connecting eg. after a homeassisstant restart.
If you don’t want to test with an automation, you can use the “call service” function and choose your notify platform. Here are two service data examples:
Thanks to some prodding from @bigbemme I’ve uploaded a couple of missing image files to my repository. The first is ha-logo.json, which displays the homeassistant logo on the device when the component connects. The second is required to make the “off” command work; the library I’m using doesn’t actually turn the display off so I just send an all-black image.
also got a Timebox mini. I’m running hass.io and trying to use your component.
I can’t setup the platform. Maybe you can help, I just leave the log here:
Error setting up platform timebox
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/components/notify/__init__.py", line 95, in async_setup_platform
platform.get_service, hass, p_config, discovery_info)
File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
future.result()
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/notify/timebox.py", line 45, in get_service
image_dir)
File "/config/custom_components/notify/timebox.py", line 55, in __init__
self._timebox.connect(host=mac)
File "/config/deps/lib/python3.6/site-packages/timebox.py", line 40, in connect
self.socket = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM,
AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH'
*sigh*
This is telling me the the version of python hassio is installing doesn’t support bluetooth sockets. I did some digging, and found this old bug in the operating system hassio is based on. Given it’s been around so long I doubt it’ll get fixed any time soon.
Very frustrating, I put a fair amount of work in to porting the library to use bluetooth sockets specifically to try to avoid problems using this component with hassio.
Unfortunately, I don’t think there’s a lot I can do to resolve it. Looking around on the forum, doing anything apart from device tracking with bluetooth on hassio doesn’t seem to work. And right now I don’t have hardware or time to experiment trying to find another solution that will work. Sorry, but I can’t do much more than call hassio an unsupported platform for the time being
Yeah thanks anyway. I switched to hassbian and everything is working fine
Only problem i ran into, mode “off” is not working and the error message is quite funny
Invalid mode 'off', must be one of 'off', 'clock', 'temp', 'image', 'animation'
Edit: Two more questions. Why did you change the color code to something between 0-15 and did not use the ‘normal’ rgb codes (0-255)? Especially when you are obvious converting it back to ‘normal’ rgb.
My second question: Is there any way to buy you a coffee?
Well that’s embarrassing. It’s going to be a couple of weeks before I can test anything, sorry (moving soon, all of my hardware is in boxes). But until there’s a real fix, you can go ahead and use the “blank” image that’s already included to turn the display off.
So, the Timebox seems to use 4 bit colour - each channel can only display 16 colours. But the API in the backend library is a little inconsistent. Images only work properly with 4 bit colour. But a lot of other things, like setting a colour for the clock and thermometer display, use 8 bit colour (0-255). That’s why I’m doing conversion for some things. And yes, I know that that’s also my fork of the Timebox library, I might fix it eventually.
No, and I’m not planning on accepting donations for my code. But I very much appreciate the sentiment. Thank you.