Publish MQTT Data

I am new to MQTT, but not HA. I have two things I need to publish to MQTT so it is available to Scrypted that I have no idea how to do.

First, I have a motion sensor in HA that I want to use to create a motion sensor in Scrypted, using MQTT. Tips or links on how to create the device, and how to update the data when events happen.

The second is a binary button that I want to use to create a doorbell in scripted.

Any help or an example would be great. I don’t even know where to start. Searching has not come up with a good example for me yet.

You can do it with an automation.

e.g.

trigger:
  - platform: state
    entity_id: binary_sensor.motion
    not_to:
      - unknown
      - unavailable
action:
  - service: mqtt.publish
    data:
      topic: your/topic/here
      payload_template: "{{ trigger.to_state.state }}" # will publish 'on' or 'off' when the binary motion sensor changes
      qos: 0 # or 1 or 2, see: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels/
      retain: true # or false, see https://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages/

See: https://www.home-assistant.io/integrations/mqtt/#publish--dump-services

Thanks for your reply. Will that create the device in Scrypted? When I have tried something similar, I could never get a device in Scrypted to work correctly.

I played with the settings some more, and it looks like that does it. Thanks again for the help.

1 Like