Push notification from bash to Kodi

Hi there,

Background:
I have a OSMC installation running on my RPI and I’m using and IPTV service which requires me to update the IP address on there web page every time my ISP is reseting my connection.
Which was very annoying, cause every time my public IP changes I had to start my PC go onto IPTV provider web page, login and press on a magic “Update IP” button.

Achievements so far:
I success to automate this process with a script which runs and post an update on IPTV provider page to update my IP.
Same script sends me a push notification using pushbullet to my phone.

Problem is that I’m not the only user of the OSMC + TV in the house and I would like to inform the family member which is watching IPTV about this change, cause usually when my IP changes there is a short interruption and IPTV channel need’s to be restarted…
Specially when I’m not at home…cause I don’t want to hear complains like “again tv is not working!”

So I would like to use the same bash script to send also a notification in Kodi that the IP has changed and the channel needs to be restarted.

Is there a way to send push notification from bash to kodi?
Would pushbullet add-on be an option?

There is a pushbullet addon for kodi pretty easy to use since you seem to be using pushbullet for the rest

curl -X POST -H “Content-Type: application/json” -d ‘{“jsonrpc”:“2.0”,“method”:“GUI.ShowNotification”,“params”:{“title”:“add you title here”,“message”:“add your message here”},“id”:1}’ http://user:pass@localhost:port/jsonrpc

http://kodi.wiki/view/JSON-RPC_API/v6#GUI.ShowNotification

I’ll give a try to pushbullet add-on…

The curl command is giving me an error…
{“error”:{“code”:-32700,“message”:“Parse error.”},“id”:null,“jsonrpc”:“2.0”}
I used my username and password as well as the port configured in kodi…

sorry. updated. id must be integer

An easier way to send a notification to Kodi from a shell script is to use xbmc-send:

xbmc-send -a "Notification(My header,This is my message)"

In fact any action from the built in functions list can be performed with this command…

http://kodi.wiki/view/List_of_built-in_functions

3 Likes

Thanks for that… I’m testing at the moment pushbullet.
But I’m also looking into the bash options.
Thanks for the ideas :smile: