Open halecivo opened 1 year ago
How is this info available in Home Assistant?
The data itself comes from REST api sensor, for Prague integrated transportation, I use golemio. Currently, I just combine the data into a string state for template sensor. The problem is that displayed state of the sensor is limited to only a few characters. In order to have "proper" timetable - data could be combined to provide destination, departure, line and possibly also last known position or delay.
rest:
- resource: https://api.golemio.cz/v2/pid/departureboards?ids=U2142Z301&minutesBefore=-7
scan_interval: 60
headers:
X-Access-Token: >
<token>
sensor:
name: departures
value_template: "{{ now() }}"
json_attributes:
- "departures"
sensor:
- platform: template
sensors:
ricany_departure_1:
value_template: "{{ state_attr('sensor.departures', 'departures')[0].departure_timestamp.minutes }} m - {{ state_attr('sensor.departures', 'departures')[0].trip.headsign }}: {{ state_attr('sensor.departures', 'departures')[0].route.short_name }}"
I was thinking on how I could use this for my own thing, which is almost the same, but not exactly. We have 2 nearby stops but we use one a lot more than the other.
What if we could allow a button to support text entities, and if you select it (short/long, or one of the 3 shortcut buttons on the home page) it would open a detailed screen which would just render the text.
Could just use monospaced font and fit, e.g. 8 rows of 24 characters each and mock it like so: (with newlines to indicate next row)
PATCHAM
5 Pavillion 6 min
5a Hollingbury 10 min
52 Town Square 10 min
17 Lancing 14 min
ELDRED
27 Saltdean 3 min
27a Saltdean 23 min
I'm thinking a single multiline text entry would work. That has a max length of 255 which should be enough for that kind of table. (8 × (24+1) = 200) You could extend it with some lightweight markup (like underline or bold/colour) and it would still fit. (not important)
Should be possible to implement, I think?
@halecivo Would that work for you?
Was thinking that a button that triggers an automation that then fetches the data from the API and then calls a service on the panel e.g. send_command_table
.
This would also only check the bus api when you want to see it, and you could also send metadata for e.g. font colour or icons to show as the data is now structured.
That would only require a new service and screen for custom presentation.
If you do this, to hide latency it would be useful to send 2 service calls, one to render a screen with no info, then fetch data from API, then send call again updated with the content. And any action on it would cancel it.
The challenge is on Nextion side. There are important limitation to change the screen dynamically. The screen is made of pre-define components with some hard coded attributes not available to be changed programmatically... Like font size, position, etc. I could have multiple pages, for 3 columns, 4 columns, etc., but then it will probably get to another Nextion limitation... memory. :(
Hence my initial suggestion of monospaced text. You can simulate columns by whitespace alignment. So there's not really any concept of "columns" needed for that.
I think that would be quite easy.
Hello,
it would be awesome to see when next train departures in my hall. Line - Destination - time +delay (delay is just nice to have, I could already include it in the time).
For timetable page it would be cool to see something like this:![image](https://github.com/Blackymas/NSPanel_HA_Blueprint/assets/11456331/147e4fc7-e6e0-4847-a9aa-c109e0fc09a6)
But in order to not need to touch the display while putting my shoes on and wondering whether I'm on time, something smaller would be great to have also on the home page.
It seems that most problematic is limit to few characters for a entity state, I am able to print something like "15m - Pra", which tells me that train to Prague leaves in 15 minutes, but it is not very nice. Being able to use template as a label for entity on entity page could help me to at least display "Praha hl. n." "15 m" on a single line.