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 support for more ac/fan modes #1389

Merged
merged 5 commits into from
Apr 15, 2024
Merged

Conversation

simontegelid
Copy link

Add support for settings fan modes and swing modes and another set of HVAC modes.

Based on my Qlima WMS S + SC52 (AB;AF)

@apbarratt
Copy link

Hopefully could be merged with this one too: #1177
Sadly there does not seem to be a priority on adding these new modes just yet, indeed, nothing has been merged since February :(

@jreenen
Copy link

jreenen commented May 30, 2023

@rospogrigio stated on #1213 the following:

I don't like how this thing is being handled. We just can't keep adding presets as long as new commands pop out, each of them with their casing.
I believe we should turn this into a text edit field in which anyone would input the commands that are specific for their model, separated by a "/" or other char. The same applies also to many other plaforms (such as vacuums, etc...), we need to keep localtuya general purpose as much as we can, and refrain from introducing device-specific code or commands unless really impossible.

As I also submitted a pull request #1352 with some variation I do see his point. Currently, I am limited in time but if we want something merged we probably have more success by implementing the suggested refactoring instead of submitting variations, please correct me if I am wrong @rospogrigio

@simontegelid
Copy link
Author

@jreenen I had missed that comment. I agree though, looks like a refactoring-PR is the way forward for this, #1177, #1213 and #1352

@jreenen
Copy link

jreenen commented Jul 16, 2023

@simontegelid are you ok if I use your PR to try to summarize some things?

@rospogrigio what would be your take on the following changes on behalf of the climate.py:

  • Create a V3 of for the config flow
  • For each enum value specified in the built-in enum HVACMode create a string config item to map the tuya action value.
  • Refactor code to start using this mapping.
  • Use Config entry migration to migrate values to V3.

Almost sure I am missing some details here but could this be an approach you could agree on for your implementation?

@simontegelid
Copy link
Author

Yes, please do!

@jmcollin78
Copy link

Waiting for this. Please merge is ok !

@pabsi
Copy link

pabsi commented Apr 9, 2024

Hello there!
I came across this PR as I recently acquired five BHT-006 units which all have heat/cold/fan(wind) modes. Sadly, I am unable to add them to Home Assistant because the climate changes here (or in other PRs are not merged yet). Now, with that said, I understand this is a personal project after all and @rospogrigio might not have time (or not enough anyway) to maintain it to a level probably thousands of us expect (105 PRs open, and last release from June 2023). But it'd be sad having to fork it (as I am seeing people doing) just because PRs are getting stuck. Perhaps, we can increase the contributors list? of course, if @rospogrigio agrees..

Other integrations, such as (Tuya Local)[https://github.com/make-all/tuya-local] have, for example, BHT-002 but not BHT-006 so I am in the same position there anyway (although I can add them in "heat only" mode, but not "cool" mode).

All this said, let me repeat I am very thankful for the integration and what allowed me to do so far at home, but I, as many others, just want to unblock myself from not being able to add some more devices to HA.

Thank you for all the hard work 🙏 and I hope my comment is not taken negatively.

@rospogrigio
Copy link
Owner

Hi, I was willing to merge this PR but it has conflicts that need solving, then I'll be able to do it. I am open to have other people help developing and maintaining the repository, if anyone is willing just raise your hand.
Bye

@simontegelid
Copy link
Author

Thanks for your response! I'll fix conflicts asap

return DEFAULT_MIN_TEMP * 1.8 + 32
else:
return DEFAULT_MIN_TEMP
return self._config[CONF_TEMP_MIN]
Copy link
Author

Choose a reason for hiding this comment

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

Not 100% sure about removing this conversion. I'm thinking that the CONF_TEMP_MIN is set in Fahrenheit during configuration if needed and conversion here is not needed. The same goes for CONF_TEMP_MAX of course.

@simontegelid
Copy link
Author

@rospogrigio what are the next steps to move this forward?

@simontegelid
Copy link
Author

Thanks @rospogrigio . What is the last CI step? Who are authorized to merge?

@rospogrigio rospogrigio merged commit 7b37f07 into rospogrigio:master Apr 15, 2024
2 checks passed
jlikeme added a commit to jlikeme/localtuya that referenced this pull request May 13, 2024
* master:
  added dict get() instead of assuming keys exist; now handles config_flow setup failures without crashing
  Add support for more ac/fan modes (rospogrigio#1389)
  Replaced SUPPORT_* with enums, set minimum HA version in HACS configuration to 2024.1.0

# Conflicts:
#	custom_components/localtuya/climate.py
noahajac pushed a commit to noahajac/localtuya_comfortbilt that referenced this pull request May 25, 2024
* Add support for more ac/fan modes

* Replace deprecated constants with enums

* Add support for ClimateEntityFeature.TURN_{ON,OFF}

* Fix swing log message

---------

Co-authored-by: Simon Tegelid <[email protected]>
noahajac added a commit to noahajac/localtuya_comfortbilt that referenced this pull request May 25, 2024
* Fix for AttributeError: 'TuyaMessage' object has no attribute 'release' error

* rospogrigio#711 Implemented m/p HVAC mode set

* Introduced pytuya with support for 3.4 protocol

* Introduced 3.4 protocol option in config flow

* Fixed HEARTBEAT command

* Added debugging

* Fixed requested DPs for type_0d devices

* Fixed negotiation and sequence numbers for protocol 3.4

* Fixed sequence numbering on status update

* Fixed tox issues

* Fixed tox issues

* Updated README.md and info.md

* Fixed tox issues

* Fix for version not being set yet when calling _setup_dispatcher

* Introduced the possibility to select which devices should have the pytuya debug enabled

* Introduced device debugging option in README.md and info.md

* Introduced pytuya with support for 3.4 protocol

* Introduced 3.4 protocol option in config flow

* Fixed HEARTBEAT command

* Added debugging

* Fixed requested DPs for type_0d devices

* Fixed negotiation and sequence numbers for protocol 3.4

* Fixed sequence numbering on status update

* Fixed tox issues

* Fixed tox issues

* Updated README.md and info.md

* Fixed tox issues

* Fix for version not being set yet when calling _setup_dispatcher

* Introduced abort in config flow if all entities are deselected when editing a device

* Introduced IT and PT translations

* Update manifest.json for 5.0.0

* New tuyadebug.tgz now supporting protocol 3.4

* Update bug_report.md

* Fix for unknown state of covers/shutters

* New tuyadebug.tgz now including a tinytuya test

* Force to int

* Adjust input to avoid putting a string into an int

* Adjust input to avoid putting a string into an int

* Swap to int

* Improved logging

* Improved stability and Fix local_key update to not be thwarted by retries

* Introduced update of local_key when editing a device

* Improved logging

* Tox fixes

* Tox fixes

* Tox fixes

* Fix for not reconnecting after 'giving up'

* Tox fixes

* Tox fixes, reduced to 3.9 only

* Add entities during 'Edit a device'

* revert the default region

* Fix depreciated async_get_registry

* Add HACS validation

* Remove extra key

* Update manifest.json

* Remove extra key

* Update hacs.json

* Add Hassfest validation

* Alphabetize manifest.json

Alphabetized manifest.json according to home assistant requirements.

* Delete combined.yaml

As described in KTibow/ha-blueprint, ha-blueprint is being retired and we should thereby switch over to hassfest and hacs validation.

* Update tox.yaml

Added workflow_dispatch

* Update tox.ini

* Reduced logging level for 'Command %d timed out waiting for sequence number'; set v.5.1.0

* Fixed tox errors

* Updated manifest.json

* Fix for socket.send() exceptions in the logs

* Fixing pylint error

* fix bug when climate entity is using default min/max temp and temp unit is F

The default min/max temps are in C but when the climate entity is set up with F this will cause incorrect boundary check and an inability to change the temperature from the home assistant entity UI widget.

* Allow calling localtuya.set_dp service by non-admin users

* Fixed initialization with API but no internet.

* Handle 3.4 protocol, fix CI (rospogrigio#1251)

* Use refresh interval in version 3.4
* Scan interval convert to integer
* Try to fix CI
* Try to fix CI

* Allow port reuse so that other integrations can read the same port (rospogrigio#1481)

Co-authored-by: rospogrigio <[email protected]>

* Fixing tox issues

* Replaced SUPPORT_* with enums, set minimum HA version in HACS configuration to 2024.1.0

* Add support for more ac/fan modes (rospogrigio#1389)

* Add support for more ac/fan modes

* Replace deprecated constants with enums

* Add support for ClimateEntityFeature.TURN_{ON,OFF}

* Fix swing log message

---------

Co-authored-by: Simon Tegelid <[email protected]>

* added dict get() instead of assuming keys exist; now handles config_flow setup failures without crashing

* feat: add climate entity support for Comfortbilt stoves

* refactor: change information for fork

* feat: add support for alarm

---------

Co-authored-by: sibowler <[email protected]>
Co-authored-by: Daan Kemper <[email protected]>
Co-authored-by: rospogrigio <[email protected]>
Co-authored-by: rospogrigio <[email protected]>
Co-authored-by: Daniel O'Connor <[email protected]>
Co-authored-by: GaoJing <[email protected]>
Co-authored-by: oven-lab <[email protected]>
Co-authored-by: nu <[email protected]>
Co-authored-by: Ovidiu Nitan <[email protected]>
Co-authored-by: Neal Joslin <[email protected]>
Co-authored-by: dulyts <[email protected]>
Co-authored-by: Luke Bonaccorsi <[email protected]>
Co-authored-by: Elad Bar <[email protected]>
Co-authored-by: Simon Tegelid <[email protected]>
Co-authored-by: Simon Tegelid <[email protected]>
Co-authored-by: [email protected] <[email protected]>
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.

6 participants