node-red-contrib-home-assistant-websocket icon indicating copy to clipboard operation
node-red-contrib-home-assistant-websocket copied to clipboard

Action node has no target if switch.turn_on is chosen

Open Vartkat opened this issue 1 year ago • 8 comments

Describe the bug

In action Node if switch_turn_on is set in action field there's no more interface to set target

To Reproduce

Drag an action node, Open and choose switch.turn_on as action The target field disappears

Expected behavior

I was hoping to keep the target :-)

Screenshots

Before : image After : image

Example Flow

not necessary

Environment Information

Version: 0.74.1

Home Assistant version: 2024.10.2 Companion version: 4.1.1

Node-RED version: 4.0.3 Docker: yes Add-on: 18.1.1

Node.js version: v18.20.4 arm linux OS: Linux 6.1.0-26-arm64 arm

Additional context

Home Assistant Core 2024.10.2 Supervisor 2024.10.0 Operating System Interface utilisateur 20241002.3 Node-RED Current version: 18.1.1

Vartkat avatar Oct 14 '24 12:10 Vartkat

Try accessing the Node-RED UI via port 1880 and not through the Home Assistant UI

zachowj avatar Oct 14 '24 12:10 zachowj

I have the same issue. Few days ago I create a new flow and no issue, now the option is missing (and also the layout changed).

On existing nodes now there is the following error message: "Entity ID 'media_player.xxx' should be in the data property, not the target property, for the selected action"

juansahome avatar Oct 14 '24 20:10 juansahome

@juansahome Based on the error, it looks like the action you're using expects the entity_id to be placed in the data field rather than the target field. That's why you're not seeing the target field displayed.

zachowj avatar Oct 14 '24 21:10 zachowj

I understand what you're saying, but before (last 3 years was working correctly).

Also, when you're trying to create now an action node, no option to select any Data or Entity ID:

image

juansahome avatar Oct 14 '24 21:10 juansahome

@juansahome

This change was introduced in version 0.66.0, as the properties were previously handled incorrectly. The update aligns the schema with Home Assistant’s behavior. If you build the same action in Home Assistant and switch to YAML mode, you'll see that these properties are correctly placed under the data property.

In version 0.66.0, actions with entity IDs incorrectly placed in target.entity_id instead of data.entity_id will now throw errors.

{
  "message": "Prueba",
  "entity_id": "media_player.xxx"
}

zachowj avatar Oct 14 '24 21:10 zachowj

Being aligned with Home Assistant doesn't prevent from offering a nice UI. As you can change the interface on the fly, if it's switch domain you can do the same + button as entities but name it Data or think of something more user friendly than having to find the entity id and write it in a JSON. No ?

Vartkat avatar Oct 15 '24 12:10 Vartkat

I agree with @Vartkat

Being aligned and correcting an incorrect handling of the frontend interface, doesn't prevent to disable it, but to allow only the correct settings - as it's being done with other actions (such as the input_boolean.toogle that only allows boolean entities) - as currently the tts.google_translate_say cannot be created/corrected from the interface, so for me that's an issue - and the workaround - if the user wants to only use the fronted / interface - is to use the editor.

juansahome avatar Oct 15 '24 19:10 juansahome

I have to agree with @Vartkat and @juansahome as well. Although I completely understand the need to mirror the HA standards, I think they screwed the pooch on this one. It makes it difficult to easily select targets as I have to go to my lists of entities instead of just starting to type one in the target field and have it autocomplete. Perhaps this needs raised with HA as well as to why they seem to deviate from their other actions that would still have targets? This really does create problems where I am already passing a good deal of information via the msg.payload function for the data,data field but now would need to hard code in my entities in functions as opposed to just quickly placing them in the target field of the action node.

inguy24 avatar Oct 17 '24 01:10 inguy24

fixed in https://github.com/zachowj/node-red-contrib-home-assistant-websocket/releases/tag/v0.74.2

zachowj avatar Oct 26 '24 04:10 zachowj

I am not sure, but this does not seem to fix this issue in the 0.74.2. I have this version and still cannot see any field in the web ui to select the targets when using something like switch.turn_on.

hatch01 avatar Nov 13 '24 15:11 hatch01

@hatch01 Please create a new issue.

zachowj avatar Nov 15 '24 00:11 zachowj