BASH and events

All kinds of 'OS' scripts
Post Reply
nosehook
Posts: 17
Joined: Thursday 31 March 2016 20:49
Target OS: Raspberry Pi
Domoticz version:
Contact:

BASH and events

Post by nosehook » Tuesday 13 September 2016 17:22

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
1 x RPi B+ Domoticz | 1 x RPi B+ OpenElec | 1 x RPi 3 RetroPie | 1 x RFXcom 433E | 6 x KAKU/COCO |
1 x Logitech Harmony Hub |1 x Panasonic TV | 1 x KODI (win) | 1 x YouLess | 1 x HS100 | VoxCommando (win)

User avatar
Egregius
Posts: 2416
Joined: Thursday 09 April 2015 12:19
Target OS: Raspberry Pi
Domoticz version: BetaRPi2
Location: Beitem, BE
Contact:

Re: BASH and events

Post by Egregius » Tuesday 13 September 2016 18:17

Does the hub have a api you can call? Like json or something?

nosehook
Posts: 17
Joined: Thursday 31 March 2016 20:49
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: BASH and events

Post by nosehook » Tuesday 13 September 2016 20:50

No not that I am aware no, however Domoticz can communicate with it
1 x RPi B+ Domoticz | 1 x RPi B+ OpenElec | 1 x RPi 3 RetroPie | 1 x RFXcom 433E | 6 x KAKU/COCO |
1 x Logitech Harmony Hub |1 x Panasonic TV | 1 x KODI (win) | 1 x YouLess | 1 x HS100 | VoxCommando (win)

User avatar
Egregius
Posts: 2416
Joined: Thursday 09 April 2015 12:19
Target OS: Raspberry Pi
Domoticz version: BetaRPi2
Location: Beitem, BE
Contact:

Re: BASH and events

Post by Egregius » Tuesday 13 September 2016 21:33

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?

nosehook
Posts: 17
Joined: Thursday 31 March 2016 20:49
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: BASH and events

Post by nosehook » Wednesday 14 September 2016 14:50

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?
1 x RPi B+ Domoticz | 1 x RPi B+ OpenElec | 1 x RPi 3 RetroPie | 1 x RFXcom 433E | 6 x KAKU/COCO |
1 x Logitech Harmony Hub |1 x Panasonic TV | 1 x KODI (win) | 1 x YouLess | 1 x HS100 | VoxCommando (win)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest