zachowj / node-red-contrib-home-assistant-websocket

Node-RED integration with Home Assistant
https://zachowj.github.io/node-red-contrib-home-assistant-websocket/
MIT License
499 stars 93 forks source link

Action node has no target if switch.turn_on is chosen #1648

Open Vartkat opened 1 week ago

Vartkat commented 1 week ago

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

zachowj commented 1 week ago

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

juansahome commented 1 week ago

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"

zachowj commented 1 week ago

@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.

juansahome commented 1 week ago

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

zachowj commented 1 week ago

@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"
}
Vartkat commented 6 days ago

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 ?

juansahome commented 6 days ago

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.

inguy24 commented 5 days ago

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.