Change HA Button display name

Hey All,
I would like to have a Button that sets my light from off to on to automatic and would like to change the “label” of the button inside HA so i can know what mode it is currently in.
I tried changing the name using an API call but that changed the full entity name and Node Red didnt register any further clicks of the Button.

Is there a way to change just the Display name inside HA?

My API call json looks like this:

{
    "data": {
        "type": "nodered/discovery",
        "server_id": "",
        "node_id": "",
        "component": "button",
        "config": {
            "name": "off"
        }
    }
}

If I understand you correctly, you want to have a momentary switch that you can press and that changes the name depending on the state of a light. Can you clarify some things please?
What entity, or helper in HA are you using for this “button”?
Can you maybe share a screenshot from you HA Dashboard?

Is this an issue with functionality? Or simply UI?

First thing that comes to mind:
Simply use a dropdown list with the 3 choices. Then automate this one in nodered.

However, if you simply want a momentary switch things might get more complicated.
You can probably use template to achieve what you want, and I dont think you need NodeRed for this. So this probably is better in the general/UI subthreads.

The entitiy im using is the “button” from “home assistant entities”

Here is my NodeRed automation (i know that there is a lot of things i should optimize)

At the botton there is my “Wohnzimmer Lampen Override Button” which is the home assistant entity button, when i change the name using the api calls at the right bottom, it won’t detect the buttom press anymore and the function “Button Zähler” is not called anymore.

Using a dropdown would definitely work, i should try it even though i would prefer the button with changing names.

I try to avoid every HA automation / template since i dont really understand it that well, thats why i tried to do everything in NodeRed

Since i can only Post one picture at a time currently, here is my HA dashboard.

I never used this button entity and when looking at the documentation its not immediately clear if they even support the change of naming only.

edit: Did you try just changing the friendly_name attribute via the API Call?

However, thinking about it, you probably will have the easiest result by using a custom card in your HomeAssistant UI. I just tested the following by adding a custom:mushroom-template-card that on click toggles the light and will then show the current color_temp of the light as the text.

type: custom:mushroom-template-card
primary: |-
  {% if is_state("light.desklamp", "on") -%}
    The Color temperature is {{ (state_attr('light.desklamp', 'color_temp')) }}.
  {%- else -%}
    The Light is off
  {%- endif %}
secondary: ''
icon: mdi:home
entity: light.desklamp
tap_action:
  action: toggle
fill_container: true
multiline_secondary: false

image

Maybe that can point you into the right direction.

Yes, everytime i try to change the “friendly_name” it still changes the entity, but it changes it to the given “node_id” instead of the given “friendly_name” for whatever reason.

I also tried your idea with the dropdown list, but could not find it as a Home Assistant Entity and only as a Node Red Dashboard Entity and as far as i know i cannot add this to my HA Dashboard, please correct me if i’m wrong.

But your custom card brings me the idea, that i could create a sensor inside of NodeRed connected to HA and set the Sensor Values in NodeRed and use those values with the Template as the Name.

Use the update config node

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/update-config.html

I am confused. (So, what’s new?)

Is your button on the Home Assistant dashboard or the Node Red dashboard?

I tried it but didn’t get it to work, probably i did not use it right but i finally got it working using a virtual Sensor, setting the Value inside of NodeRed and showing it using the mushroom-template-card.

It’s on the Home Assistant Dashboard.