I recently found the Public Transport Victoria (PTV) custom integration which returns upcoming departures for our local station. I plan do use this to send a ping when we are getting ready / leaving work (if at work, not on holiday etc.) of the upcoming next trains [good wife points ]. This integration has an entity for each of the next 5 trains on the route requested (e.g. sensor.city_to_home_station_0
, _1
etc.)
In the attributes for each next train there is also a list of disruptions IDs, these can be used with the PTV API to return details about current disruptions for that service, my next plan was to have these disruptions sent via a phone notification.
I have written a template which takes these disruption IDs removes ones that are in an input_text ignore list (as some are constant e.g. car park closed for work).
I have also written cobbled together a python script (borrowing some of bremorās code) to take an input list of disruptions and return a string of the titles.
I was all good and ready to use the python_script integration to send data:
and then update an input_text
with hass.services.call("input_text", "set", service_data)
with the disruptions but then i found that import isnāt allowed - i probably should have read the wiki properly.
Does anyone have any thoughts on how to best approach this next? Is there a way to send some data to an external python script and get a response back to then spit out a notification?
My other thought was to update the custom integration - i think it might be beyond me with my coding but i also really donāt see how the disruptions would fit into standard Home Assistant structure either, especially with an ignore list etc. Has anyone seen something like i have described before in another integration.
I might just be asking too much here and perhaps i need to use a shell script and another method of sending a message to my phone, and just calling a shell_command