Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add color temp and brightness config to light #47

Merged
merged 4 commits into from
Oct 6, 2020
Merged

Conversation

postlund
Copy link
Collaborator

This makes it possible to specify DP for brightness and color temperature via YAML config and config flow. Should be tested before merging.

@postlund
Copy link
Collaborator Author

@danVnest Not sure about the changes in Fix unused SUPPORT_COLOR lint error? The self._color variable is always None so I kinda feel this is unnecessary until logic is implemented. Do you want implement that?

@postlund
Copy link
Collaborator Author

postlund commented Oct 6, 2020

@rospogrigio Maybe you can have a quick glance at this so we can merge it? It has been user tested. I want to add some brightness fixes.

Copy link
Owner

@rospogrigio rospogrigio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of trivial comments

@@ -33,6 +33,8 @@
- platform: light
friendly_name: Device Light
id: 4
brightness: 20
color_temp: 21
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we be using color_temperature in the extended format, as it has been done for set_position in covers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would have been ideal, yes. This constant however comes from the ones defined in Homre Assistant core and we shall always honor them before defining our own. I guess it's a legacy thing now.

@@ -260,6 +260,14 @@ def dps(self, dps_index):

return value

def dps_conf(self, conf_item):
"""Return value of datapoint for user speified config item.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: specified. Wondering why it has not been detected by tox ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. I think Code spell has a dictionary of commonly misspelled words, so it's not foolproof. Since it spell checks variable and function names too, there has to be a balance to what to complain at otherwise a lot of common (and domain specific) words would be treated as errors. Since you can refer to variable names in comments, you can't really make exceptions based on that.

@postlund
Copy link
Collaborator Author

postlund commented Oct 6, 2020

The spelling should be fixed now at least.

@rospogrigio rospogrigio merged commit f5146ad into master Oct 6, 2020
@rospogrigio rospogrigio deleted the light_dps branch October 6, 2020 08:49
@rospogrigio
Copy link
Owner

Merged #47.

@rospogrigio
Copy link
Owner

Shall I push a new release with this?

@postlund
Copy link
Collaborator Author

postlund commented Oct 6, 2020

Shall I push a new release with this?

Doesn't really matter to me. Do it if you feel like it.

PaulCavill pushed a commit to PaulCavill/localtuya that referenced this pull request May 9, 2024
* Rework SubDevices Connection

* Fix some stuff in payload_dict for sub devices `3.3`

* Don't send warning disconnect dc is intended

* Hotfix for `3.3` devices `detect_available_dps`

* Add sensors for code `wsdcg`

* Attempt Fix: some dps aren't detected.

* Adjust `detect_available_dps` Function when gateway existed

* int `t` since sub_devices payload `t` is int

* revert last commit force int `"t"` always, need for some cmds

* test: disable removing the [ gwID, devId and uid ]

* Disconnect the sub devices if gateway dc'd

* ensure that the gateway is ready before setup subdevices

* Fix: Block status_updated if gateway is sub_device

* Add gateway_gwId to discovered sub devices. and prevent non local subdevices

* Store Gateway ID If found on mergeDevicesList

* minor changes of connect on initialization

* config_entry_by_device_id search for gateways

* Minor fix: Rename climates.py in tuya devices data

* Tuya Devices Data rename binary_sensor

* Adjust Auto Configure category `wkf`

* Fix automatic update `ip` and includes sub_devices

* Except errors from pytuya.

* Except error on config flow and set timeout for connect.

* Fix: Entity_Category and convert get_gateway to async

* Fix Mirgate: Force Int for config_flow values and fix reverse always off

* Fix: Fake Gateway fails due to no DPS found on parent DPS.

* reformat unload function.

* Fix Reconfigure cloud step

* Fix error if "Auto Configure" used without cloud.

* Add platform support for humidifiers and Rename DPS, and DPS_CONF Functions (rospogrigio#47)

* Add support for humidifier platform

* Add Humidifer to Auto Configure feature.

* Improve English translations to be more user friendly rospogrigio#45 by @codyc1515

* Adjust `en` translation for humidifer

* mark set_humiditiy as optional

* log the disconnect reason of exists

* Adjust get_gateway function

* adjust error msgs in auto configure

* Refactor: entities initialization msg and remove dp_value_conf (rospogrigio#49)

* Initialized msg to `common.py` and del: `dp_value_conf`

* def should_pull to _attr_should_pull and refactor restore_on_reconnect

* refactor entity category

* Refactor: `device_info` and properties annotation

* Improve entry initialization (rospogrigio#50)

* Connecting `CloudAPI` runs on background without interrupt initialization.

* Unload: pulls platforms from `TuyaDevice` data Explain: rospogrigio#50

* Improves config flow (rospogrigio#51)

* DPS Data now will be pulled with devices data, data stored in `device_id` -> in `devices_list` with `dps_data` key.
* Adding new device DPS Data will be pulled from stored data `except the value!`
* Devices list in config flow now will be sorted: Starting from known devices first.
* Refresh cloud devices data when configure opened. `previously reload was needed in order to pull new devices data.`
* Handle the errors if refreshing token failed.

* Enable manually enter template filename (rospogrigio#52)

* Templates list field are now insertable and searchable, so if you add templates new template into `templates` directory you can manually enter there name without need to load them up with HA boot.
* Templates names now will shows the same as filename with extension.

* update pytuya version

* revert auther name

* Sort discovered devices by `ip`

* Handle sorting discovered devices better

* refactor: devices list sorting

* adjust dc reason log

* refactor: mergeDevicesList

* new helper `get_gateway_by_id` refactor mergeDeivceList

* typo

* * Refactor codes a little bit to make it easier to maintain. (rospogrigio#53)

* * Refactor codes a little bit to make it easier to maintain.
* cloud_api now has async_connect function.
* Localtuya HASS Data is now stored as namedtuple `HassLocalTuyaData`
* Removed `TUYA_DEVICES`, `DATA_CLOUD` and `UNSUB LISTENERS`
* Sotred all unsub_callback in tuya_devices.unsub_listeners
* Reconnect if disconnected will be called after 2secounds.

* Fix reconnect after 2 secounds.

* Hide reconifgured device if no devices setuped (rospogrigio#54)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants