Skip to content

Commit

Permalink
Merge pull request #17 from DaveL17/main
Browse files Browse the repository at this point in the history
Additional standardization and minor clean up.
  • Loading branch information
indigo-jay authored Feb 12, 2025
2 parents 23765f5 + 5416965 commit 85ae892
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def shutdown(self: indigo.PluginBase) -> None:
def runConcurrentThread(self: indigo.PluginBase) -> None:
"""
This method, if defined, will be started up in a separate thread, so that it runs in parallel with the main
plugin thread which processes all of the other method calls. Note that it should be called with an infinite
plugin thread which processes all the other method calls. Note that it should be called with an infinite
loop wrapped in a try block which catches self.StopThread, which is your signal that the plugin is about to
shut down.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def log_action_group(self: indigo.PluginBase, elem: any):
####################
def log_control_page(self: indigo.PluginBase, elem: any) -> None:
self.log_base_elem(elem, indigo.controlPages.folders)
self.log_element("hide tabbar", elem.hideTabBar)
self.log_element("hide tab bar", elem.hideTabBar)
if len(elem.backgroundImage) > 0:
self.log_element("background image", elem.backgroundImage)
# TODO: Need to log additional properties after they are implemented here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Plugin(indigo.PluginBase):
########################################
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: bool = False
self.debug: bool = True

########################################
def startup(self):
Expand All @@ -35,7 +35,7 @@ def shutdown(self):
# deviceStartComm() is called on application launch for all of our plugin defined
# devices, and it is called when a new device is created immediately after its
# UI settings dialog has been validated. This is a good place to force any properties
# we need the device to have, and to cleanup old properties.
# we need the device to have, and to clean up old properties.
def deviceStartComm(self, dev):
# self.logger.debug(f"deviceStartComm: {dev.name}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def runConcurrentThread(self):
key_val_list = []
key_val_list.append({'key':'sensorValue', 'value':example_temp_float, 'uiValue':example_temp_str})
# Override the state icon shown (in Indigo Touch and client Main Window)
# for this device to be the a temperature sensor:
# for this device to be a temperature sensor:
if dev.onState is not None:
key_val_list.append({'key':'onOffState', 'value':not dev.onState})
dev.updateStatesOnServer(key_val_list)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Plugin(indigo.PluginBase):
########################################
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: bool = False
self.debug: bool = True
self.simulate_temp_changes = True # Every few seconds update to random temperature values
self.simulate_humidity_changes = True # Every few seconds update to random humidity values
self.refresh_delay = 2 # Simulate new temperature values every 2 seconds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Plugin(indigo.PluginBase):
def __init__(self, plugin_id, plugin_display_name, plugin_version, plugin_prefs, **kwargs):
super().__init__(plugin_id, plugin_display_name, plugin_version, plugin_prefs, **kwargs)
self.debug: bool = True
# Set up the environment for Jinja templates. The most important to to configure the file system loader so that
# it points to our Resources/templates directory. Then we can just load the template via name (or name and
# relative path within that folder if we choose).
# Set up the environment for Jinja templates. The most important thing to configure is the file system loader
# so that it points to our Resources/templates directory. Then we can just load the template via name (or name
# and relative path within that folder if we choose).
self.templates = jinja2.Environment(
loader=jinja2.FileSystemLoader("../Resources/templates"),
autoescape=True,
Expand Down Expand Up @@ -116,8 +116,8 @@ def handle_static_file_request(self, action, dev=None, caller_waiting_for_result
** IMPORTANT **
This example is here to illustrate one way to return a file from a plugin without putting it into one of the
directories that are automatically served within the Resources folder (see the README.txt file in the Server Plugin
folder for details on how the Indigo Web Server can automatically serve up content from your plugin.
directories that are automatically served within the Resources folder (see the README.txt file in the Server
Plugin folder for details on how the Indigo Web Server can automatically serve up content from your plugin.)
http://localhost:8176/message/com.indigodomo.indigoplugin.example-http-responder/handle_static_file_request/?file-name=test.csv
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0"?>
<!-- If your plugin wants to add menu items to it's submenu off the new Extensions menu,
<!-- If your plugin wants to add menu items to its 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.
-->
<MenuItems>
<!--
<!--
<MenuItem id="menu1">
<Name>Something</Name>
<CallbackMethod>something_func</CallbackMethod>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

########################################
# Tiny function to convert a list of integers (bytes in this case) to a
# hexidecimal string for pretty logging.
# hexadecimal string for pretty logging.
def convert_list_to_hex_str(byte_list):
return ' '.join([f"{byte:02X}" for byte in byte_list])

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ the Indigo Server. Indigo Plugins allow new native devices, triggers, and action
latest [extensive technical documentation](https://www.indigodomo.com/docs/documents#technical_documents) is available online, including:

- [Indigo Scripting Tutorial](https://www.indigodomo.com/docs/plugin_scripting_tutorial) - dive into scripting Indigo by examples.
- [Indigo 2024.1 Plugin Developer's Guide](https://www.indigodomo.com/docs/plugin_guide) - how to create plugin bundles for easy distribution, plugin UI, APIs,
- [Indigo Plugin Developer's Guide](https://www.indigodomo.com/docs/plugin_guide) - how to create plugin bundles for easy distribution, plugin UI, APIs,
callback hooks, and more.
- [Indigo Object Model Reference](https://www.indigodomo.com/docs/object_model_reference) - the Indigo Object Model (IOM) and how to use it in Python.

**Plugins Examples**
**Plugin Examples**
Several Indigo Plugin examples are included in this SDK. These examples include the full python source code and XML
files. To see all the source files once downloaded to your Mac, right-click (or control-click) on the plugin bundle
(.indigoPlugin file) and select **Show Package Contents** menu item. The [Plugin Developer's Guide](https://www.indigodomo.com/docs/plugin_guide) has thorough
Expand All @@ -22,7 +22,6 @@ also change your plugin's display name (`CFBundleDisplayName`) and help URL (`CF
[Info.plist section of the Developer's Guide](https://www.indigodomo.com/docs/plugin_guide#the_infoplist_file) for additional details.

**Development Support**

For help with plugin development, or to report any API problems or requests, join us on our
[active and helpful developer forum.](https://forums.indigodomo.com/viewforum.php?f=18)

Expand Down

0 comments on commit 85ae892

Please sign in to comment.