This the code I add in the automation.yaml
- id: shellies_announce
alias: 'Shellies Announce'
trigger:
- platform: homeassistant
event: start
- platform: time_pattern
hours: "/1"
action:
service: mqtt.publish
data:
topic: shellies/command
payload: announce
- id: 'shellies_discovery'
alias: 'Shellies Discovery'
mode: queued
max: 999
trigger:
platform: mqtt
topic: shellies/announce
action:
service: python_script.shellies_discovery
data_template:
id: '{{ trigger.payload_json.id }}'
mac: '{{ trigger.payload_json.mac }}'
fw_ver: '{{ trigger.payload_json.fw_ver }}'
discovery_prefix: 'hass'
qos: 2
shellyswitch25-68EF11:
mode: "roller"
roller-0-name: "Room Door"
roller-0-class: "door"
shellyswitch25-693FA7:
mode: "roller"
roller-0-name: "Room Window"
roller-0-class: "window"