* Fix unsafe __del__ in TPLinkSmartHomeProtocol
Fixes
```
Exception ignored in: <function TPLinkSmartHomeProtocol.__del__ at 0x1096d0670>
Traceback (most recent call last):
File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/kasa/protocol.py", line 159, in __del__
self.writer.close()
File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/streams.py", line 353, in close
return self._transport.close()
File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 700, in close
self._loop.call_soon(self._call_connection_lost, None)
File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 748, in call_soon
self._check_thread()
File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 785, in _check_thread
raise RuntimeError(
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one
```
* comment
* comment
* comment
* Keep connection open and lock to prevent duplicate requests
* option to not update children
* tweaks
* typing
* tweaks
* run tests in the same event loop
* memorize model
* Update kasa/protocol.py
Co-authored-by: Teemu R. <tpr@iki.fi>
* Update kasa/protocol.py
Co-authored-by: Teemu R. <tpr@iki.fi>
* Update kasa/protocol.py
Co-authored-by: Teemu R. <tpr@iki.fi>
* Update kasa/protocol.py
Co-authored-by: Teemu R. <tpr@iki.fi>
* dry
* tweaks
* warn when the event loop gets switched out from under us
* raise on unable to connect multiple times
* fix patch target
* tweaks
* isrot
* reconnect test
* prune
* fix mocking
* fix mocking
* fix test under python 3.7
* fix test under python 3.7
* less patching
* isort
* use mocker to patch
* disable on old python since mocking doesnt work
* avoid disconnect/reconnect cycles
* isort
* Fix hue validation
* Fix latitude_i/longitude_i units
Co-authored-by: Teemu R. <tpr@iki.fi>
* Avoid temp array during encrypt
* black
* Update kasa/protocol.py
Co-authored-by: Teemu R. <tpr@iki.fi>
* Update kasa/protocol.py
* update decrypt as well
Co-authored-by: Teemu R. <tpr@iki.fi>
* Move tests to device-type specific test files to make improvements more approachable
* protocol: remove the port parameter from query, as there are no other known ports, fix docstrings
* Revise docstrings, remove superfluous information and remove unused methods ({set,get_icon} and set_time)
* cli: indent device output to make it more easily readable when having multiple devices
* remove adjust flake8 ignores (we have no setup.py anymore)
* pyproject: include cli tool to coverage, add config for interrogate (docstring coverage)
* bulb: raise exception on color_temp error cases instead of returning zero values
* improve bulb tests, simplify conftest
* strip: rename plugs property to children and move it to smartdevice
* async++, small powerstrip improvements
* use asyncclick instead of click, allows defining the commands with async def to avoid manual eventloop/asyncio.run handling
* improve powerstrip support:
* new powerstrip api: turn_{on,off}_by_{name,index} methods
* cli: fix on/off for powerstrip using the new apis
* add missing update()s for cli's hsv, led, temperature (fixes#43)
* prettyprint the received payloads when debug mode in use
* cli: debug mode can be activated now with '-d'
* update requirements_test.txt
* remove outdated click-datetime, replace click with asyncclick
* debug is a flag
* make smartstripplug to inherit the sysinfo from its parent, allows for simple access of general plug properties
* proper bound checking for index accesses, allow controlling the plug at index 0
* remove the mess of turn_{on,off}_by_{name,index}, get_plug_by_{name,index} are enough.
* adapt cli to use that
* allow changing the alias per index
* use f-strings consistently everywhere in the cli
* add tests for get_plug_by_{index,name}