API I can use?

Are there plans to create an API so I can try to use this with Home Assistant? Even something as simple as being able to send it strings to display would be nice. Though, I would really appreciate some way to create my own panels for it display.

Loving it so far!

4 Likes

Definitely. Internally, we have a basic API for pushing any image to a Tidbyt, and we also have a Python-based SDK for building full screens & apps.

Thereā€™s a bunch of work to be done to make these things public, but itā€™s a pretty high priority. I canā€™t promise a specific date, but Iā€™d like to have at least a basic public API or SDK available before the end of September.

2 Likes

Iā€™m also looking forward to the API being available. Iā€™m in the Washington, DC area, so thought I build something locally focused - maybe a Metro schedule - since you guys are all-NYC all the time :wink:

1 Like

That sounds great! Iā€™d like to provide the source of all or most of the existing apps when we make an API/SDK available. I think that would make it a lot easier to port one of the existing transit apps for a different region & transit system.

2 Likes

+1 for Home Assistant!

2 Likes

Iā€™m actually not super-familiar with Home Assistant. Iā€™m a Hubitat user though and I think itā€™s similar?

@tmcarr @Chris_Mullins Are there any specific use cases you have in mind for Home Assistant + Tidbyt? If so that would definitely help me figure out what we need to build.

2 Likes

We need to bring you over to the promise land! :slight_smile:

The API doc: https://developers.home-assistant.io/docs/api/rest/

There are ~50K installs, and I suspect that the community would be an enthusiastic adopter of the Tidbyt. Your setup even reminds me of their zones with the ā€˜Living Roomā€™ default text.

2 Likes

Well, first of all, Iā€™d be glad to help out here.

The point of something like Home Assistant is to actually take the work away from you. You (or the community) write a home-assistant integration that describes a set of capabilities inside home-assistant, for example a ā€œnotifierā€. Then users hook up their Tidbyts to home-assistant using that integration and can call that notifier with a ā€œmessageā€ which just gets sent to the Tidbyt API resulting in a notification showing up on the display. Inegrations can expose multiple entities such as Notifiers, Sensors, Switches, etcā€¦

I think the following would be good starting points for capabilities to open up in the API, which could be easily exposed as the corresponding entity types in home-assistant:

  1. Send a message to scroll across the display (notifier)
  2. Trigger a specific app to show up on the display (switch)
  3. Set the display brightness (switch)
  4. Report the current brightness level (sensor)
  5. Turn the display on/off (switch)
  6. Report the display state (on/off) (binary_sensor)
1 Like

Here is a use case I would immediately use if I had an API to cause the Tidbyt to show a message.

Currently, when the ā€œbin fullā€ state on my Roomba transitions to ā€œTrueā€, I call a notifier to send my phone a notification so I can remember to empty it when I get home. If I had my Tidbyt hooked up, Iā€™d also have it call notify.tidbyt with the same message.

This might seem like a trivial case, but you can see how this would extrapolate into a TON of use cases.

4 Likes

Wow, thanks a ton for the overview. It actually seems like Home Assistant is quite similar to Hubitat, which I have and am familiar with.

Exposing a REST API for things like a notifier and switch is actually a lot less work than a full SDK for third-party Tidbyt apps. Iā€™ll start there and let you know when we have something.

2 Likes

Hey all, happy to report that we now have a basic API available! And we just published some documentation on how to connect.

Right now, you can adjust a Tidbytā€™s brightness, and also send an image to be displayed on the device. Features in progress include showing a custom message (instead of just an image) and cycling through apps.

BTW, to use the API youā€™ll need to install the latest version of the Tidbyt iOS or Android apps. They have a new menu that lets you get the API key for your Tidbyt.

5 Likes

Home Assistant is bigger than I realized - and #1 repo on GitHub?!?

1 Like

On the topic of Home Assistant (and other API access) I would like the ability to place a temporary screen, and go back to my rotation when itā€™s over (either by trigger or timeout).

Looking for a ā€œIā€™m currently in a meetingā€ solution. I can already automate against my calendar, just need this for the UI piece. :slight_smile:

Hi All, I came up with a way to use Python with a local API, to use the Tidbyt API, from home assistant to send a message. Mind you I am NOT a developer. I did it simply because I have never built an API before and I LOVE tinkering and finding unnecessary projects for myself.

It would be a heck of a lot easier of the Tidbyt API had an improvement to do what my api is doing but here goesā€¦

Python script that does this:

  • Flask API to accept a POST call with 2 parameters: Text and Color
  • Logic to figure out the size of the text, text wrapping, determining if color is valid and assigning a default value if not
  • PIL library used to build the image based on the text and color from API with a black background
  • Base 64 encoded
  • Sent off to Tidbyt API on Flask API POST

Config in home assistant:
tidbyt:
url: http://[LOCAL IP HERE]:5000/msg?text={{text}}&color={{color}}
method: POST

Script in home assistant:
service: rest_command.tidbyt
data:
text: ā€˜{{ states(ā€™ā€˜input_text.tidbyt_textā€™ā€™) }}ā€™
color: ā€˜{{ states(ā€™ā€˜input_select.tidbyt_colorā€™ā€™) }}ā€™
image

Obviously the heart of the operation is my python code. Keep in mind this is running on my windows machine that stays on, just as a POC. I figured I would post it here and maybe it would encourage a proper solution.

My code is 130 lines with comments, white space and not much error handling haha. Not sure if I can just post that here or is there some better place

[EDIT] I do not provide an installation ID in my code, so all messages are just temporary messages that are temporarily inserted into the cycle and disappear.

1 Like

I made a little script that makes an api call towards home assistant and reads out the temperature inside and outside from two sensors and publishes it on my Tidbyt.
As a non programmer Iā€™m quite satisfied

agb - can you provide the code used in your script. interested in pulling sensor data from my HA.

Yes will try to do during the weekend

Hi,

Sorry for being late.

Started with a py script to verify the functionality.
Created a .star file
Created a .sh file that runs pixlet render and pixlet push.

HA is running on one rPI and another one runs .sh file

Python script:

from requests import get

url = ā€œhttps://YOUR IP/api/states/sensor.lumi_lumi_weather_5307_temperatureā€

headers = {
ā€œAuthorizationā€: ā€œYour Unique Codeā€,
ā€œcontent-typeā€: ā€œapplication/jsonā€,
}

response = get(url, headers=headers)
data = response.json()
temp = data[ā€˜stateā€™]

print(ā€œtemp:%sā€
%(temp))

Something like this is what the .star file like

load(ā€œrender.starā€, ā€œrenderā€)
load(ā€œhttp.starā€, ā€œhttpā€)

url_in = ā€œhttps://YOUR IP/api/states/sensor.lumi_lumi_weather_5307_temperatureā€

headers = {
ā€œAuthorizationā€: ā€œYour Unique Codeā€,
ā€œcontent-typeā€: ā€œapplication/jsonā€,
}

def main(config):
font = config.get(ā€œfontā€, ā€œ5x8ā€)
response = http.get(url_in, headers=headers)
data = response.json()
temp_in = data[ā€˜stateā€™]

return render.Root(
	child = render.Column(
	expanded=True,
	main_align="left",
	cross_align="left",
	children =[
		render.Text("Inne: %s" % temp_in, font = font,), #vit

Thanks for sharing, agb. Thereā€™s a lot of great potential in displaying sensors from HA in the Tidbyt.