Tuya Not Refreshing Status entities

I add to delete/pair the plug with the tuya app and now it’s working again :+1: Also today, my Ikea zigbee plug stoped responding. After plugged/unplugged it, itstarted working again… I think that’s this requires a lot of maintenance :confused:

I have also noted there is more restarts needed now as posted here: Integrations stop responding in december version - Configuration - Home Assistant Community (home-assistant.io)

I stumbled across a pretty simple and elegant solution yesterday that can be found here: Tuya light switches don't remember state after toggle (Only reloading the integration helps) · Issue #61854 · home-assistant/core · GitHub

Pretty much the automation looks for the failed message in the system logs then reloads the Tuya config. I enabled it yesterday and it works well.

trigger:
  - platform: event
    event_type: system_log_event
    event_data:
      level: ERROR
      name: tuya_iot
  condition:
  - condition: template
    value_template: >-
      {{ "error while get mqtt config" in trigger.event.data.message[0] }}
  action:
  - service: homeassistant.reload_config_entry
    data:
      entity_id:
        - YOUR_TUYA_ENTITY_HERE

Be sure to add this to your configuration.yaml file:

system_log:
  fire_event: true
2 Likes

Same here :point_up: 4 entities, started some weeks ago

1 Like

I have noticed this since the last update. My devices function but the status is not updated in HA until the integration is reloaded.

1 Like

Update: Confirmed this fixed the issue.

Testing this fix out: Tuya Integration apparently fails to renew cloud access token - githubmate

I tried the homeassistant.reload_config_entry approach but it caused my devices to become unavailable after a couple of reloads.

This automation has been treating me better so far:

- id: '1641360148445'
  alias: Update Tuya Entities
  description: ''
  trigger:
  - platform: time_pattern
    minutes: /30
  condition: []
  action:
  - service: homeassistant.update_entity
    target:
      entity_id:
      - sensor.4kw_geyser_power
      - sensor.2kw_geyser_power
      - sensor.washing_machines_power
  mode: single

Just dropping this here in case it helps someone else.

4 Likes

@justanothernaude thank you for this automation. This helped me a lot. because my door sensors did not update their status to HA and restarting the whole Tuya V2 Integration seemed to be a bit like using a sledgehammer to crack a nut :slight_smile:

1 Like

Are there any plans to fix this? Do we need to file a bug somewhere?

2 Likes

This solved it for me…

1 Like