Hi,
Is there an easy to follow example for making a shortcut that just does an HTTP GET request at an url?
My plan is to make the volume up/down shortcuts call the flash server I have set up that will then send the proper CAN message to the car to turn the volume up or down, since I am using the car's builtin bluetooth for the actual music/voice streaming.
HTTP Get as Shortcut
Re: HTTP Get as Shortcut
Hello,
One possible way to do this is by using Hudiy API and Python. You can use the API to register a custom action that is then dispatched by a shortcut. Next, you can handle this action dispatch in Python and execute your HTTP request. Examples of how to register and handle custom actions can be found on our GitHub:
https://github.com/wiboma/hudiy/blob/main/README.md#api
https://github.com/wiboma/hudiy/blob/ma ... een.py#L54
https://github.com/wiboma/hudiy/blob/ma ... hAction.py
https://github.com/wiboma/hudiy/blob/ma ... proto#L725
https://github.com/wiboma/hudiy/blob/ma ... #shortcuts
One possible way to do this is by using Hudiy API and Python. You can use the API to register a custom action that is then dispatched by a shortcut. Next, you can handle this action dispatch in Python and execute your HTTP request. Examples of how to register and handle custom actions can be found on our GitHub:
https://github.com/wiboma/hudiy/blob/main/README.md#api
https://github.com/wiboma/hudiy/blob/ma ... een.py#L54
https://github.com/wiboma/hudiy/blob/ma ... hAction.py
https://github.com/wiboma/hudiy/blob/ma ... proto#L725
https://github.com/wiboma/hudiy/blob/ma ... #shortcuts
Re: HTTP Get as Shortcut
That's very helpful, thank you!
Do I need to add any handling for if the python scrips starts before Hudiy is up and running?
Do I need to add any handling for if the python scrips starts before Hudiy is up and running?
Re: HTTP Get as Shortcut
Hudiy API is provided over TCP or WebSocket. If your script launches before Hudiy, ensure it has retry logic to reconnect until the Hudiy is active. A simple 'retry every x seconds' approach will work. You can find an implementation of this simple mechanism in the idle_screen example mentioned earlier.
https://github.com/wiboma/hudiy/blob/ma ... een.py#L85
https://github.com/wiboma/hudiy/blob/ma ... een.py#L85