Skip to content

Add Singapore datacenter, update BulbDevice for non-bulb devices again #625

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 3 commits into from
Jun 5, 2025

Conversation

uzlonewolf
Copy link
Collaborator

Closes #624
Closes #572 (again)

@uzlonewolf uzlonewolf mentioned this pull request Jun 4, 2025
@uzlonewolf
Copy link
Collaborator Author

In addition to the new Singapore data center, I also added aliases for a few of the existing ones to better match the official list:

{
    "login": true,
    "result": [
        {
            "code": "AY",
            "name": "China Data Center",
            "url": "https://openapi.tuyacn.com"
        },
        {
            "code": "EU",
            "name": "Central Europe Data Center",
            "url": "https://openapi.tuyaeu.com"
        },
        {
            "code": "IN",
            "name": "India Data Center",
            "url": "https://openapi.tuyain.com"
        },
        {
            "code": "AZ",
            "name": "Western America Data Center",
            "url": "https://openapi.tuyaus.com"
        },
        {
            "code": "WE",
            "name": "Western Europe Data Center",
            "url": "https://openapi-weaz.tuyaeu.com"
        },
        {
            "code": "UE",
            "name": "Eastern America Data Center",
            "url": "https://openapi-ueaz.tuyaus.com"
        },
        {
            "code": "SG",
            "name": "Singapore Data Center",
            "url": "https://openapi-sg.iotbing.com"
        }
    ],
    "t": ,
    "success": true,
    "status": "ok"
}

@jasonacox jasonacox requested a review from Copilot June 5, 2025 03:34
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for a new Singapore data center and refines device configuration logic for non-bulb devices while incrementing the core version.

  • Added Singapore region options with appropriate aliases in wizard prompts and Cloud API logic.
  • Updated non-bulb device detection in BulbDevice and introduced a default DPSET for non-bulb devices.
  • Incremented version in tinytuya/core/core.py to reflect these changes.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tinytuya/wizard.py Updated region list and prompt to include Singapore and alias details.
tinytuya/core/core.py Incremented version number from 1.17.1 to 1.17.2.
tinytuya/Cloud.py Extended API region handling to support alias values and Singapore region.
tinytuya/BulbDevice.py Modified device detection logic and added a default DPSET entry for non-bulb devices.
Comments suppressed due to low confidence (2)

tinytuya/BulbDevice.py:123

  • [nitpick] Using the string 'None' as a key in DEFAULT_DPSET may be ambiguous. Consider using a more descriptive key such as 'nonbulb' to clearly denote non-bulb devices.
DEFAULT_DPSET['None'] = {

tinytuya/BulbDevice.py:867

  • The revised detection logic distinguishing non-bulb devices is not immediately clear. Adding a brief comment to explain why the presence of keys '20' and '1' indicates a non-bulb device would aid future maintainability.
if '20' in response['dps'] and '1' in response['dps']:

@jasonacox
Copy link
Owner

Thanks @uzlonewolf !

@jasonacox jasonacox merged commit ac0339b into jasonacox:master Jun 5, 2025
14 checks passed
@jasonacox
Copy link
Owner

View at:
https://pypi.org/project/tinytuya/1.17.2/

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.

Singapore data center set dimmer level
2 participants