Commit Graph

68 Commits

Author SHA1 Message Date
dim145
d57932e8e4 fix: do not use deprecated attr in light entity 2025-01-14 09:37:19 +01:00
dim145
e1fb0f2ccb fix: do not use deprecated features 2025-01-14 09:37:19 +01:00
Peter A. Bigot
8a1c6e0380 Fix out-of-range color temperatures
If light.turn_on is invoked with `brightness: 128, color_temp: 500`
for a bulb that supports mired range 154..370 in value range 1..255
the calculated color temperature will be negative.  When the bulb
receives the command it may turn on, but will fail processing the
color_temp operation and will not send a response.

At this point `light.toggle` will have no effect because Home
Assistant is unaware that the bulb is on.

Fix the state by clamping the sent color temperature to the allowed
range.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2022-03-29 13:27:45 -07:00
Peter A. Bigot
2a277a0c26 Fix kelvin-to-mired conversion
Use the core utility rather than reimplementing it.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2022-03-29 12:45:46 -07:00
Louis
6add1f7d1a rename variables 2021-12-21 12:55:55 +01:00
Louis
39cbd73d66 Formatting and variables 2021-12-21 12:55:55 +01:00
Louis
a5245c79f7 Implement optional light variable to reverse color temp 2021-12-21 12:55:55 +01:00
ultratoto14
8cf1a95bab Fix error that happens when in custom scene (#291)
* FIx  error that happens when in custom scene

* Remove unnecessary None

* Remove unnecessary None

Co-authored-by: Pierre Ståhl <pierre.staahl@gmail.com>
2021-03-31 19:32:10 +02:00
ultratoto14
444ec78e2b Fix review comment. 2020-12-17 21:46:26 +01:00
dependabot-preview[bot]
8e1e349fa4 Fix HA scene, one more. 2020-12-17 16:20:22 +01:00
Pierre Ståhl
f72cbc0b5a Run pylint from tox (#243) 2020-12-17 09:26:55 +01:00
Maarten Weyns
a6e8f282c5 Fixed editor line indentation 2020-12-15 20:11:34 +01:00
Maarten Weyns
c28fac7010 This makes lights smoothly fade from one state to a new state, without the intermediate "turn off" 2020-12-15 20:09:10 +01:00
ultratoto14
d0653d4f36 Fix HA scenes with bulb without color_temp 2020-12-15 15:13:08 +01:00
ultratoto14
3ecae049bb overzealous check. 2020-11-23 20:30:45 +01:00
ultratoto14
14333b260d Use color picker white point. 2020-11-23 13:36:50 +01:00
ultratoto14
3356b3dd63 Wrong check that enable music mode evry time. 2020-11-18 11:06:54 +01:00
ultratoto14
457bae1456 Follow review comments. 2020-11-17 15:11:46 +01:00
ultratoto14
26f5e17772 Merge branch 'master' into light_scenes 2020-11-17 14:17:43 +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
ultratoto14
9ca3efb161 Fix brightness issues. 2020-11-17 08:42:39 +01:00
ultratoto14
352ba58336 Add RGB only scenes. 2020-11-16 14:11:42 +01:00
ultratoto14
9be72d1152 Update internal state whatever mode is. 2020-11-16 11:32:54 +01:00
ultratoto14
8d91d9278b Merge branch 'master' into light_scenes 2020-11-16 07:29:40 +00:00
ultratoto14
6e07a5581f First try to add scenes. 2020-11-09 13:39:46 +01:00
ultratoto14
a0f4fdf337 Use default home assistant behavior. Return only relevant data per mode. (#129) 2020-11-06 21:37:36 +01:00
ultratoto14
657850e39c Add support of RGB lights (#120)
* Make set_dps available.

* Adding RGB support, brightness fix, color_temp range.

* Update README for light options

* Formatting

* Formatting

* Need to force to white to ensure color picker is updated.

* Detect color mode RGB/HSV based on color length.

* Extract rgb encoded color check in method.

* Make check method private.

* Fix exception when color is not available (maybe when powered off)

* Reformat.
2020-10-28 09:54:54 +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
Kendell R
c1878f82e2 Improve GitHub Actions (#97)
* Delete hassfest.yaml

* Update and rename ci.yaml to tox.yaml

* Create combined.yaml

* Update hacs.json

* Update README.md

* Update combined.yaml

* Remove unused import

* Restored wrongly deleted line in cover.py

* Update config_flow.py

* Update __init__.py

Co-authored-by: Pierre Ståhl <pierre.staahl@gmail.com>
Co-authored-by: rospogrigio <49229287+rospogrigio@users.noreply.github.com>
2020-10-22 11:43:47 +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
44db913514 Rename set_dps to set_dp in pytuya 2020-10-15 18:54:36 +02:00
Pierre Ståhl
cad31f1ffe Convert pytuya to asyncio 2020-10-14 13:10:20 +02:00
Pierre Ståhl
1da5c2c2e1 Fix linting issues 2020-10-06 10:49:23 +02:00
danVnest
51a92da6b3 Include support for color temp instead of unfinished color 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
caaf884a7a Get status once per device instead of per platform 2020-09-27 14:19:35 +02:00
Pierre Ståhl
d22d081335 Clean up YAML examples in code files 2020-09-26 22:38:26 +02:00
rospogrigio
3259a4f654 Second part of one_device_only big merge 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
fefee6944f Add shared code to a common module 2020-09-24 09:20:31 +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
rospogrigio
83b3b6f21b Moved TuyaCache to __init__.py, and renamed to TuyaDevice. In pytuya, renamed TuyaDevice to TuyaInterface 2020-09-22 00:51:33 +02:00
Pierre Ståhl
dd48fc00f5 Make light entity inherit from LocalTuyaEntity 2020-09-21 23:56:54 +02:00
rospogrigio
6700e02c52 set_dpsUsed turned into add_dps_to_request ; used it when setting up entities 2020-09-19 15:59:59 +02:00
rospogrigio
c99cc1f077 Removed unneeded friendly_name fields 2020-09-15 23:31:33 +02:00