MQTT Publish on State change - Working

Success within just a few minutes of integrating HA with an external MQTT broker…

Added the MQTT integration, and then configured the state stream as per

And immediately I saw the homeassistant//switch or homeassistant/binary_sensor

Pretty happy with it as it worked instantly.

My questions are

  1. Is this the preferred way to do the integration?

  2. I have a “XXX’s Office” motion sensor name but it shows up as /homeasistant/binary_sensor/z_wave_pir_motion_sensor_sensor_state_any and 5 subtopics.

Is there a better way to name it as /homeasistant/XXX_Office/State

as it seems the MQTT integration uses the enttity name then published the friendly name as a topic (one of the 5 subs)

To do the integration with what?
You are just publishing states to MQTT, here…

What i’m wondering is if this is the suggested (and supported) method of publishing state information. I saw docusments about MQTT statestream, Node Red, eventstream, etc.

This is a new setup so i’m triyng to ensure that I don’t use a soon to be deprecated feature.

Here is the issue, now expanded overnight to include 10 more topics. IT’s getting out of hand…

Why is it an issue? By default, the state of all entities is exported to MQTT indeed.
You can include and/or exclude the entities you want exported:

Once again, if you don’t tell what you’re trying to achieve, we cannot really help you

Thanks Koying.

The issue is that i’m flooded with topics for things I don’t need.
The ones I do need have their entity name sent, not the friendly name and it’s not easily parseable. EG. a door open/close sensor sense it’s Friendly name in the /homeasistant/binary_sensor/z_wave_pir_motion_sensor_sensor_state_ topic

It will be a major challenge for me to try and manage 20 different sensors like this.

Is there a way to just send the specific names or change the topic/message style that I want.

I’ll give the filter a try but it may not solve my easy of use question above. Wish there was a slider in the device that says “publish to MQTT” . The include option makes sense but it’s going to be very manual.

Easily parseable: /homeassistant/<domain>/<entity_id>
Use publish_attributes to also, well, publish attributes (like friendly_name)

What.are.you.trying.to.achieve?

I’m not clear on the publish_attributes part.

What I have right now is 60-70 topics from 6-7 different sesnsors. It’s become unmanagable because I haven’t filtered anything.

I’m just trying to get teh open/closed or motion state, not all the battery status, cover open/closed, sun state, etc.

I Guess i’ll have to go configure the filters.

I wish I could have /homeasssistant/domain/Friendly_Name/state and not all the entity names as i have 4-5 of the same sensor types and they show up as _2, _3, _4 etc.

I’m to the point where i’m getting too much data…
I tried to filter with the MQTT state stream but it doesn’t seem to be working.

eg. Tried to remove sun, all of the button ping messages, and other status but it doesn’t seem to work

mqtt_statestream:
base_topic: homeassistant
publish_attributes: true
publish_timestamps: true
exclude:
entities:
- sensor.sun
- sun.sun
entity_globs:
- button.node_*
- sensor.node_**node_status
- button.node
_ping
- binary_sensor.
_cover_removed

image

Just try an include. From my configuration

mqtt_statestream:
  base_topic: statestream
  publish_attributes: true
  publish_timestamps: true  
  include:
    entities:  
      - light.smart_plaffoniere

and only that one is published

Thank you Francisp. That may work, but i’d also like to understand the exclusions and wildcards. There are a bunch of sensors that I want and listing the entities would be a challenge.

I tried this overnight and it does seem to be easier to select what I want rather than exclude what I don’t.

I wish there was an easier way though. How about a selection checkbox in mqttstream to allow you to include or exclude entitties