From c83a78e829ada1fcaf24eeba07988ed8ef0b8ff8 Mon Sep 17 00:00:00 2001 From: jneilliii Date: Wed, 10 Jan 2018 18:11:53 -0500 Subject: [PATCH] 0.4.0 (#14) ### Notes - requires minimum Tasmota firmware version 5.9.0. ### Fixed - status detection related to newer Tasmota software response being different --- README.md | 4 +++- changelog.md | 8 ++++++++ octoprint_tasmota/__init__.py | 6 +++--- setup.py | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ffd6bf2..5bab95e 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ This plugin is to control ITead Sonoff devices that have been flashed with [Sonoff-Tasmota](https://github.com/arendst/Sonoff-Tasmota) via web calls. +**Requires minimum Tasmota firmware version 5.9.0.** + ## Screenshots ![screenshot](screenshot.png) @@ -24,7 +26,7 @@ Once installed go into settings and enter the ip address for your TP-Link Smartp - **Device** - The ip or hostname of tasmota device. - **Index** - - Index number reprensenting the relay to control. If using a simple single relay device leave this value blank. + - Index number reprensenting the relay to control. Leave blank for single relay devices. - **Username** - Username to connect to web interface. Currently not configurable in Tasmota, use the default username admin. - **Password** diff --git a/changelog.md b/changelog.md index fbddef9..5acaba7 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.4.0] - 2018-01-10 +### Notes +- requires minimum Tasmota firmware version 5.9.0. + +### Fixed +- status detection related to newer Tasmota software response being different + ## [0.3.0] - 2018-01-04 ### Fixed - multiple relays not being detected properly @@ -21,6 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - Initial release. +[0.4.0]: https://github.com/jneilliii/OctoPrint-Tasmota/tree/0.4.0 [0.3.0]: https://github.com/jneilliii/OctoPrint-Tasmota/tree/0.3.0 [0.2.0]: https://github.com/jneilliii/OctoPrint-Tasmota/tree/0.2.0 [0.1.0]: https://github.com/jneilliii/OctoPrint-Tasmota/tree/0.1.0 diff --git a/octoprint_tasmota/__init__.py b/octoprint_tasmota/__init__.py index d023d56..efeac03 100644 --- a/octoprint_tasmota/__init__.py +++ b/octoprint_tasmota/__init__.py @@ -87,7 +87,7 @@ def turn_on(self, plugip, plugidx, username="admin", password=""): self._tasmota_logger.debug("Turning on %s index %s." % (plugip, plugidx)) try: webresponse = urllib2.urlopen("http://" + plugip + "/cm?user=" + username + "&password=" + password + "&cmnd=Power" + str(plugidx) + "%20on").read() - response = json.loads(webresponse.split()[2]) + response = json.loads(webresponse) chk = response["POWER%s" % plugidx] except: self._tasmota_logger.error('Invalid ip or unknown error connecting to %s.' % plugip, exc_info=True) @@ -108,7 +108,7 @@ def turn_off(self, plugip, plugidx, username="admin", password=""): self._tasmota_logger.debug("Turning off %s index %s." % (plugip, plugidx)) try: webresponse = urllib2.urlopen("http://" + plugip + "/cm?user=" + username + "&password=" + password + "&cmnd=Power" + str(plugidx) + "%20off").read() - response = json.loads(webresponse.split()[2]) + response = json.loads(webresponse) chk = response["POWER%s" % plugidx] except: self._tasmota_logger.error('Invalid ip or unknown error connecting to %s.' % plugip, exc_info=True) @@ -131,7 +131,7 @@ def check_status(self, plugip, plugidx, username="admin", password=""): try: webresponse = urllib2.urlopen("http://" + plugip + "/cm?user=" + username + "&password=" + password + "&cmnd=Power" + str(plugidx)).read() self._tasmota_logger.debug("%s index %s response: %s" % (plugip, plugidx, webresponse)) - response = json.loads(webresponse.split()[2]) + response = json.loads(webresponse) chk = response["POWER%s" % plugidx] except: self._tasmota_logger.error('Invalid ip or unknown error connecting to %s.' % plugip, exc_info=True) diff --git a/setup.py b/setup.py index e53d397..aac74ca 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "OctoPrint-Tasmota" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "0.3.0" +plugin_version = "0.4.0" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module