Time On Tuya HeimVision A80S

I have a HeimVision A80S. I desoldered the esp on it and soldered a classic ESp-8266 chip. I programmed it with the code from

Most of the entities worked good. I did modify a couple of entities who where not properly working.

I never got the time component working properly. Below my code:

time:
  - platform: sntp
    timezone: "America/Montreal"
    id: sntp_time

tuya:
  id: light_tuya
  time_id: sntp_time
  on_datapoint_update:
    - sensor_datapoint: 127
      datapoint_type: raw
      then:
        - lambda: |-
            ESP_LOGD("tuya", "on_datapoint_update %s", hexencode(x).c_str());

I don’t understand what ESP_LOGD does exactly and how it works. The Time doesn’t change on the display. Below some datapoint who look interesting:

[18:52:22][C][tuya:054]:   Datapoint 107: raw (value: 19.01)
[18:52:23][C][tuya:054]:   Datapoint 127: raw (value: 00.02.D0.7F.0F.01.01.0A.01.0A.0A.00.00.02.D0.7F.0F.01.01.0A.01.0A.0A.00.00.02.D0.7F.0F.01.01.0A.01.0A.0A.00.00.02.D0.7F.0F.01.01.0A.01.0A.0A.00 (48))
[18:52:23][C][tuya:054]:   Datapoint 128: raw (value: 00.01.01.0A.1E.01.1E.0F.1E.01 (10))

The datapoint 107 is used to change the radio post (and changing the radio works well) so I wonder if maybe the code to send the time isn’t right or maybe it’s a different datapoint to store the time on the system ?? Please be aware that I have tryed changing 127 by 107 and 128 as well. Nothing works.

I would need some help please.
Thanks a lot!

Okay, I found that the datapoint 103 track the time in a string format like 103300 (hhmmss). I have tryed converting the sntp time to string, but I’m unable to do that. In the end I added a button to reset the time at 12:00 :

  - platform: template
    name: "Reset Time to 12:00"
    icon: "mdi:timer"
    on_press:
      - lambda: |-
            id(light_tuya).set_string_datapoint_value(103, "120000");

The original webpage seems gone. I’ll post here my code, just in case someone needs it

esphome:
  name: tau3
  #Room Clock

esp8266:
  board: d1_mini
  
# Enable logging
logger:
   baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: !secret api_encription

ota:
  password: !secret password

wifi:
  ssid: !secret wifi_ssid_vlan4
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.0.22
    gateway: 192.168.0.1
    subnet: 255.255.255.0

captive_portal:

#uart configuration
uart:
  rx_pin: GPIO3
  tx_pin: GPIO1
  baud_rate: 9600

#external clock
time:
  - platform: sntp
    timezone: "America/Montreal"
    id: my_time

# Status sensors
binary_sensor:
  - platform: status
    name: "Tau3 Status"

tuya:
  id: light_tuya
  time_id: my_time
  on_datapoint_update:
    - sensor_datapoint: 107
      datapoint_type: raw
      then:
        - lambda: |-
            ESP_LOGD("tuya", "on_datapoint_update %s", hexencode(x).c_str());

switch:
  - platform: "tuya"
    name: "Radio"
    icon: mdi:radio
    switch_datapoint: 105
  - platform: "tuya"
    name: "Alarm Clock 1"
    icon: mdi:alarm
    switch_datapoint: 109
  - platform: "tuya"
    icon: mdi:alarm
    name: "Alarm Clock 2"
    switch_datapoint: 122

light:
  - platform: "tuya"
    name: "Color Light"
    switch_datapoint: 129
  - platform: "tuya"
    name: "Breathing Light"
    switch_datapoint: 101
    dimmer_datapoint: 102
    min_value: 1
    max_value: 1000
  - platform: "tuya"
    name: "Wake Light"
    switch_datapoint: 121

text_sensor:
  - platform: "tuya"
    id: Radio_channel_name
    name: "Radio Channel"
    sensor_datapoint: 107

number: 
  - platform: "tuya"
    name: "Radio Volume"
    icon: "mdi:volumn-medium"
    number_datapoint: 106
    min_value: 1
    max_value: 12
    step: 1

button:
  - platform: template  
    name: "Radio Channel +" 
    icon: "mdi:access-point-plus"
    on_press:
      - lambda: |-
            auto cur_channel_name = id(Radio_channel_name).state.substr(3,2).c_str();
            unsigned int channel_num = 0;
            sscanf(cur_channel_name, "%x", &channel_num);
            ESP_LOGD("tuya", "cur_channel_name %s, num %d", cur_channel_name, channel_num);
            channel_num = channel_num + 1;
            if (channel_num == 0x0e) {
              channel_num = 0x01;
            }
            std::vector<uint8_t> raw;
            raw.push_back(0x0d);
            raw.push_back(channel_num);
            id(light_tuya).set_raw_datapoint_value(107, raw);
  - platform: template
    name: "Radio Channel -"
    icon: "mdi:access-point-minus"
    on_press:
      - lambda: |-
            auto cur_channel_name = id(Radio_channel_name).state.substr(3,2).c_str();
            unsigned int channel_num = 0;
            sscanf(cur_channel_name, "%x", &channel_num);
            ESP_LOGD("tuya", "cur_channel_name %s, num %d", cur_channel_name, channel_num);
            channel_num = channel_num - 1;
            if (channel_num == 0) {
              channel_num = 0x0d;
            }
            std::vector<uint8_t> raw;
            raw.push_back(0x0d);
            raw.push_back(channel_num);
            id(light_tuya).set_raw_datapoint_value(107, raw);
  - platform: template
    name: "Reset Time to 12:00"
    icon: "mdi:timer"
    on_press:
      - lambda: |-
            id(light_tuya).set_string_datapoint_value(103, "120000");