Skip to content

Commit 86d657c

Browse files
authored
0.9.12
1 parent bbb1df3 commit 86d657c

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

changelog.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [0.9.12] - 2019-02-10
8+
### Fixed
9+
- Issue introduced in previous version prevented fresh installs from working properly.
10+
711
## [0.9.11] - 2019-02-09
812
### Fixed
913
- Energy monitoring sidebar not displaying consistently.
@@ -158,8 +162,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
158162
### Added
159163
- Initial release.
160164

161-
[0.9.9]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.11
162-
[0.9.9]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.10
165+
[0.9.12]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.12
166+
[0.9.11]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.11
167+
[0.9.10]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.10
163168
[0.9.9]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.9
164169
[0.9.8]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.8
165170
[0.9.7]: https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/tree/0.9.7

octoprint_tplinksmartplug/__init__.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
from datetime import datetime
1515

1616
class tplinksmartplugPlugin(octoprint.plugin.SettingsPlugin,
17-
octoprint.plugin.AssetPlugin,
18-
octoprint.plugin.TemplatePlugin,
17+
octoprint.plugin.AssetPlugin,
18+
octoprint.plugin.TemplatePlugin,
1919
octoprint.plugin.SimpleApiPlugin,
2020
octoprint.plugin.StartupPlugin,
2121
octoprint.plugin.ProgressPlugin):
@@ -45,7 +45,7 @@ def on_after_startup(self):
4545
def get_settings_defaults(self):
4646
return dict(
4747
debug_logging = False,
48-
arrSmartplugs = [{'ip':'','label':'','icon':'icon-bolt','displayWarning':True,'warnPrinting':False,'gcodeEnabled':False,'gcodeOnDelay':0,'gcodeOffDelay':0,'autoConnect':True,'autoConnectDelay':10.0,'autoDisconnect':True,'autoDisconnectDelay':0,'sysCmdOn':False,'sysRunCmdOn':'','sysCmdOnDelay':0,'sysCmdOff':False,'sysRunCmdOff':'','sysCmdOffDelay':0,'currentState':'unknown','btnColor':'#808080','useCountdownRules':False,'countdownOnDelay':0,'countdownOffDelay':0,'emeter':None}],
48+
arrSmartplugs = [{'ip':'','label':'','icon':'icon-bolt','displayWarning':True,'warnPrinting':False,'gcodeEnabled':False,'gcodeOnDelay':0,'gcodeOffDelay':0,'autoConnect':True,'autoConnectDelay':10.0,'autoDisconnect':True,'autoDisconnectDelay':0,'sysCmdOn':False,'sysRunCmdOn':'','sysCmdOnDelay':0,'sysCmdOff':False,'sysRunCmdOff':'','sysCmdOffDelay':0,'currentState':'unknown','btnColor':'#808080','useCountdownRules':False,'countdownOnDelay':0,'countdownOffDelay':0,'emeter':{'get_realtime':{}}}],
4949
pollingInterval = 15,
5050
pollingEnabled = False
5151
)
@@ -168,15 +168,18 @@ def turn_off(self, plugip):
168168
def check_status(self, plugip):
169169
self._tplinksmartplug_logger.debug("Checking status of %s." % plugip)
170170
if plugip != "":
171+
emeter_data = None
171172
today = datetime.today()
172-
check_status_cmnd = '{"system":{"get_sysinfo":{}},"emeter":{"get_realtime":{}}}'
173+
check_status_cmnd = '{"system":{"get_sysinfo":{}}}'
173174
# ,"get_daystat":{"month":%d,"year":%d}}}' % (today.month, today.year)
175+
# ,"emeter":{"get_realtime":{}}
174176
self._tplinksmartplug_logger.debug(check_status_cmnd)
175177
response = self.sendCommand(check_status_cmnd, plugip)
176-
if self.lookup(response, *["emeter","get_realtime"]):
177-
emeter_data = response["emeter"]
178-
else:
179-
emeter_data = None
178+
179+
if "ENE" in self.lookup(response, *["system","get_sysinfo","feature"]):
180+
check_emeter_data = self.sendCommand('{"emeter":{"get_realtime":{}}}', plugip)
181+
if self.lookup(check_emeter_data, *["emeter","get_realtime"]):
182+
emeter_data = check_emeter_data["emeter"]
180183

181184
chk = self.lookup(response,*["system","get_sysinfo","relay_state"])
182185
if chk == 1:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "OctoPrint-TPLinkSmartplug"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "0.9.11"
17+
plugin_version = "0.9.12"
1818

1919
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
2020
# module

0 commit comments

Comments
 (0)