Skip to content

Commit

Permalink
Increases compliance with PEP 8.
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveL17 committed Nov 10, 2019
1 parent c468fd8 commit 7f2266b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion GhostXML.indigoPlugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>0.4.35</string>
<string>0.4.36</string>
<key>ServerApiVersion</key>
<string>2.0</string>
<key>IwsApiVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion GhostXML.indigoPlugin/Contents/Server Plugin/Devices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<!-- Timeout -->

<Field id="timeout" type="textfield" defaultValue="5" tooltip="Enter the number of seconds that the plugin should continue to try this source before giving up.">
<Field id="timeout" type="textfield" defaultValue="5" tooltip="Enter the number of seconds that the plugin should continue to try this source before giving up (integer).">
<Label>Timeout:</Label>
</Field>

Expand Down
27 changes: 15 additions & 12 deletions GhostXML.indigoPlugin/Contents/Server Plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
__copyright__ = u"There is no copyright for the GhostXML code base."
__license__ = u"MIT"
__title__ = u"GhostXML Plugin for Indigo Home Control"
__version__ = u"0.4.35"
__version__ = u"0.4.36"

# Establish default plugin prefs; create them if they don't already exist.
kDefaultPluginPrefs = {
Expand Down Expand Up @@ -92,10 +92,10 @@ def __init__(self, pluginId, pluginDisplayName, pluginVersion, pluginPrefs):

# Adding support for remote debugging in PyCharm. Other remote debugging
# facilities can be added, but only one can be run at a time.
try:
pydevd.settrace('localhost', port=5678, stdoutToServer=True, stderrToServer=True, suspend=False)
except:
pass
# try:
# pydevd.settrace('localhost', port=5678, stdoutToServer=True, stderrToServer=True, suspend=False)
# except ImportError:
# pass

self.pluginIsInitializing = False

Expand Down Expand Up @@ -170,7 +170,10 @@ def deviceStartComm(self, dev):
dev.updateStateOnServer('deviceIsOnline', value=dev.states['deviceIsOnline'], uiValue="Manual")
else:
dev.updateStateOnServer('deviceIsOnline', value=dev.states['deviceIsOnline'], uiValue="Started")
self.managedDevices[dev.id].queue.put(dev)
# DaveL17 - removed next line because devices could be refreshed twice in the
# first 2 seconds upon plugin (or device) restart. It doesn't appear to be
# necessary as a device will check within 2 seconds of deviceStartComm.
# self.managedDevices[dev.id].queue.put(dev)

self.logger.debug(u"[{0}] Communication started.".format(dev.name))

Expand All @@ -192,8 +195,8 @@ def getDeviceConfigUiXml(self, typeId, devId):

current_freq = indigo.devices[devId].pluginProps.get('refreshFreq', '15')
list_of_freqs = []
XML = self.devicesTypeDict[typeId]["ConfigUIRawXml"]
root = Etree.fromstring(XML)
xml = self.devicesTypeDict[typeId]["ConfigUIRawXml"]
root = Etree.fromstring(xml)

if typeId == 'GhostXMLdevice':

Expand Down Expand Up @@ -390,7 +393,7 @@ def validateDeviceConfigUi(self, valuesDict, typeID, devId):
return True, valuesDict, error_msg_dict

# =============================================================================
# =============================== Plugin Methods ===============================
# =============================== Plugin Methods ==============================
# =============================================================================
def adjust_refresh_time(self, valuesDict):
"""
Expand Down Expand Up @@ -702,7 +705,7 @@ def get_the_data(self, dev):
"""

try:
curlArray = dev.pluginProps.get('curlArray', '')
curl_array = dev.pluginProps.get('curlArray', '')
url = dev.pluginProps['sourceXML']
username = dev.pluginProps.get('digestUser', '')
password = dev.pluginProps.get('digestPass', '')
Expand All @@ -724,8 +727,8 @@ def get_the_data(self, dev):
# Added by GlennNZ - 2018 12 06
# if using raw Curl - don't worry about auth_Type or much else
if auth_type == "Raw":
self.host_plugin.logger.debug(u'/usr/bin/curl -vsk {0} {1}'.format(curlArray, url))
proc = subprocess.Popen('/usr/bin/curl -vsk ' + curlArray + ' ' + url, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
self.host_plugin.logger.debug(u'/usr/bin/curl -vsk {0} {1}'.format(curl_array, url))
proc = subprocess.Popen('/usr/bin/curl -vsk ' + curl_array + ' ' + url, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
# =============================================================================

# Digest auth
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ![GhostXML Logo](https://github.com/IndigoDomotics/GhostXML/wiki/img/img_ghostxmlLogo.png)
# ![shield](https://img.shields.io/github/release/IndigoDomotics/GhostXML.svg) ![indigo-version](https://img.shields.io/badge/Indigo-7.0-blueviolet.svg) ![indigo-version](https://img.shields.io/badge/Python-2.7-darkgreen.svg)
# ![shield](https://img.shields.io/github/release/IndigoDomotics/GhostXML.svg) ![indigo-version](https://img.shields.io/badge/Indigo-7.0+-blueviolet.svg) ![indigo-version](https://img.shields.io/badge/Python-2.7-darkgreen.svg)

The GhostXML plugin allows users to create custom devices for XML and
JSON data sources.
Expand Down
3 changes: 3 additions & 0 deletions _changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
GhostXML Change Log

v0.4.36
- Increases compliance with PEP 8.

v0.4.35
- Adds trigger that fires when a device has been automatically disabled by the
plugin due to failed attempts.
Expand Down

0 comments on commit 7f2266b

Please sign in to comment.