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

TuyaMCU Update #9330

Merged
merged 2 commits into from
Sep 17, 2020
Merged

TuyaMCU Update #9330

merged 2 commits into from
Sep 17, 2020

Conversation

effelle
Copy link
Contributor

@effelle effelle commented Sep 16, 2020

Description:


Changelog:

  1. Support for two dimmers devices
  2. Initial support for RGB, RGB+W and RGB+CT lights
  3. New ModeSet Function to switch between white and RGB light
  4. Support for Fan controllers (or any other enum Type4 dpId)
  5. Initial support for shutters
  6. Extra functions
  7. New optional topic ready to be used with any home automation system
  8. TuyaSend command updated

1: To enable a dual dimmer setup assign the following functions (fnId):

  • 21 as Dimmer1
  • 22 as Dimmer2
  • 11 as Relay1
  • 12 as Relay2

Tasmota will automatically enable SetOption68 and the dimmers will respond to Channel1 and Channel2 commands.

Obs.: The use of SetOption68 is limited to two channels and will be automatically disabled if any other combination of lights will be used.

2: Special lights:
To enable an CT light assign the following functions (fnId):

  • 21 as Dimmer1
  • 11 as Relay1
  • 23 as CT channel

To enable an RGB light assign the following functions (fnId):

  • 21 as Dimmer1
  • 11 as Relay1
  • 24 as RGB controller

To enable an RGB+W light use the RGB configuration and append fnId 25 to the correct dpId.
Last but not least, for an RGB+CT light use the RGB configuration and append fnId 23.

obs.: At the present time the use of SetOption68 for more than two channels and the light split option (SetOption37 >= 128) are not supported.

3: The majority of  TuyaMCU devices with an RGB+W or an RGB+CT light needs a button to switch between White and colored light.
Is now possible enable the ModeSet selector adding the function 26. A button on the WebUI will be available.
When the ModeSet function is enabled will not be possible to update both lights at the same time. The possible values are 0 (white) and 1 (colorful).

4: To setup a fan controller select one of the available functions:

  • 61 for 3 speeds fan controller (possible values 0,1, 2)
  • 62 for 4 speeds fan controller (possible values 0, 1, 2, 3)
  • 63 for 5 speeds fan controller (possible values 0, 1, 2, 3, 4)
  • 64 for 6 speeds fan controller (possible values 0, 1, 2, 3, 4, 5)

Obs.: Different from other fan controllers like the Ifan03, the value 0 desn't mean OFF.  A TuyaMCU will consider a 0 as the lowest speed possible. ON/OFF states for a fan are always managed by another dpId, then you need to add the correct relay function.

5: Single Shutter or double shutters devices can be managed with a normal dimmer setup, for devices that have the face plate buttons reporting to another dpId like the Zemismart WiFi Tuya Roller Shade, enable:

  • 27 to report the state of Dimmer1
  • 28 to report the state of Dimmer2

6: Some extra functions were enabled and are still a work in progress:

  • 97 for motor direction
  • 98 for error logging (report only)
  • 99 as a dummy function

The last one is useful only if you don't want to manage the dpId assigned to the MCU. Enabling the dummy will let you remove the first relay (fnId 11) added by default in any configuration.

7: Use TuyaSend9 without any payload to toggle a STAT topic reporting the equivalent TuyaSend<x> command needed to update a dpId, for example:

17:45:38 CMD: power 1
17:45:38 MQT: stat/tasmota_49A3BC/RESULT = {"POWER":"ON"}
17:45:38 MQT: stat/tasmota_49A3BC/POWER = ON
17:45:38 MQT: stat/tasmota_49A3BC/TUYASEND1 = 1,1

Disabled by default, the topic can be easily grabbed by any home automation system.

8: Instead of using SerialSend5 55aa000100000 to get all the device information, you may want to useTuyaSend8 command or use TuyaSend0 to query just the state of the dpId.

@arendst : I've reused the old 33F on settings.h.

newtuya

Related issue (if applicable): fixes #8880 and #8663

Checklist:

  • The pull request is done against the latest dev branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR.
  • The code change is tested and works on Tasmota core ESP8266 V.2.7.4.1
  • The code change is tested and works on core ESP32 V.1.12.2
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@effelle effelle linked an issue Sep 16, 2020 that may be closed by this pull request
@arendst
Copy link
Owner

arendst commented Sep 17, 2020

Great!

@arendst arendst merged commit eaed13a into arendst:development Sep 17, 2020
@antoniomolram
Copy link

antoniomolram commented Sep 17, 2020

Good news! I'm just anxious to try it this night at home! Thank you @effelle

@effelle
Copy link
Contributor Author

effelle commented Sep 17, 2020

Will probably need some extra polish but since is a big update any feedback will be really appreciated.

@antoniomolram
Copy link

sure! don't worry. I will give you some feedback during this week.

@digiblur
Copy link
Contributor

Nice job! I'll have to check this out this weekend when I have time to play.

@effelle
Copy link
Contributor Author

effelle commented Sep 18, 2020

@arendst
Theo did you change something related to FUNC_SET_CHANNELS? On 8.5 Hsbcolor, color and sometimes CT commands stopped triggering the event from both webui and console. Dimmers commands are working fine. The only solution I have as a patch for now is move the call for TuyaSetChannels() under FUNC_EVERY_SECOND.

@arendst
Copy link
Owner

arendst commented Sep 19, 2020

Nope. No change on my side.

@jonootto jonootto mentioned this pull request Oct 16, 2020
8 tasks
@rjmcdougall
Copy link

I have been trying to get XMCosy string lights working -- with the latest build it seems like the RGB control to dpid 5 doesn't work.

The only format that works that I can find is RRGGBB as the type3 string.

Have we seen other tuya controllers which might only work with RGB, or is there something else that I could try?

https://www.amazon.com/Outdoor-String-Lights-Colored-Waterproof/dp/B08614LWZK?ref_=ast_sto_dp

@effelle
Copy link
Contributor Author

effelle commented Nov 5, 2020

Yes I have. Tuya folks have nothing to do then there are two different setup to pass the RGB color and at this point I don't exclude there are more out there.
If you are sure dpid 5 is the rgb try to issue a tuyasend this way

TUYASEND3 = 5,140100ffff6464

If is working means you need a string with RRGGBBffff6464 format instead of HUE0SAT0BRI0.
Meaning you need to wait until I will have the time to do an update. No ETA.

@rjmcdougall
Copy link

I suspect it is what you point out, since when I do a send0 and read back dpid 5 when color is blue, the value is 0000FF00006464. Looking forward to the update!

@effelle
Copy link
Contributor Author

effelle commented Nov 5, 2020

Ok, I'll try to find some time for it.

@rjmcdougall
Copy link

do you think it will require a parameter to control the format, or can you auto-detect somehow?

@rjmcdougall
Copy link

23:19:35 CMD: Group 0, Index 3, Command "TUYASEND", Data "5,140100ffff6464"
23:19:35 TYA: Send "55aa000600120503000e3134303130306666666636343634bf"
23:19:35 RSL: stat/tasmota_7FFA57/RESULT = {"TuyaSend":"Done"}

@effelle
Copy link
Contributor Author

effelle commented Nov 5, 2020

No there will be another fnId for the RGB becasue the most common (fnId 24) is the one already implemented.

@effelle
Copy link
Contributor Author

effelle commented Nov 8, 2020

#9769

@rjmcdougall
Copy link

rjmcdougall commented Nov 9, 2020 via email

@effelle
Copy link
Contributor Author

effelle commented Nov 9, 2020

Please report your findings and... Good luck!

@rjmcdougall
Copy link

rjmcdougall commented Nov 14, 2020 via email

@rjmcdougall
Copy link

rjmcdougall commented Nov 14, 2020 via email

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.

TuyaMCU ability to set a color Support for 2 channel Tuya MCU dimmer
5 participants