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

Read and Write to Tuya MCU data points like Tasmota and Tuya iOT servers can #1956

Closed
jazzmonger opened this issue Nov 12, 2022 · 4 comments
Closed

Comments

@jazzmonger
Copy link

jazzmonger commented Nov 12, 2022

Describe the problem you have/What new integration you would like
Add support to Tuya MCU to write to datapoints just like the Tuya iOT servers and Tasmota TuyaMCU can

OR Just like Tasmota can. Tragically, I've had to reflash away from ESPHome to Tasmota, because Tasmota supports this function. Not that I don't think Tasmota is useful, but mostly for lights and switches, not more complex devices like a Wood Pellet Stove. ESPHome is my GO TO Software for all things iOT. Or at least it used to be.

DP NUMBERS AND THEIR FUNCTION ON MY STOVE:
1 - Power on (Heat). <--- writable now
4 - Mode P1/P2/P3P4 <--- NOT writable but needs to be
101 - ECO1/ECO2 <--- NOT writable but needs to be
104 - Error Code <- READ ONLY
106 - Set Temp <--- NOT writable but needs to be
107 - Current Temp <- READ ONLY
108 - Pipe Temp <- READ ONLY
109 - Protect Temp <- READ ONLY


TuyaSend Command~
Command TuyaSend is used to send commands to dpId's. It is required for dpId's that shouldn't be mapped to a fnId.
With this command it is possible to control every function of the dpId that is controllable, providing you know its data type and data length. With them provided, the rest of the protocol command is calculated.
Command's value consists of two comma separated parameters: dpId and data.
TuyaSend dpId,data**

Please describe your use case for this integration and alternatives you've tried:
I have a newly reflashed TYWE01 Tuya module on my misbehaving wood pellet stove (the oem vendor app has serious bugs) and the set temp dp controls the stove. It's the only way to set a desired temp on the stove. But there is no way to do this as dps are read only... climate controls don't work because there is no way to set the target temp inside the MCU of the stove. The only function that is bidirectional is the ON/OFF Switch which is dp 1. If you can do it for dp 1, why not the rest of them????

Additional context
The same issue exists with ECO Mode (0 & 1) and the P1-P4 (0-3) power levels. I can read those values set via the front panel of the stove thru Tuya MCU in ESPHome, but there is no way to set them like the vendor app can up to the tuya data points in the Tuya servers and then back to the stove. Tuya MCU is unidirectional only, and limited by design.

the hesterysis of the stove is 3 degrees below set temp and 1 degree above. So I physically have to touch the buttons on the stove to control anything but on/off.

@jazzmonger
Copy link
Author

jazzmonger commented Nov 12, 2022

Relevant Tasmota TuyaMCU docs:
https://tasmota.github.io/docs/TuyaMCU/

@ssieb any insight here?

@jazzmonger jazzmonger changed the title Write to Tuya MCU data points like Tuya iOT servers can Write to Tuya MCU data points like Tasmota and Tuya iOT servers can Nov 12, 2022
@ssieb
Copy link
Member

ssieb commented Nov 13, 2022

It would be more helpful if you pasted the output from esphome where it dumps the datapoints and their types.
You can use either https://esphome.io/components/number/tuya.html for a number or https://esphome.io/components/select/tuya.html for an enum. You can also directly write to datapoints if you need to.
https://esphome.io/api/classesphome_1_1tuya_1_1_tuya.html

I just looked at the linked issue and you did paste the info there. So the modes are enums and the temp is a number. However, you probably want to use https://esphome.io/components/climate/tuya.html anyway, since that covers most of it.

@ssieb ssieb closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2022
@jazzmonger
Copy link
Author

jazzmonger commented Nov 14, 2022

If the vendor app is not written correctly as is in your example, the climate entity grabs the wrong dps because the vendor wrote two sets of dps for each attribute, then this is the is the only way to have a useable method to get or push data to the correct data point.

Here is an example. Current temp is actually 58, but always shows -4 because the climate entity reads the wrong dp.

image

The tuya climate entity wont work bc the retarded vendor only publishes the dp temp values in F, not C, with literally no way on the MCU to change it (product only made for USA Mkt) so all temp readings display incorrectly once ha interprets and converts them. So, I'm stuck.

It's not 129 degrees in my house, it's 54. 54F converted to C is 129.2 - see my ESPHome PR #3784 on this.
esphome/issues#3784

image

If there was a way to simply read a dp from the tuya servers and use them as sensors or entities it would fix this issue. I could just write a Lovelace interface with them. Not pretty, but usable.

There are many terribly written vendor implementations of hacked Tuya based apps. I know because I have one, as do many others. It's impossible to get the Vendors to rewrite them or fix their bugs, thus rendering entities like climate or fan unusable.

Some of the products like blinds or wood stoves cost thousands of dollars and they might as well have no "smart" features given the bugs in the apps.

Home assistant gives hope to us to save the investment we made in devices, but only if we can take control on a slightly deeper level and bypass shoddy vendor apps, and have some way to specify the correct data points in hard coded entities.

@jazzmonger jazzmonger changed the title Write to Tuya MCU data points like Tasmota and Tuya iOT servers can Read and Write to Tuya MCU data points like Tasmota and Tuya iOT servers can Nov 14, 2022
@ssieb
Copy link
Member

ssieb commented Nov 14, 2022

If the vendor app is not written correctly as is in your example, the climate entity grabs the wrong dps

The climate component grabs whatever dps you tell it to grab. There are no default values. The F issue is separate and has been dealt with as you know now.

and have some way to specify the correct data points in hard coded entities

I told you exactly how to do that already. Anyway, this issue is closed and you're getting help on discord.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants