Page 1 of 1

BASH and events

Posted: Tuesday 13 September 2016 17:22
by nosehook
Hi,

I am quite unfamiliar with Bash and I have managed to make a rudi-mental script for what I want, however it doesn't always work.

What I want:
when I flick a (virtual) switch, I want the following to happen:
1) switch on a KAKA switch
2) wait for my Harmony Hub to come online (preferably via ping)
3) wait 5 seconds
4) select the right program for the Hub (TV and surround on and at right channels etc)
5) wait 5 seconds
6) Wake my HTPC

Right now I have set up a script that does step 1,4 and 6 via a curl command and the rest via sleep. However I have not managed to check for the Hub via Bash, so right now I wait 2 minutes, however, this occasionally does not work, so I'd like to send the commands when the Hub is online.
Anybody able to help me?

Cheers,

Freek

Re: BASH and events

Posted: Tuesday 13 September 2016 18:17
by Egregius
Does the hub have a api you can call? Like json or something?

Re: BASH and events

Posted: Tuesday 13 September 2016 20:50
by nosehook
No not that I am aware no, however Domoticz can communicate with it

Re: BASH and events

Posted: Tuesday 13 September 2016 21:33
by Egregius
In step 4 you do a curl. That should be a api.
What is the url? What is the output if you open that url in a browser?

Re: BASH and events

Posted: Wednesday 14 September 2016 14:50
by nosehook
I don't know if it can be done with an API, therefore I use the url and therefore I want to check via a ping if the Hub is online.
IF it is doable via an API, where do I find the info?