For people wo don’t know the software it allow me to control any software in my mac with a big selection of remote.
so i made a shity python script that open or close my light (milight/limitlessled) so when I start a tv show on my mac i can control my light or when i play music i can put disco mode on my light etc…
Since Openhab is way better than my shity script and it remember of the state of my light (last input) i want to put Openhab in my remote buddy.
To do that I juste need a terminal shell command who gonna call the miligth method in Openhab
I’m pretty new to Openly but it must have a way to send command to openhab right ?
You can POST an update/command to any ITEM by /rest API. This is the function I use in PHP on Linux to do it. I am not sure if php is standard for MacOS or it is part of a development suite, I have it mine. You can verify this by typing in the remninal php -v:
Check where the php (by typing which php) is in the system and change the path to interpretter in the first row of the script accordingly. If OpenHab runs on a different machine you should change the the url to point to the right address.
Please let me know if it worked for you.
Here is the script to switch MyMilight item to OFF:
You can use curl and do it with a one-line command. For example,
curl --header 'Content-Type: text/plain' --request POST --data 'ON' 'http://192.168.100.21:8080/rest/items/MyLight'
Where you would substitute the hostname or IP address of your openHAB server for 192.168.100.21 and the name of your item for MyLight. See also:
I’ve used curl on my Mac for testing openHAB functionality locally and my RPi server. I don’t think it ships with Mac OS X, but you can install it using Mac Ports or Homebrew.
I don’t get how the color work… i look at my code and the command was like : sendCommand (“Light_Party”, “0,80,100”) but i don’t know what the value mean