domotics.bundle  (Miscellaneous)

Contributed by: achterberg

Overview

Plugin for Flashlight.app that will allow control (on/off/dim) of selected devices remotely using RESTful URLs through IndigoServer using Spotlight (Yosemite only). Tested on Indigo 6.0.18 installed on a MacMini running OS X 10.6.8 using Spotlight on OS X Yosemite 10.10.1. This should work with any version of Indigo.

Installation

Download and install link on your client computer. Per the web site "The Spotlight plugin is gated to run only on versions 911-916 (Yosemite GM through 10.10.2 seed)".

Download the domotics.bundle package. Open domotics.bundle by right-clicking and Show Package Contents.

In plugin.py: Edit the host:port in lines beginning with search_specs = and getUrl = to point to your remote server, leaving /devices/ and /actions/. Edit the line beginning with theFile to contain the names of devices you want to control in the same format shown. CaSE matters. A method to get only devices that can be on/off controlled and are displayed is to run the following applescript: <tell application "IndigoServer" of machine "eppc://user:pass@IPaddress" to return name of every device where supports on off is true and display in remote ui is true> Or as Jay answered in another post, a python solution would be: <dev for dev in indigo.devices.iter() if 'onOffState' in dev.states and 'displayState' in dev.states> If you have an "all on" action group that you wish to control, edit the "All On" in line getDevice = "All On" to be the name of your action group. Similarly, edit the line getDevice = "All Off" to be the name of an "all off" action group. If you don't have either you can probably leave this alone or edit the python to exclude the code. Just don't call a device named "all".

In examples.txt: (Optional) Edit "iot" to be anything that is unique enough not to return conflicting Spotlight searches with file names on your system.

In info.json: If you edited anything in examples.txt, you can edit "examples" to match. You can change the plugin name by editing "name", just be sure to rename the bundle to match.

The icon can be changed by adding any .png file named icon.png, preferably 500px round format as suggested by the developer.

Close the bundle. Move the bundle package to ~/Library/FlashlightPlugins folder (in your User directory). Restart Flashlight for the ch

Usage

Open Spotlight (command-space) and type commands in the following format: iot (on/off/int) (device name)

iot on bed lamp iot off bed lamp iot 68 dining dimmer iot on all iot off all

All lower case seems to work. Will only execute if "on", "off", or a whole number between 0 and 100 (inclusive) is entered. Any float value (58.5) should fail.

The command will execute immediately without hitting return. Spotlight may ask for permission to access Keychain; click on your response. You can open Spotlight again and see the results returned by the IndigoServer in the block to the right of the top hits if you clicked Allow. If you always allow Keychain access, then the results will be returned in Spotlight without reloading.

Issues (mostly lack of python coding skills) if anyone can provide direction for improvement: The applescript.py provided by the developer doesn't seem to work. I don't get the notifications in the script, but then, the script doesn't fail either. It would be more user friendly if somehow the list of devices to be controlled could be retrieved through applescript or python remotely. If dark mode is set on Yosemite, the results returned in Spotlight are almost illegible. There is a solution on the developer’s website, but I don’t have the smarts to implement it yet. There is another solution to do this by calling a separate .py file which will not execute the command in Spotlight until return is pressed. Seems a more elegant way of doing this.