Home Assistant Rack Feed
By haus47 ·
Has anyone been able to get rack / bottle data across into HA - with the aim of replicating the rack view into a card in HA?
i'd love to be able to see a rack, tap a bottle to view more info, and even consume it directly from my HA dashboard.
I gave it a go but hit a 403 when trying to access rack data, but the same integration can pull bottle info.
1 reply
Johan
Thanks for trying this, and for the clear description. The 403 was expected at the time: API tokens can only reach a fixed list of routes, and racks weren't on it yet, while bottles were.
As of version 1.245.0 (live now on cellarion.app), a token with the read scope can list a cellar's racks:
GET /api/racks?cellar=<cellar id>&summary=1
Authorization: Bearer cel_…
The answer has each rack's name, type and size, and for each slot its position and the id of the bottle in it. Two things to know:
- Tokens always get this summary form. Without summary=1 the request returns a 400. For the bottle details when someone taps a slot, call GET /api/bottles/<bottle id> with the same token.
- Refresh on changes, not on a timer. The event stream at GET /api/events/stream tells you when something in the cellar changed. That's a better trigger for reloading the rack than polling.
Consuming works too: give the token the consume scope and call POST /api/bottles/<bottle id>/consume. That covers all three parts of your card: show the rack, tap a bottle to see it, and consume it.
Tokens still can't edit racks or move bottles; that stays in the app.
You can create a token under Settings → API tokens. I'd love to see the card when it's working, so please share a screenshot here!