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

New Device Definition Request - Wood Pellet Stove with 8 dps #1104

Open
jazzmonger opened this issue Oct 26, 2022 · 19 comments
Open

New Device Definition Request - Wood Pellet Stove with 8 dps #1104

jazzmonger opened this issue Oct 26, 2022 · 19 comments

Comments

@jazzmonger
Copy link

jazzmonger commented Oct 26, 2022

EDIT: No need for this request. The ESPHome devs wrote an update and its now working.

https://github.com/jazzmonger/wood-stove-with-TYWE1S-Tuya-chip/

Product Model: Cleveland Ironworks Wood Pellet Stove (there are 4 models, all use the same controller).
I have a test bench set up with a spare control board.

It also appears from the Wifi module (N12210) that this exact same controller is used in Nemaxx Pellet Stove Pellet Heater P6 P9 P12. https://www.ebay.com/itm/193755684864

link to product manual https://www.cleveland-ironworks.com/mwdownloads/download/link/id/2763

Data Points:
P1 - Power on (Heat)
4 - Mode P1/P2/P3P4
101 - ECO1/ECO2
104 - Error Code
106 Set Temp
107 - Current Teemp
108 - Pipe Temp
109 - Protect Temp

Error code - 104 (these come back from the server as numbers and are then mapped to error codes in the vendor app)

I have a basic version somewhat functional. Several un-resolvable issues:
The temp setting listed in the pic as "19" degrees is in degrees C, NOT F. I've tried several things to fix this w/ no luck.
There is no flame indicator, nor does the power button light up when turning on the stove
The control often disconnects. hitting the Tuya Climate power button brings it back "most" of the time. No my Tuya app is not running on my phone when this happens.

  • not related, but the std Tuya Integration always shows the current temp as -4. With Local Tuya I was able to get the correct value. The Vendor's Tuya clone app as well as the regular Tuya App shows all the correct values and options.

local tuya

I'll get some pics of the vendor's app as well.

@jwaz73
Copy link

jwaz73 commented Nov 3, 2022

I'm experiencing the same issue with a stove by a different manufacturer. Mine is a Master Forge pellet stove. Using the Smart Life app everything works. (Screenshot below) All data points seem to be the same. Mode P1-P4, ECO1 and ECO2.
Using the HA Tuya add-on the temp_current metric is always reported at -20C (HA does convert this to -4F). Haven't tried the LocalTuya integration yet but will give it a try.
Having the ability to adjust the mode and eco settings from HA would be a huge plus.

IMG_0030

Interesting note: Looking at the device debugging info in the Tuya IOT project, it is showing the same -20C value for the temp_current sensor.

@jazzmonger
Copy link
Author

Looks like we have exactly the same controller! Check the very bottom of the Tuyia.io dropdown "Select DP ID"

Screenshot from 2022-11-03 17-41-31

Mine have most dps duplicatedin the list, but I now know which ones are the correct ones. See my post here- I break it all down:
https://community.home-assistant.io/t/tuya-climate-entity-incorrect-values/483735

Nobody seems to know how to get values into HA from Tuya. I've literally been asking this question for over a year. Not one response.... Perhaps devs are abandoning Tuya. I honestly dont know. It sucks though. I have 2 of these stoves, and they often malfunction, requiring a reset. knowing when is important - like the stove is supposed to be on but it somehow randomly turned itself off with a "Goodbye" msg and now the house is freezing. The temp sensor reading is unusable so I had to use an ESP BME280 temp sensor next to the stove. Once I see the temp drop, I turn off the plug (tasmota plug), turn in on again and then turn on the stove all in an automation. That usually works.

It would be MUCH cleaner if we could just get a legit climate entity solution here. If I can figure out how to read DP's out of Tuya.io then I can just write my own screen with the correct entities.

@jazzmonger
Copy link
Author

jazzmonger commented Nov 4, 2022

@jwaz73 I just looked at my notes... The correct DP's for this stove as seen in Tuya.io are:

1 - Power on (Heat)
4 - Mode P1/P2/P3P4
101 - ECO1/ECO2
104 - Error Code
106 Set Temp
107 - Current Teemp
108 - Pipe Temp
109 - Protect Temp

If you put those into a new Tuya Local Device using the ... option, you sometimes get data. Right now ALL of my Local entities are Unavailable. And Im not running any of the Tuya based apps...

@jazzmonger
Copy link
Author

@jwaz73 any luck on your end?

@jwaz73
Copy link

jwaz73 commented Nov 5, 2022

@jazzmonger, it was a busy week at work, and haven't had the opportunity to look at it yet. Hope to this evening or tomorrow.

@jazzmonger
Copy link
Author

jazzmonger commented Nov 6, 2022 via email

@jazzmonger
Copy link
Author

jazzmonger commented Nov 7, 2022

@jwaz73 I think I have a solution to our problem that completely eliminates this NASTY Tuya garbage so we never have to deal with it ever again...

It turns out that our stoves have the Tuya module tywe1s in them mounted on a removable daughter board:

52657786-AB1C-49EA-B4F9-7DFF7F3CFF00
DBAB26AC-A181-456A-8AFD-243E1D356606

I scoured the net last night at 3am and stumbled on this:
https://tasmota.github.io/docs/TuyaMCU-Devices/#costco-charging-essentials

this means we can theoretically reflash these modules with Tasmota or ESPHome. The Tuya module on our stove controller plugs into the MCU board with header pins so it should be really easy to unplug and reflash. I just happen to have a serial interface I can use to flash AND I have a spare control mcu assembly that I got from the stove manufacturer to try and fix the problems I'm having (no love there). I have it working on my test bench with resistors acting as dummy sensors on a spare controller board (which they also sent me) so it's already set up for me to try this.

I'm heating my shop right now and will try this and let you know how it works. I'm leaning toward flashing with ESPHome as I sometimes prefer it to Tasmota for ease of debugging in code vs Tasmota hit and miss, but either should work.
if I never have to deal with Tuya again it would be fantastic.
More soon!

@jazzmonger
Copy link
Author

jazzmonger commented Nov 8, 2022

@jwaz73 Ok, SUCCESS!!!!
Well, partial success... I got the TYWE1S module flashed w/ ESPHome. And I'm communicating w/ it over wifi. So, now the fun begins mapping the DP's to be usable. I need to go study the tuya mcu esphome module now. But this is certainly progress. I'll bet you your stove that the ESPHome devs and other esphome users will actually give a shi* and help us from here. Unlike the Tuya devs who really don't seem to care.

Screenshot from 2022-11-07 17-07-47

EDIT: for future reference, I only grounded GPIO0, grounding RST wouldn't let me flash the chip.

Jeff

@jazzmonger
Copy link
Author

jazzmonger commented Nov 8, 2022

Holy crap - after experimenting w/ the GPIO's for tx & Rx,I got it!!

config file entries:

# Enable logging
logger:
  level: DEBUG
  baud_rate: 0
uart:
  rx_pin: GPIO13
  tx_pin: GPIO15
  baud_rate: 9600
# Register the Tuya MCU connection
tuya:

[17:22:20][C][mdns:100]: mDNS:
[17:22:20][C][mdns:101]: Hostname: test-wood-pellet-stove
[17:22:20][C][ota:089]: Over-The-Air Updates:
[17:22:20][C][ota:090]: Address: 192.168.1.165:8266
[17:22:20][C][api:138]: API Server:
[17:22:20][C][api:139]: Address: 192.168.1.165:6053
[17:22:20][C][api:143]: Using noise encryption: NO
[17:22:20][C][tuya:033]: Tuya:
[17:22:20][C][tuya:048]: Datapoint 1: switch (value: OFF)
[17:22:20][C][tuya:054]: Datapoint 105: enum (value: 0)
[17:22:20][C][tuya:054]: Datapoint 4: enum (value: 0)
[17:22:20][C][tuya:054]: Datapoint 101: enum (value: 0)
[17:22:20][C][tuya:050]: Datapoint 106: int value (value: 66)
[17:22:20][C][tuya:050]: Datapoint 107: int value (value: 72)
[17:22:20][C][tuya:050]: Datapoint 108: int value (value: 394)
[17:22:20][C][tuya:050]: Datapoint 109: int value (value: 104)
[17:22:20][C][tuya:056]: Datapoint 104: bitmask (value: 4)
[17:22:20][C][tuya:062]: GPIO Configuration: status: pin 5, reset: pin 0
[17:22:20][C][tuya:068]: Product: '{"p":"8Dj5zVjGqPSXaUgf","v":"1.0.0","m":0}'
[17:22:24][D][tuya:280]: Datapoint 1 update to OFF
[17:22:25][D][tuya:300]: Datapoint 105 update to 0
[17:22:25][D][tuya:300]: Datapoint 4 update to 0
[17:22:25][D][tuya:300]: Datapoint 101 update to 0
[17:22:25][D][tuya:288]: Datapoint 106 update to 66
[17:22:25][D][tuya:288]: Datapoint 107 update to 72
[17:22:25][D][tuya:288]: Datapoint 108 update to 394
[17:22:25][D][tuya:288]: Datapoint 109 update to 104
[17:22:25][D][tuya:317]: Datapoint 104 update to 0X000004

My initial mappings look correct:
1 - Power on (Heat)
4 - Mode P1/P2/P3P4
101 - ECO1/ECO2
104 - Error Code
106 Set Temp
107 - Current Temp
108 - Pipe Temp
109 - Protect Temp

looking at the log and changing values on the front panel, I get:
dp#4 Mode P1-P4
P1= 0
P2= 1
P3= 2
P4 = 3

dp#101 = ECO mode
ECO1 = 0
ECO2 = 1

Error Codes will be a bit trickier to figure all of them out, but heres what I can find now on the bench:
Datapoint 104 update to 00000000 -> no error, normal operation
Datapoint 104 update to 0X000004 - Esc1, Short in temp sensor 1
Datapoint 104 update to 0X000008 -> Eso1, Open in temp sensor 1
Datapoint 104 update to 0X000001 -< Esc2, Short in temp sensor 2
Datapoint 104 update to 0X000008 -> Eso2 Open in temp sensor 2
Datapoint 104 update to 0X000020 ->Eso3 Open in Room Temp Sensor #3

@jazzmonger
Copy link
Author

jazzmonger commented Nov 8, 2022

I now have it in the front end, and I can turn it on/off, and set the temp both ways and updates are immediate.

Screenshot from 2022-11-07 18-17-13
But, it's it thinks the values are coming to it in C and converting to deg F ... I have the interface set for 60F.
60F = 140C
Datapoint 106: int value (value: 60)

Once this is solved, it will WORK! I have no idea where to define this. More research at 3am I suppose. Time to quit and eat dinner :)

question posted here
https://community.home-assistant.io/t/esphome-device-reports-in-c-but-us-actually-f-how-to-change-it-tuya-mcu/485941

@jazzmonger
Copy link
Author

jazzmonger commented Nov 8, 2022

Brute force method does work, but there has to be an easier way..
In my sensors.yaml file I put this:

- platform: template
    sensors:
      current_temperature:
        friendly_name: "shop test current temp converted"
        entity_id: climate.shop_test_pellet_stove_esphome
        unit_of_measurement: "°F"
        value_template: "{{float(state_attr('climate.shop_test_pellet_stove_esphome','current_temperature')-32)*5/9}}"

AAD2043C-3ABB-4516-8A59-61D6D16020AA

EDIT: I had to define all sensors in ESPHOME config file and specify units:

#text_sensor:
switch:
  - platform: "tuya"
    name: "Shop Test Stove-Power On"
    switch_datapoint: 1
 sensor:
  - platform: "tuya"
    name: "Shop Test Stove-Power On"
    sensor_datapoint: 1
  - platform: "tuya"
    name: "Shop Test Stove-Error Code"
    sensor_datapoint: 104
  - platform: "tuya"
    name: "Shop Test Stove-Set Temp"
    sensor_datapoint: 106
    unit_of_measurement: "°F"
  - platform: "tuya"
    name: "Shop Test Stove-Current Temp" 
    sensor_datapoint: 107
    unit_of_measurement: "°F"
  - platform: "tuya"   
    name: "Shop Test Stove-ECO Mode"
    sensor_datapoint: 101
  - platform: "tuya"
    name: "Shop Test Stove-Power Mode"
    sensor_datapoint: 4
~~~

@jazzmonger
Copy link
Author

jazzmonger commented Nov 8, 2022

Here's a really interesting thermostat project we might be able to use and modify for our stoves. It uses mode and eco options like ours.
https://community.home-assistant.io/t/my-nest-thermostat-card-config-using-thermostat-dark-card/248773/10

https://github.com/danielbrunt57/My-Dark-Thermostat/blob/main/sensors.yaml

@jazzmonger
Copy link
Author

jazzmonger commented Nov 12, 2022

OK, ESPHome will NOT work in this use case unfortunately. I've logged a feature request, but not hopeful it will be done before we freeze to death. It was 15F here last night...
esphome/feature-requests#1956

So, I'm starting from scratch here and installing Tasmota. I got it reflashed, now I need to figure it out.
https://tasmota.github.io/docs/TuyaMCU/

@jwaz73
Copy link

jwaz73 commented Nov 13, 2022

@jazzmonger , That is amazing progress! Thanks for sharing. Before I try flashing anything I'm going to order a new set of control boards for my stove. I'm just now starting to play with the mappings in LocaTuya in a dev instance of HA. I'll let you know if I have any different results from yours.

@jazzmonger
Copy link
Author

jazzmonger commented Nov 13, 2022

Local Tuya is NOT ready for prime time. It's riddled with limitations and bugs, especially if you're doing anything more than basic lights. I just deleted it from my install after a week of frustration, some entities worked, most did not. It does NOT remove you from the cloud.

I just flashed Tasmota on my device replacing esphome. So far, it looks promising. Not fully implemented yet but I'm almost there.

As always, your mileage will vary.

@jazzmonger
Copy link
Author

jazzmonger commented Nov 13, 2022

after some long conversations on Discord about this, (great help from folks there) they pointed me to this module

https://esphome.io/components/climate/tuya.html

This is THE missing link to all this. it lets you define dp's for all the necessary bits.

climate:
  - platform: tuya
    name: "My Climate Device"
    switch_datapoint: 1
    target_temperature_datapoint: 3.   <--- THE missing link!
    current_temperature_datapoint: 4
    eco_datapoint: 7.    <--- another missing link
    eco_temperature: 20 °C

I'm going to reflash ESPHome in a few and try this approach. The Tasmota stuff works, but it is so convoluted I would never be able to debug it in the future.

after speaking with a dev on Discord, I filed a PR related to this stove's MCU and the shoddy programming that went into it.
esphome/issues#3784

we'll see if it gets fixed.

@jazzmonger
Copy link
Author

I tried to document this solution to this long saga. It's all here:

https://github.com/jazzmonger/wood-stove-with-TYWE1S-Tuya-chip/

@jwaz73
Copy link

jwaz73 commented Nov 18, 2022

Excellent work, @jazzmonger!

@jazzmonger
Copy link
Author

jazzmonger commented Nov 18, 2022

Thanks bud! I just figured out how to create my own GitHub project complete with my own pr's! I document al, the shit I've gone thru taming this pellet stove. Quite the learning process!

https://github.com/jazzmonger/wood-stove-with-TYWE1S-Tuya-chip

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

No branches or pull requests

2 participants