8000 Tuya Select - Add int_datapoint option by Cossid · Pull Request #8393 · esphome/esphome · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Tuya Select - Add int_datapoint option #8393

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

Merged
merged 15 commits into from
May 13, 2025

Conversation

Cossid
Copy link
Contributor
@Cossid Cossid commented Mar 12, 2025

Allow configuration of backing data type for Tuya Select, expanding from enum to also allowing int

What does this implement/fix?

While Tuya has an enum type, it sometimes uses int in the same way for multi-option states. This allows sending the value as int instead of enum, if that is the backing type of the MCU. Defaults to previous behavior of enum

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

  • fixes N/A

Pull request in esphome-docs with documentation (if applicable):

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx

Example entry for config.yaml:

# Example config.yaml
select:
  - platform: "tuya"
    name: "Indicator Configuration"
    data_type: int
    entity_category: config
    enum_datapoint: 101
    optimistic: true
    options:
      0: "Inverted"
      1: "Normal"

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

…ion on top of existing enum, default to enum
@codecov-commenter
Copy link
codecov-commenter commented Mar 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.61%. Comparing base (4d8b5ed) to head (ba2e0eb).
Report is 2454 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #8393      +/-   ##
==========================================
+ Coverage   53.70%   56.61%   +2.90%     
==========================================
  Files          50       50              
  Lines        9408     9921     +513     
  Branches     1654     1340     -314     
==========================================
+ Hits         5053     5617     +564     
+ Misses       4056     3955     -101     
- Partials      299      349      +50     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Cossid Cossid marked this pull request as draft April 15, 2025 18:28
@Cossid Cossid marked this pull request as ready for review April 15, 2025 19:52
@Cossid Cossid requested a review from bearpawmaxim April 15, 2025 20:03
@Cossid Cossid changed the title Tuya Select - Allow configuration of backing data type Tuya Select - Add int_datapoint option Apr 15, 2025
Copy link
Contributor
@bearpawmaxim bearpawmaxim left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks)

@Cossid Cossid requested a review from a team as a code owner April 15, 2025 21:29
@probot-esphome probot-esphome bot added the core label Apr 15, 2025
@esphome
Copy link
esphome bot commented May 1, 2025

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@esphome esphome bot marked this pull request as draft May 1, 2025 01:29
@Cossid Cossid requested a review from jesserockz May 1, 2025 13:38
@Cossid Cossid marked this pull request as ready for review May 1, 2025 13:38
@esphome esphome bot requested a review from bearpawmaxim May 1, 2025 13:38
@jesserockz jesserockz merged commit 8b65d16 into esphome:dev May 13, 2025
25 checks passed
@jesserockz jesserockz mentioned this pull request May 13, 2025
@jesserockz jesserockz mentioned this pull request May 21, 2025
sa-crespo pushed a commit to sa-crespo/esphome that referenced this pull request May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0