Skip to content

Commit

Permalink
Merge pull request #4 from IndigoDomotics/mmb-IndigoSDK
Browse files Browse the repository at this point in the history
Finished bringing all SDK Example Plugins up to py3 compatibility.
  • Loading branch information
indigo-jay authored Feb 27, 2022
2 parents ae36f0e + 4489c4f commit 304f959
Show file tree
Hide file tree
Showing 60 changed files with 3,939 additions and 4,148 deletions.
38 changes: 19 additions & 19 deletions Example Custom Broadcaster.indigoPlugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>2022.1.0</string>
<key>ServerApiVersion</key>
<string>3.0</string>
<key>IwsApiVersion</key>
<string>1.0.0</string>
<key>CFBundleDisplayName</key>
<string>Example Custom Broadcaster</string>
<key>CFBundleIdentifier</key>
<string>com.perceptiveautomation.indigoplugin.custom-broadcaster</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>https://wiki.indigodomo.com/doku.php?id=plugins:example_custom_broadcaster_1</string>
</dict>
</array>
<key>PluginVersion</key>
<string>2022.1.0</string>
<key>ServerApiVersion</key>
<string>3.0</string>
<key>IwsApiVersion</key>
<string>1.0.0</string>
<key>CFBundleDisplayName</key>
<string>Example Custom Broadcaster</string>
<key>CFBundleIdentifier</key>
<string>com.perceptiveautomation.indigoplugin.custom-broadcaster</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>https://wiki.indigodomo.com/doku.php?id=plugins:example_custom_broadcaster_1</string>
</dict>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<!-- If your plugin wants to add menu items to it's submenu off the new Extensions menu,
define them here. Each should have a unique menu id, a Name, and an Action. The last
is a method name in your python file that will be called when the user selects that
menu item. Note - nothing will be returned to the client, so if you need to communicate
back to the user you can post information into the Event Log.
define them here. Each should have a unique menu id, a Name, and an Action. The last
is a method name in your python file that will be called when the user selects that
menu item. Note - nothing will be returned to the client, so if you need to communicate
back to the user you can post information into the Event Log.
-->
<MenuItems>
<!--
<MenuItem id="menu1">
<Name>Something</Name>
<CallbackMethod>somethingFunc</CallbackMethod>
</MenuItem>
-->
<!--
<MenuItem id="menu1">
<Name>Something</Name>
<CallbackMethod>something_func</CallbackMethod>
</MenuItem>
-->
</MenuItems>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
####################
# Copyright (c) 2022, Perceptive Automation, LLC. All rights reserved.
# http://www.indigodomo.com
# https://www.indigodomo.com

import indigo

Expand All @@ -13,38 +13,38 @@

################################################################################
class Plugin(indigo.PluginBase):
########################################
def __init__(self, pluginId, pluginDisplayName, pluginVersion, pluginPrefs):
super(Plugin, self).__init__(pluginId, pluginDisplayName, pluginVersion, pluginPrefs)
self.debug = True
########################################
def __init__(self, plugin_id, plugin_display_name, plugin_version, plugin_prefs):
super().__init__(plugin_id, plugin_display_name, plugin_version, plugin_prefs)
self.debug = True

########################################
def startup(self):
self.logger.debug("startup called -- broadcasting startup to all subscribers")
# Broadcast to all listeners that we have started using the "broadcasterStarted"
# broadcast key. Note the key is arbitrary and will just be used by the
# subscribers in their subscribeToBroadcast() call.
indigo.server.broadcastToSubscribers("broadcasterStarted")
########################################
def startup(self):
self.logger.debug("startup called -- broadcasting startup to all subscribers")
# Broadcast to all listeners that we have started using the "broadcasterStarted"
# broadcast key. Note the key is arbitrary and will just be used by the
# subscribers in their subscribeToBroadcast() call.
indigo.server.broadcastToSubscribers("broadcasterStarted")

def shutdown(self):
self.logger.debug("shutdown called -- broadcasting shutdown to all subscribers")
# Broadcast to all listeners that we have shutdown using the "broadcasterShutdown"
# broadcast key.
indigo.server.broadcastToSubscribers(u"broadcasterShutdown")
def shutdown(self):
self.logger.debug("shutdown called -- broadcasting shutdown to all subscribers")
# Broadcast to all listeners that we have shutdown using the "broadcasterShutdown"
# broadcast key.
indigo.server.broadcastToSubscribers("broadcasterShutdown")

########################################
def runConcurrentThread(self):
try:
# Every 3 seconds broadcast to subscribers a new random color from our list:
colorList = ["red", "green", "blue", "indigo", "orange", "black", "white", "magento", "silver", "gold"]
while True:
color = colorList[random.randint(0, len(colorList)-1)]
# broadcastToSubscribers can take an additional argument to be passed to
# the subscribers. Allowed types include basic python objects: string, number,
# boolean, dict, or list. For server performance please keep the data size
# sent small (a few kilobytes at most), and try not to broadcast more frequently
# than once per second. Bursts of higher data rates should be fine.
indigo.server.broadcastToSubscribers("colorChanged", color)
self.sleep(3)
except self.StopThread:
pass # Optionally catch the StopThread exception and do any needed cleanup.
########################################
def runConcurrentThread(self):
try:
# Every 3 seconds broadcast to subscribers a new random color from our list:
color_list = ["red", "green", "blue", "indigo", "orange", "black", "white", "magento", "silver", "gold"]
while True:
color = color_list[random.randint(0, len(color_list)-1)]
# broadcastToSubscribers can take an additional argument to be passed to
# the subscribers. Allowed types include basic python objects: string, number,
# boolean, dict, or list. For server performance please keep the data size
# sent small (a few kilobytes at most), and try not to broadcast more frequently
# than once per second. Bursts of higher data rates should be fine.
indigo.server.broadcastToSubscribers("colorChanged", color)
self.sleep(3)
except self.StopThread:
pass # Optionally catch the StopThread exception and do any needed cleanup.
38 changes: 19 additions & 19 deletions Example Custom Subscriber.indigoPlugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>2022.1.0</string>
<key>ServerApiVersion</key>
<string>3.0</string>
<key>IwsApiVersion</key>
<string>1.0.0</string>
<key>CFBundleDisplayName</key>
<string>Example Custom Subscriber</string>
<key>CFBundleIdentifier</key>
<string>com.perceptiveautomation.indigoplugin.custom-subscriber</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>https://wiki.indigodomo.com/doku.php?id=plugins:example_custom_subscriber_1</string>
</dict>
</array>
<key>PluginVersion</key>
<string>2022.1.0</string>
<key>ServerApiVersion</key>
<string>3.0</string>
<key>IwsApiVersion</key>
<string>1.0.0</string>
<key>CFBundleDisplayName</key>
<string>Example Custom Subscriber</string>
<key>CFBundleIdentifier</key>
<string>com.perceptiveautomation.indigoplugin.custom-subscriber</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>https://wiki.indigodomo.com/doku.php?id=plugins:example_custom_subscriber_1</string>
</dict>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<!-- If your plugin wants to add menu items to it's submenu off the new Extensions menu,
define them here. Each should have a unique menu id, a Name, and an Action. The last
is a method name in your python file that will be called when the user selects that
menu item. Note - nothing will be returned to the client, so if you need to communicate
back to the user you can post information into the Event Log.
define them here. Each should have a unique menu id, a Name, and an Action. The last
is a method name in your python file that will be called when the user selects that
menu item. Note - nothing will be returned to the client, so if you need to communicate
back to the user you can post information into the Event Log.
-->
<MenuItems>
<!--
<MenuItem id="menu1">
<Name>Something</Name>
<CallbackMethod>somethingFunc</CallbackMethod>
</MenuItem>
-->
<!--
<MenuItem id="menu1">
<Name>Something</Name>
<CallbackMethod>something_func</CallbackMethod>
</MenuItem>
-->
</MenuItems>
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,44 @@
# -*- coding: utf-8 -*-
####################
# Copyright (c) 2022, Perceptive Automation, LLC. All rights reserved.
# http://www.indigodomo.com
# https://www.indigodomo.com

import indigo

# Note the "indigo" module is automatically imported and made available inside
# our global name space by the host process.

# Plugin ID of the Example Custom Broadcaster plugin (taken from its Info.plist file):
kBroadcasterPluginId = "com.perceptiveautomation.indigoplugin.custom-broadcaster"
BROADCASTER_PLUGINID = "com.perceptiveautomation.indigoplugin.custom-broadcaster"

################################################################################
class Plugin(indigo.PluginBase):
########################################
def __init__(self, pluginId, pluginDisplayName, pluginVersion, pluginPrefs):
super(Plugin, self).__init__(pluginId, pluginDisplayName, pluginVersion, pluginPrefs)
self.debug = True

########################################
def startup(self):
self.debugLog("startup called -- subscribing to messages from Example Custom Broadcaster plugin")
# The Example Custom Broadcaster plugin defines three broadcast keys: broadcasterStarted,
# broadcasterShutdown, and colorChanged. We subscribe to notifications of all three. The
# second argument is the broadcast key used by the broadcasting plugin, the third argument
# is the name of our callback method. In this case they are the same, but they don't have
# to be.
indigo.server.subscribeToBroadcast(kBroadcasterPluginId, "broadcasterStarted", "broadcasterStarted")
indigo.server.subscribeToBroadcast(kBroadcasterPluginId, "broadcasterShutdown", "broadcasterShutdown")
indigo.server.subscribeToBroadcast(kBroadcasterPluginId, "colorChanged", "colorChanged")

def shutdown(self):
self.logger.debug("shutdown called")

########################################
def broadcasterStarted(self):
self.logger.info("received broadcasterStarted message")

def broadcasterShutdown(self):
self.logger.info("received broadcasterShutdown message")

def colorChanged(self, arg):
self.logger.info(f"received colorChanged message: {arg}")
########################################
def __init__(self, plugin_id, plugin_display_name, plugin_version, plugin_prefs):
super().__init__(plugin_id, plugin_display_name, plugin_version, plugin_prefs)
self.debug = True

########################################
def startup(self):
self.logger.debug("startup called -- subscribing to messages from Example Custom Broadcaster plugin")
# The Example Custom Broadcaster plugin defines three broadcast keys: broadcasterStarted,
# broadcasterShutdown, and colorChanged. We subscribe to notifications of all three. The
# second argument is the broadcast key used by the broadcasting plugin, the third argument
# is the name of our callback method. In this case they are the same, but they don't have
# to be.
indigo.server.subscribeToBroadcast(BROADCASTER_PLUGINID, "broadcasterStarted", "broadcasterStarted")
indigo.server.subscribeToBroadcast(BROADCASTER_PLUGINID, "broadcasterShutdown", "broadcasterShutdown")
indigo.server.subscribeToBroadcast(BROADCASTER_PLUGINID, "colorChanged", "colorChanged")

def shutdown(self):
self.logger.debug("shutdown called")

########################################
def broadcasterStarted(self):
self.logger.info("received broadcasterStarted message")

def broadcasterShutdown(self):
self.logger.info("received broadcasterShutdown message")

def colorChanged(self, arg):
self.logger.info(f"received colorChanged message: {arg}")
38 changes: 19 additions & 19 deletions Example Database Traverse.indigoPlugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>2022.1.0</string>
<key>ServerApiVersion</key>
<string>3.0</string>
<key>IwsApiVersion</key>
<string>1.0.0</string>
<key>CFBundleDisplayName</key>
<string>Example Database Traverse</string>
<key>CFBundleIdentifier</key>
<string>com.perceptiveautomation.indigoplugin.example-db-traverse</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>https://wiki.indigodomo.com/doku.php?id=plugins:example_db_traverse_1</string>
</dict>
</array>
<key>PluginVersion</key>
<string>2022.1.0</string>
<key>ServerApiVersion</key>
<string>3.0</string>
<key>IwsApiVersion</key>
<string>1.0.0</string>
<key>CFBundleDisplayName</key>
<string>Example Database Traverse</string>
<key>CFBundleIdentifier</key>
<string>com.perceptiveautomation.indigoplugin.example-db-traverse</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>https://wiki.indigodomo.com/doku.php?id=plugins:example_db_traverse_1</string>
</dict>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<?xml version="1.0"?>
<MenuItems>
<MenuItem id="menu1">
<Name>Log Entire Database</Name>
<CallbackMethod>traverseDatabase</CallbackMethod>
</MenuItem>
<MenuItem id="menu3">
<Name>Log Devices</Name>
<CallbackMethod>traverseDevices</CallbackMethod>
</MenuItem>
<MenuItem id="menu4">
<Name>Log Triggers</Name>
<CallbackMethod>traverseTriggers</CallbackMethod>
</MenuItem>
<MenuItem id="menu5">
<Name>Log Schedules</Name>
<CallbackMethod>traverseSchedules</CallbackMethod>
</MenuItem>
<MenuItem id="menu6">
<Name>Log Action Groups</Name>
<CallbackMethod>traverseActionGroups</CallbackMethod>
</MenuItem>
<MenuItem id="menu7">
<Name>Log Control Pages</Name>
<CallbackMethod>traverseControlPages</CallbackMethod>
</MenuItem>
<MenuItem id="menu8">
<Name>Log Variables</Name>
<CallbackMethod>traverseVariables</CallbackMethod>
</MenuItem>
<MenuItem id="menu1">
<Name>Log Entire Database</Name>
<CallbackMethod>traverse_database</CallbackMethod>
</MenuItem>
<MenuItem id="menu3">
<Name>Log Devices</Name>
<CallbackMethod>traverse_devices</CallbackMethod>
</MenuItem>
<MenuItem id="menu4">
<Name>Log Triggers</Name>
<CallbackMethod>traverse_triggers</CallbackMethod>
</MenuItem>
<MenuItem id="menu5">
<Name>Log Schedules</Name>
<CallbackMethod>traverse_schedules</CallbackMethod>
</MenuItem>
<MenuItem id="menu6">
<Name>Log Action Groups</Name>
<CallbackMethod>traverse_action_groups</CallbackMethod>
</MenuItem>
<MenuItem id="menu7">
<Name>Log Control Pages</Name>
<CallbackMethod>traverse_control_pages</CallbackMethod>
</MenuItem>
<MenuItem id="menu8">
<Name>Log Variables</Name>
<CallbackMethod>traverse_variables</CallbackMethod>
</MenuItem>
</MenuItems>
Loading

0 comments on commit 304f959

Please sign in to comment.