Open crespum opened 5 months ago
Hi, could you post the yaml config you use for these devices?
The first log suggests that tuyamcu does not respond to heartbeat at the beginning, but starts to respond after wifi connects. I suspect this could be because the "wifi ready" state is sent to tuyamcu too late. I have created a pull request esphome/esphome#7028 in which this state is faked and it should be forwarded to tuyamcu very early at startup. You can try this PR and see if the behavior got better.
That was my first guess too. I tried to delay the startup of the Tuya component using some ESPHome configuration but unfortunately I haven't saved the configuration I used in those test.
Anyway, find -part of- the current configuration below:
uart:
tx_pin: P11
rx_pin: P10
baud_rate: 9600
debug:
tuya:
on_datapoint_update:
- sensor_datapoint: 101
datapoint_type: int
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (temp) %i", x);
- sensor_datapoint: 102 # sample dp
datapoint_type: int
then:
- lambda: |-
ESP_LOGD("main", "on_datapoint_update (hum) %i", x);
sensor:
- platform: "tuya"
id: temp
name: "Temperatura"
sensor_datapoint: 101
icon: "mdi:thermometer"
accuracy_decimals: 1
filters:
multiply: 0.1
- platform: "tuya"
name: "Humidade"
sensor_datapoint: 102
icon: "mdi:water-percent"
accuracy_decimals: 0
status_led:
pin:
number: P9
inverted: true
remote_transmitter:
pin: P26
carrier_duty_percent: 50%
remote_receiver:
id: irrecv
pin:
number: P8
inverted: true
mode:
input: true
pullup: true
#dump: all
climate:
- platform: fujitsu_general
name: "Clima"
sensor: temp
receiver_id: irrecv
Hmm, have you noticed that tuyamcu requires wifi status to be reported via a pin?
GPIO Configuration: status: pin 9
I don't see it set in your yaml. If I understand the esphome documentation correctly, you should specify it manually. I believe it should look like this in your case:
tuya:
status_pin: P9
on_datapoint_update:
...
If that doesn't help, you can also try adding add the time component and set:
tuya:
time_id: your_time_id
status_pin: P9
on_datapoint_update:
...
I don't know if there's a way to tell if your device needs it, but it shouldn't hurt to add it.
The first device isn't responding to the datapoint request. It responded to everything before that, including the heartbeat.
Adding status_pin: P9
doesn't fix the issue:
[18:57:56][C][lt.component:013]: LibreTiny:
[18:57:56][C][lt.component:014]: Version: v1.5.1 on wb3s, compiled at Jul 19 2024 18:54:03, GCC 10.3.1 (-O1)
[18:57:56][C][lt.component:015]: Loglevel: 3
[18:57:56][C][tuya:041]: Tuya:
[18:57:56][C][tuya:044]: Initialization failed. Current init_state: 4
[18:57:56][C][tuya:049]: If no further output is received, confirm that this is a supported Tuya device.
[18:57:59][D][api:102]: Accepted 192.168.1.15
[18:57:59][W][component:237]: Component api took a long time for an operation (122 ms).
[18:57:59][W][component:238]: Components should block for at most 30 ms.
[18:57:59][D][api.connection:1375]: Home Assistant 2024.6.3 (192.168.1.15): Connected successfully
[18:58:00][D][uart_debug:114]: >>> 55:AA:00:00:00:00:FF
[18:58:00][D][uart_debug:114]: <<< 55:AA:03:00:00:01:01:04
[18:58:15][D][uart_debug:114]: >>> 55:AA:00:00:00:00:FF
[18:58:15][D][uart_debug:114]: <<< 55:AA:03:00:00:01:01:04
[18:58:30][D][uart_debug:114]: >>> 55:AA:00:00:00:00:FF
Note that it's not sending the 55:AA:00:08:00:00:07
packet anymore, but I think it has to do with some esphome update because I've tried with and without status_pin and I don't see it anymore...
It depends on how long it takes you to connect for logs. That command might have already been tried before you connect.
There's an option to print logs from before wifi connection was estabilished using my buff_log component. This will hopefully let you see the exchange of commands with tuyamcu from the very beginning and maybe this will tell us more.
Adding
status_pin: P9
doesn't fix the issue:
I've just noticed that P9 was already used in your setup for status led:
status_led:
pin:
number: P9
inverted: true
Doesn't this create a conflict with the tuya status pin? Could you try again without this status_led part?
Sure, there's a conflict with status_led
. I had to disable it before using it in status_pin
.
BTW, I have not been able to try the my_buff_log component yet.
The problem
I've ordered a few Tuya S06Pro sensors online (Wi-Fi IR remote + temperature & humidity) but I received two different PCB versions (in theory with the same functionality). The IR is working fine on both versions, however, the sensor (AHT20) is not responding on the oldest version. See attached pictures for reference.
I'm using the same configuration on both devices but the logs of the non-working one (marked as 2023-08-04) claim that the Tuya device is not supported:
I've enabled UART debug and it's parsing what seems to be the heartbeat:
The logs of the working device (marked as 2023-09-19) are the following (again, configuration is the same):
Which version of ESPHome has the issue?
2024.5.5
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
No response
What platform are you using?
BK72XX
Board
Tuya S06Pro
Component causing the issue
TuyaMCU
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response