Automation Breaks Light, Script does not

I am a total newbie so sorry if this is wrong spot, formatting, manner. I will learn.

Problem
Automation works but breaks the lights ability to be turned on and off. A similar script called from another PIR triggered automation does not do this.

Detail
Created a remote control using ESP-IDF on battery powered S3 device with macro keyboard (3 button and knob) as a portable remote control, this controls 3 lights in a room. This sends out JSON which has a target_device and the settings which is captured from MQTT on a subject and then acted upon.

Payload Example
{"target_light":"joanna_red_reading_light_light","state":"ON","brightness":128,"color_temp":2200,"xy_color":[0.53032141923904419,0.41342452168464661]}

Yaml

action: light.turn_on
metadata: {}
data:
  xy_color:
    - "{{ (trigger.payload | from_json).xy_color[0] | float }}"
    - "{{ (trigger.payload | from_json).xy_color[1] | float }}"
  brightness: "{{ (trigger.payload | from_json).brightness | float }}"
target:
  entity_id:
    - light.{{ (trigger.payload | from_json).target_light }}

Now once this fires if I try to turn that light on and off just using its basic switch in the overview it fails - continues to function in remote control automation. HOWEVER I can control the colour. So strange.

Script
I have a script which is called from another automation which does similar things - however the YAML is quite different and this does not break the light on and off mechanism.

type: turn_off
device_id: 3f7232bfa17693449f8e8a2202fc8063
entity_id: b640682e8406a5e53f4b10d0c7536bd1
domain: light

Can someone help me understand why my remote control automation which is extracting the device name from the payload via a yaml template is breaking the light on off please.


Here is a photo of two of my battery controlled remotes if anyone is interested. One is a colour slider with brightness knob with buttons to switch between targets and LED showing the result and OLED for what is happening. The other is macro keyboard which is causing the issues. First attempt was Arduino etc second was ESP-IDF.

Don’t think this matters.

Small zigbee is for PIR/MMWave radar presence detection and continued presence also in ESP-IDF.

Check your logs for errors related to this.

Nothing in relation to this. Have checked logs, Settings->System->logs etc.

For example here is how strange this is. The physical light itself was on, in overview light (the actual light button) was on. I clicked it and it turned off, and the physical light turned off. Within a few seconds the light toggle turned back on, but the physical light remains off.

But when I turn on the light with the “remote control” the GUI switch goes to the off position. Its like they are somehow out of sync.

I think its the way I am using the yaml in the Automation - I am sure of it.

I think it is to do with

action: light.turn_on

It should be type or service maybe.

NONE of this is registering in the Logbook except the automations.

Further testing. This is only happening to Tuya devices. I noticed that there was a major problem with Tuya devices not working two weeks ago and the most recent revision fixing this - mine was only installed yesterday and this is most likely the cause.

The issue resolved after another update from HA - so HA is now the most likely candidate (is the cause).

How do we go about contacting the Home Assistant development team - would it be core, front end, supervisor, operating-system? Not which Git to send this bug through to them on.

AS a follow up to this I posted on Home Assistant core and there appears to be a not insignificant amount of people experiencing the same problem.

If you have Tuya - this is most likely going to be affecting you.

Edited - see link to github issue tracker above.

Tuya server issue caused global problems.

Now resolved.