* Preliminary support for light strips
* Add color temperature range and cleanup, thanks to @darkoppressor
* Use lightstrip instead of {led,light}strip consistently everywhere
* The cli flag is now --lightstrip
* add apidocs
* Add fixture file for KL430
Signed-off-by: Kevin Wells <darkoppressor@gmail.com>
* Add discovery support, expose effect and length of the strip
* use set_light_state instead of transition_light_state
* Add tests for lightstrip
* add doctests
* Add KL430 to supported devices in README
Co-authored-by: Kevin Wells <darkoppressor@gmail.com>
* Improve installation instructions
* Add simple instructions how to install the package
* Move the list of supported devices to the end of the file
Fixes#60 (hopefully)
* Remove 'see below for devenv instructions'
* Add doctests to SmartBulb
* Add SmartDevice doctests, cleanup README.md
* add doctests for smartplug and smartstrip
* add discover doctests
* Fix bulb mock
* add smartdimmer doctests
* add sphinx-generated docs, cleanup readme a bit
* remove sphinx-click as it does not work with asyncclick
* in preparation for rtd hooking, move doc deps to be separate from dev deps
* pytestmark needs to be applied separately for each and every file, this fixes the tests
* use pathlib for resolving relative paths
* Skip discovery doctest on python3.7
The code is just fine, but some reason the mocking behaves differently between 3.7 and 3.8.
The latter seems to accept a discrete object for asyncio.run where the former expects a coroutine..
* Optimize I/O access
A single update() will now fetch information from all interesting modules,
including the current device state and the emeter information.
In practice, this will allow dropping the number of I/O reqs per homeassistant update cycle to 1,
which is paramount at least for bulbs which are very picky about sequential accesses.
This can be further extend to other modules/methods, if needed.
Currently fetched data:
* sysinfo
* realtime, today's and this months emeter stats
New properties:
* emeter_realtime: return the most recent emeter information, update()-version of get_emeter_realtime()
* emeter_today: returning today's energy consumption
* emeter_this_month: same for this month
Other changes:
* Accessing @requires_update properties will cause SmartDeviceException if the device has not ever been update()d
* Fix __repr__ for devices that haven't been updated
* Smartbulb uses now the state data from get_sysinfo instead of separately querying the bulb service
* SmartStrip's state_information no longer lists onsince for separate plugs
* The above mentioned properties are now printed out by cli
* Simplify is_on handling for bulbs
* remove implicit updates, return device responses for actions, update README.md instructions. fixes#61
* Convert to use poetry and pyproject.toml, update README
* add some resources for contributors
* minor adjustments
* ci: separate tests from linting, run using poetry
* add pytest-mock to dev requirements
* combine running tests and reporting to codecov
* generate both xml and html coverage reports
* add codecov to dev dependencies
* Add commands to control the wifi settings
Enables initial provisioning and changing the wifi network later on without the official app
* new api to smartdevice: wifi_scan() and wifi_join(ssid, password, keytype)
* cli: new subcommand 'wifi' with two commands: scan and join
* update readme to initial setup
* improvements based on code review, f-strings++
* Updated valid range to 360
with it set to 359 it will not show the color red. Just tested this with a buddies bulb - same model/fw
https://imgur.com/a/kSNZIuL
* Updated valid range to 360
with it set to 359 it will not show the color red. Just tested this with a buddies bulb - same model/fw
https://imgur.com/a/kSNZIuL
* Update valid range to 360
* Fix tests
* discover runs, prints on since of device 0
* added preliminary support for HS300
* forgot to add smartdevice to commit
* added index to CLI
* clean up dirty code
* added fake sysinfo_hs300
* changed device alias to match MAC
* #131 Move _id_to_index into smartstrip so everyone can pass index
* Update pyHS100/discover.py
Co-Authored-By: jimboca <jimboca3@gmail.com>
* refactoring to deduplicate code between smarplug and smartstrip
* fixing CI failures for devices without children
* incorporating feedback from pull request.
* fixing hound violation
* changed internal store from list of dicts to dict
* changed other methods to dictionary store as well
* removed unused optional type from imports
* changed plugs to Dict, remove redundant sys_info calls
* added more functionality for smart strip, added smart strip tests
* updated FakeTransportProtocol for devices with children
* corrected hound violations
* add click-datetime
* add (untested) discover mode
* Keep discovery and normal communication separate, uppercase magic consts
This sepearates the earlier test code for discovering devices,
and adds 5 sec timeout for gathering responses from potential devices.
This commit also uppercases magic constants.
Discovery & communication tested with HS110.
* update readme with example how to discover devices, pep8ify
* Refactor & add unittests for almost all functionality, add tox for running tests on py27 and py35
This commit adds unit tests for current api functionality.
- currently no mocking, all tests are run on the device.
- the library is now compatible with python 2.7 and python 3.5, use tox for tests
- schema checks are done with voluptuous
refactoring:
- protocol is separated into its own file, smartplug adapted to receive protocol worker as parameter.
- cleaned up the initialization routine, initialization is done on use, not on creation of smartplug
- added model and features properties, identity kept for backwards compatibility
- no more storing of local variables outside _sys_info, paves a way to handle state changes sanely (without complete reinitialization)
* Fix CI warnings, remove unused leftover code
* Rename _initialize to _fetch_sysinfo, as that's what it does.
* examples.cli: fix identify call, prettyprint sysinfo, update readme which had false format for led setting
* Add tox-travis for automated testing.
* Read from socket until no data available, disable double string encoding
HS110 sends sometimes datagrams in chunks especially for get_daystat,
this patch makes it to read until there is no more data to be read.
As json.dumps() does JSON encoding already, there's no need to str()
the year or month either.
* Add cli.py, a simple script to query devices for debugging purposes.
* allow easier importing with from pyHS100 import SmartPlug
* move cli.py to examples, add short usage into README.md
* Implement more available APIs, refactor querying code.
This commit adds access to new properties, both read & write, while keeping the old one (mostly) intact.
Querying is refactored to be done inside _query_helper() method,
which unwraps results automatically and rises SmartPlugException() in case of errors.
Errors are to be handled by clients.
New features:
* Setting device alias (plug.alias = "name")
* led read & write
* icon read (doesn't seem to return anything without cloud support at least), write API is not known, throws an exception currently
* time read (returns datetime), time write implemented, but not working even when no error is returned from the device
* timezone read
* mac read & write, writing is untested for now.
Properties for easier access:
* hw_info: return hw-specific elements from sysinfo
* on_since: pretty-printed from sysinfo
* location: latitude and longitued from sysinfo
* rssi: rssi from sysinfo
* Update README.md with examples of available features.
* Handle comments from mweinelt
* Refactor state handling, use booleans instead of strings
* Fix issues raised during the review.
Following issues are addressed by this commit:
* All API is more or less commented (including return types, exceptions, ..)
* Converted state to use
* Added properties is_on, is_off for those who don't want to check against strings.
* Handled most issues reported by pylint.
* Adjusted _query_helper() to strip off err_code from the result object.
* Fixed broken format() syntax for string formattings.
* Fix ci woes plus one typo.
* Do initialization after changing device properties, fix nits.