Publish Vibration sensor attributes to mqtt

Hi all, I’m just getting back into HA after a few years, and I’m still getting used to the new version.

I’m trying to publish some data from a vibration sensor to MQTT with an Automation, and I get as far as the On/Off state, but I’d really like to publish the attributes as well, stuff like “tilt angle”, “vibrationstrength” etc.

I used to be able to do this by editing the YAML, but as I’ve discovered recently, that’s not really the way anymore.

Can anyone help me on my way with this?

Hello thekevinkalis,

If you are using MQTT discovery or creating entities from raw MQTT topics, YAML is still the only way. Hasn’t changed much in quite a while.

OK, thanks for the info, at least I know which way to look now. A follow-up, maybe. I used to configure MQTT as follows in the “configurations.yaml”

mqtt:
  broker: localhost
  port: 1883
  username: username
  password: password

mqtt_statestream:
  base_topic: asdf180
  publish_attributes: true
  publish_timestamps: true
  include:
    entities:
      - binary_sensor.vibration_sensor_1
      - sensor.processor_use

but the actual connection information gives me errors when I validate the configuration and the “mqtt_statestream” doesn’t seem to do anything.

Can you maybe give me an example of a working configuration? I’m just trying to publish the attributes, but it appears my brain is doing a dumb.