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 switch platform to Tuya Light (dj) devices #58196

Merged
merged 3 commits into from
Oct 23, 2021

Conversation

fOmey
Copy link
Contributor

@fOmey fOmey commented Oct 21, 2021

Breaking change

Proposed change

The change allows toggling the socket, at the moment you are only able to toggle the RGB ring.

Modified some source comments to accurately describe the RGB socket.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

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

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@homeassistant
Copy link
Contributor

Hi @fOmey,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@probot-home-assistant
Copy link

Hey there @tuya, @zlinoliver, @METISU, @frenck, mind taking a look at this pull request as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

homeassistant/components/tuya/light.py Outdated Show resolved Hide resolved
homeassistant/components/tuya/switch.py Outdated Show resolved Hide resolved
@tetsuo55
Copy link

I think it's a device like this one
2-2

It would be helpful if @fOmey could link the actual device and provide the Tuya device capability logs

@fOmey
Copy link
Contributor Author

fOmey commented Oct 22, 2021

@tetsuo55 is correct, the product featured in the image above is a "dj".

The following is data from the tuya IoT platform:

Product Name: RGB SOCKET
Device ID: 84800438483fda1c391e
Product Category: dj
Device Status: Online

IoT instruction set:

switch_led	Boolean	

"{true,false}"

bright_value	Integer	

{
  "min": 25,
  "scale": 0,
  "unit": "",
  "max": 255,
  "step": 1
}

work_mode	Enum	

{
  "range": [
    "white",
    "colour",
    "scene",
    "scene_1",
    "scene_2",
    "scene_3",
    "scene_4"
  ]
}

colour_data	Json	

{
  "h": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 360,
    "step": 1
  },
  "s": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  },
  "v": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  }
}

scene_data	Json	

{
  "h": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 360,
    "step": 1
  },
  "s": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  },
  "v": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  }
}

flash_scene_1	Json	

{
  "h": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 360,
    "step": 1
  },
  "s": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  },
  "v": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  }
}

flash_scene_2	Json	

{
  "h": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 360,
    "step": 1
  },
  "s": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  },
  "v": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  }
}

flash_scene_3	Json	

{
  "h": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 360,
    "step": 1
  },
  "s": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  },
  "v": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  }
}

flash_scene_4	Json	

{
  "h": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 360,
    "step": 1
  },
  "s": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  },
  "v": {
    "min": 1,
    "scale": 0,
    "unit": "",
    "max": 255,
    "step": 1
  }
}

switch	Boolean	

"{true,false}"

countdown_1	Integer	

{
  "unit": "s",
  "min": 0,
  "max": 86400,
  "scale": 0,
  "step": 1
}

@frenck frenck changed the title Add tuya device (dj) to switch.py Add switch platform to Tuya Light (dj) devices Oct 23, 2021
fOmey and others added 2 commits October 24, 2021 06:47
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label Oct 23, 2021
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @fOmey 👍

Happy Hacktoberfest 🎉

../Frenck

@frenck frenck merged commit 8bfd5e4 into home-assistant:dev Oct 23, 2021
natekspencer pushed a commit to natekspencer/home-assistant-core that referenced this pull request Oct 24, 2021
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
@github-actions github-actions bot locked and limited conversation to collaborators Oct 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bugfix cla-signed Hacktoberfest integration: tuya small-pr PRs with less than 30 lines. smash Indicator this PR is close to finish for merging or closing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants