Pierre Ståhl
66fdc164a3
Make connection retries every minute ( #288 )
...
* Make connection retries every minute
This mimics the re-connect loop previosuly present, but in a simpler
form. Every 60 seconds, a new connection attempt is made as well as
initially when a device is set up.
* Fix device look up in reconnect loop
2021-03-05 23:16:27 +01:00
Pierre Ståhl
654c6cdc62
Support adding and removing entities to devices ( #191 )
...
New entities can be added via + button under Integrations (like when
adding a new device) and entities can be removed from Options.
2020-12-17 21:36:24 +01:00
Pierre Ståhl
acd70b655c
Fix name issue from pylint changes ( #252 )
2020-12-17 14:03:40 +01:00
Pierre Ståhl
52bf9cc814
Add dependabot config ( #249 )
2020-12-17 10:52:34 +01:00
Pierre Ståhl
f72cbc0b5a
Run pylint from tox ( #243 )
2020-12-17 09:26:55 +01:00
Pierre Ståhl
aeb27a4d75
Fix improper closing in config flow ( #237 )
...
Forgot to add an await to the close method in pytuya when validating the
device. This results in the connection never being closed after adding a
device, giving "connection resets" until the connection fails, the
device or Home Assistant is restarted.
2020-12-15 10:56:45 +01:00
Pierre Ståhl
e7d58be91c
Add localtuya.set_dp service ( #236 )
2020-12-15 09:36:34 +01:00
Pierre Ståhl
10e55e67b4
Add support for passive devices ( #171 )
...
* Add support for passive devices
* Fix a few issues
* Fix broken handling of closing a connection
This fixes the following error:
AttributeError: 'NoneType' object has no attribute 'write'
* Always use discovery broadcasts to trigger connects
From now on there's no connect loop but all attempts are initiated by
received discovery messages.
* Fix cancelling of heartbeat task
* Verify entry has been loaded before connecting
* Don't reset seqno when switching to type_d device
2020-12-15 09:08:46 +01:00
Pierre Ståhl
b50ee8bb94
Properly close discovery listeners ( #225 )
...
Fixes #214
2020-12-07 22:20:21 +01:00
Pierre Ståhl
52c62c5596
Fix typo of dp_id in fan platform ( #178 )
2020-11-22 07:21:41 +01:00
Pierre Ståhl
566859501d
Add missing variable to log point ( #174 )
2020-11-20 11:00:57 +01:00
Pierre Ståhl
f376d8584a
Fix broken exception logging ( #173 )
2020-11-20 10:40:35 +01:00
Pierre Ståhl
27af622405
Store product key in config entry ( #170 )
2020-11-19 10:13:00 +01:00
Pierre Ståhl
1dbae752ef
Give error if no DPS are found in config flow ( #167 )
...
Fixes #153
2020-11-18 11:39:11 +01:00
Pierre Ståhl
0531a284c7
Add contextual logging where applicable ( #124 )
...
* Add contextual logging where applicable
* Compress device id in log output
2020-11-17 12:54:01 +01:00
Pierre Ståhl
c8a44019fa
Improve discovery error output ( #134 )
2020-11-17 12:26:18 +01:00
Pierre Ståhl
d783293a21
Add support for HSV encoded color lights ( #90 )
...
* Add support for HSV encoded color light
* Add debug logs for entity config
* Unset color when going to white mode
2020-10-26 12:09:31 +01:00
Pierre Ståhl
c6de437e86
Only forward config entry to each platform once
...
Fixes #94
2020-10-22 11:30:48 +02:00
Pierre Ståhl
3f854337ad
Fix status exception when no payload
2020-10-21 12:09:06 +02:00
Pierre Ståhl
d96d02357b
Use manual discovery if no device has been set ul
2020-10-21 10:49:29 +02:00
Pierre Ståhl
439f8aec0c
Passively discover devices and update IP addresses
2020-10-21 10:49:29 +02:00
Pierre Ståhl
a217b2553c
Add debug log instructions to readme
2020-10-20 12:54:41 +02:00
Pierre Ståhl
e6538a4681
Fix bugs in pytuya
...
This handles responses without a return code and also fixes support for
unencrypted clients. Made a few tweaks to debug logs as well.
2020-10-19 10:43:31 +02:00
Pierre Ståhl
1d830552df
Fix bug when connection fails
2020-10-16 22:43:00 +02:00
Pierre Ståhl
98fee92c83
Return None if no color temp option
2020-10-16 12:40:06 +02:00
Pierre Ståhl
baad2cfab0
Fix review comments
2020-10-16 12:40:06 +02:00
Pierre Ståhl
15a79ec690
Re-map light brightness range
...
Home Assistant uses brightness range 0-255 whilst Tuya somewhere around
29-1092. This commit maps brightness between these two ranges.
2020-10-16 12:40:06 +02:00
Pierre Ståhl
47d2900a2c
Add set_dps to set multiple datapoints
2020-10-15 18:54:36 +02:00
Pierre Ståhl
44db913514
Rename set_dps to set_dp in pytuya
2020-10-15 18:54:36 +02:00
Pierre Ståhl
81c04bfc4e
Fix broken support for 0d devices
2020-10-15 18:48:34 +02:00
Pierre Ståhl
5d64cb4e18
Convert fan platform to asyncio
2020-10-14 14:21:10 +02:00
Pierre Ståhl
136e44c549
Minor final fixes
2020-10-14 13:10:20 +02:00
Pierre Ståhl
b0603313ff
Fixed some bugs
2020-10-14 13:10:20 +02:00
Pierre Ståhl
91f788865c
Add more temporary logging
2020-10-14 13:10:20 +02:00
Pierre Ståhl
ff3ca99b29
Add logging and stability fixes
2020-10-14 13:10:20 +02:00
Pierre Ståhl
7384f1fc54
Add context to pytuya logging
2020-10-14 13:10:20 +02:00
Pierre Ståhl
59dfc35759
Fix bug when unloading an entry
2020-10-14 13:10:20 +02:00
Pierre Ståhl
5cd76f87ea
Ignore status updates without datapoints
2020-10-14 13:10:20 +02:00
Pierre Ståhl
b2c4e93a47
Disconnect on missing heartbeats
2020-10-14 13:10:20 +02:00
Pierre Ståhl
f971646333
Close connection properly on error
2020-10-14 13:10:20 +02:00
Pierre Ståhl
2565074c9c
Add missing await
2020-10-14 13:10:20 +02:00
Pierre Ståhl
cad31f1ffe
Convert pytuya to asyncio
2020-10-14 13:10:20 +02:00
Pierre Ståhl
f5146ad4eb
Add brightness and color_temp to example
2020-10-06 10:49:23 +02:00
Pierre Ståhl
1da5c2c2e1
Fix linting issues
2020-10-06 10:49:23 +02:00
Pierre Ståhl
792fcc5186
Add color temp and brightness config to light
2020-10-06 10:49:23 +02:00
Pierre Ståhl
8456c6039c
Add platform specific DPS to requests
2020-10-05 09:44:13 +02:00
Pierre Ståhl
8cc978a04d
Refactor async_setup_entry
2020-10-05 09:44:13 +02:00
Pierre Ståhl
29c852f96c
Add support for reloading from YAML
2020-10-04 22:36:28 +02:00
Pierre Ståhl
d9c6d66bb7
Fix review comments
2020-09-30 09:45:37 +02:00
Pierre Ståhl
b50cd7bf84
Initial work on refactoring pytuya
...
Still lots of things to improve, but it's a start. Will continue with
receive code.
2020-09-30 09:45:37 +02:00
Pierre Ståhl
7a9deea830
Do not block event loop on updates
2020-09-28 22:51:17 +02:00
Pierre Ståhl
e673340229
Fix missing attributes bug
2020-09-28 07:13:30 +02:00
Pierre Ståhl
caaf884a7a
Get status once per device instead of per platform
2020-09-27 14:19:35 +02:00
Pierre Ståhl
b7173f3033
Switch to cryptograhy for crypto routines
2020-09-27 09:48:03 +02:00
Pierre Ståhl
2879761eae
Remove unneeded YAML import flag
2020-09-26 22:59:28 +02:00
Pierre Ståhl
208b0ad5e9
Use two digits precision in senso
2020-09-26 22:38:26 +02:00
Pierre Ståhl
d22d081335
Clean up YAML examples in code files
2020-09-26 22:38:26 +02:00
Pierre Ståhl
63090ba985
Store DPS as integers in config entry
...
Also require protocol_version to be a string and validate version to be
supported.
2020-09-26 22:38:26 +02:00
Pierre Ståhl
0048ce6d5e
Move YAML config to component
2020-09-26 22:38:26 +02:00
Pierre Ståhl
450060488b
Add shared code to a common module
2020-09-24 09:48:42 +02:00
Pierre Ståhl
fefee6944f
Add shared code to a common module
2020-09-24 09:20:31 +02:00
Pierre Ståhl
98612a0d70
Enable type checking with mypy
2020-09-23 18:33:10 +02:00
Pierre Ståhl
02a2f08c40
Enable codespell and fix mistakes
2020-09-23 18:33:10 +02:00
Pierre Ståhl
4e72767b30
Fix flake8 issues and enable flake8 in tox
2020-09-23 17:50:24 +02:00
Pierre Ståhl
a18c69f8eb
Fix pydocstyle issues and enable in tox
2020-09-23 16:47:08 +02:00
Pierre Ståhl
ec7652b193
Remove pull_request_target from ci workflow
2020-09-22 12:41:03 +02:00
Pierre Ståhl
30392d3ac5
Initial step to have continuous integration
...
This commit introduces the use of tox, which currently only verifies
that code is formatted according to the black project. More checks will
come in upcoming PRs for codespell, pydocstyle, flake8 and mypy.
A GitHub actions is included that runs tox on new pull requests, so we
get automatic feedback and can block commits that fail any check.
Another (official) action that runs hassfest is included as well, to
make sure we are compatible with Home Assistant.
2020-09-22 12:29:05 +02:00
Pierre Ståhl
dd48fc00f5
Make light entity inherit from LocalTuyaEntity
2020-09-21 23:56:54 +02:00
Pierre Ståhl
b169c86473
Make fan platform inherit from LocalTuyaEntity
...
Also big clean up and some bug fixes.
2020-09-21 23:55:56 +02:00
Pierre Ståhl
16e4e9407f
Reload integration if config entry changes
...
This makes changes under options apply without restart.
2020-09-21 00:46:26 +02:00
Pierre Ståhl
1e23120872
Add device discovery to config flow
2020-09-21 00:43:06 +02:00
Pierre Ståhl
1cc8efece4
Fix sensor scaling
2020-09-20 19:32:09 +02:00
Pierre Ståhl
26d83774e2
Add generic sensor platform
2020-09-19 23:43:12 +02:00
Pierre Ståhl
5507652bae
Add support for options flow
2020-09-18 17:31:14 +02:00
Pierre Ståhl
e79b4cf619
Use friendly_name instead of name in config entry
2020-09-18 09:40:12 +02:00
Pierre Ståhl
9973c5fdcb
Pass config entry to LocalTuyaEntity
2020-09-18 09:14:12 +02:00
Pierre Ståhl
bd98b7cd93
Add base entity class LocalTuyaEntity
...
All platforms will inherit from this class in the end, but this commit
starts with switch only.
2020-09-18 09:14:12 +02:00
Pierre Ståhl
0290b11dae
Request DPS 1-150 in config flow
2020-09-16 19:36:51 +02:00
Pierre Ståhl
9493f17de6
Forward config entry only to used platforms
2020-09-15 12:29:07 +02:00
Pierre Ståhl
50cbde330b
Fix fan platform after merge
2020-09-13 19:02:13 +02:00
Pierre Ståhl
f9a4b4ad8a
Add config flow support for fan
2020-09-10 12:07:59 +02:00
Pierre Ståhl
edc9debf83
Add config flow support for cover
2020-09-10 10:50:58 +02:00
Pierre Ståhl
ae64158da5
Use correct device class from pytuya
2020-09-10 10:42:44 +02:00
Pierre Ståhl
11763d90c5
Use generic Device in config flow
2020-09-09 23:06:28 +02:00
Pierre Ståhl
7efb3024fb
Support arbitrary flow schemas for platforms
2020-09-09 23:05:42 +02:00
Pierre Ståhl
7018625f04
Add light support and clean up schemas
2020-09-09 22:59:37 +02:00
Pierre Ståhl
aa1ed67f94
Make energy attributes in switch optional
2020-09-09 22:12:44 +02:00
Pierre Ståhl
43a36f458c
Remove pre-filled values from config_flow
...
Also improve relative module import by not hardcoding package path.
2020-09-08 20:11:43 +02:00
Pierre Ståhl
0600b2730b
Make config flows general based on entities
2020-09-08 12:00:23 +02:00
Pierre Ståhl
b8333affc5
Add support for config flows for switches
2020-09-06 10:29:39 +02:00
Pierre Ståhl
a0bf22cce5
Prepand unique_id with local_
...
Avoid collisions with the tuya integration.
2020-09-03 12:04:52 +02:00
Pierre Ståhl
4335507804
Add support for unique_id and available
2020-09-02 12:46:09 +02:00