How to change attributes of a discover mqtt entity? forever to static

I donā€™t know how to do that, never used auto discovery.
Is it possible to disable it?

yeah, i can disable it and create every sensor manually
think i going for that road,

i thought it should be possible to edit an disovered mqtt entity, to remain static

well, if it re-creates it on every restart then noā€¦ but we can only find out if we look at the code.

ok, gonna create the sensors and all stuff manually and then disable it :slight_smile:

hmm, now disabled ā€œauto entityesā€ in the mqtt intregration, when i restart docker, it creates again all the sensors

using this one : https://github.com/home-assistant/hassio-addons/tree/master/mosquitto

how to disable autodiscovery?

did you read this btw? and this?
and anything mqtt-related in your ./storage?

Ok, thnx , need to read some more

just add it to customization and it will stick forever, but you have to use the yaml customization, not the UI.

homeassistant:
  customize:
    alarm_control_panel.risco_alarm_panel_0:
      code_arm_required: true
1 Like

Aha! Thnx

Possible I can change also the name and friendly name thereā€¦

Yeah, lots of things including friendly_name. You can override any attribute in the customize section. It does get wonky with some things, but it should always work.

But after some more trying with mqtt, gonna make it manual as sensorsā€¦

Cause if i reboot HA, my sensor and panel are not visible anymore, untill I restart that dockerā€¦

So gonna make all manual in yaml , then disable autodiscovery

I personally donā€™t use discovery. I hard code all my devices. Itā€™s more overhead but they always work and never change names.

1 Like

Indeed , going for the manual road also

Thnx anyway!

It says nothing about overriding attributes in the docs :frowning: - how do you know about it?
Just yesterday I saw this and it apparently works - again, never saw that beforeā€¦ perhaps because Iā€™m not a huge customiser anyway :wink:

Marius is using the Custom UI integration. Thatā€™s what allows for the use of templates in customize.yaml (and the templates use Javascript).

Do you mean that itā€™s possible because of Custom UI?

Correct. Thatā€™s one of the enhancements provided by the Custom UI integration.

so it has nothing to do with this topic, got it.
thanks :slight_smile:

You can modify the discovery payload created by a physical device or even create your own entity via MQTT Discovery.

For example, run this script from the Services page and it will create a new entity called light.example.

  example_create:
    alias: 'Create Example MQTT Light'
    sequence:
      service: mqtt.publish
      data:
        topic: 'homeassistant/light/example/config'
        retain: true
        payload: >
          {
            "name": "Example",
            "unique_id": "ABC123",
            "stat_t": "home/example",
            "cmd_t": "home/example/set",
            "bri_stat_t": "home/example/brightness",
            "bri_cmd_t": "home/example/brightness/set"
          }

The newly created entity will appear in States, Entities, and MQTT Integrations views.

Letā€™s say you just ran the script and Home Assistant has created light.example. Now you want to add an option like the color temperature state topic. Simply add it to the scriptā€™s payload, (reload scripts), run it again and Home Assistant will not create a new entity but simply update the existing one. For example, Iā€™ve added two topics for handling color temperature:

  example_create:
    alias: 'Create Example MQTT Light'
    sequence:
      service: mqtt.publish
      data:
        topic: 'homeassistant/light/example/config'
        retain: true
        payload: >
          {
            "name": "Example",
            "unique_id": "ABC123",
            "stat_t": "home/example",
            "cmd_t": "home/example/set",
            "bri_stat_t": "home/example/brightness",
            "bri_cmd_t": "home/example/brightness/set",
            "clr_temp_stat_t": "home/example/color",
            "clr_temp_cmd_t": "home/example/color/set"
          }

Running this revised script wonā€™t create a light.example_02 but simply update the existing one.

If you want to delete light.example, run this script. It simply publishes an empty retained message to the entityā€™s discovery topic.

  example_delete:
    alias: 'Delete Example MQTT Light'
    sequence:
      service: mqtt.publish
      data:
        topic: 'ha/light/example/config'
        retain: true
        payload: ''

NOTE: Deleting the entity this way will make Home Assistant remove the entity from States and Entities views. However, in the MQTT Integrations view it will mark the entity as Unavailable. In other words, the entity continues to exist in the entity registry. You can click the entity to reveal a dialog-box that allows you to Remove Entity (from the registry). Unfortunately, thereā€™s a bug and it wonā€™t reveal that dialog-box until you restart Home Assistant. Iā€™ve posted it as bug in the home-assistant-polymer repo (it may actually be due to a bug in the backend, not the frontend, but Iā€™ll let the developers decide that).

trial by fire. Iā€™ve had to do it for some zwave lights to get functionality.

1 Like