This script republishes, at a configurable interval, the states of selected components to MQTT.
It is useful for components that are never published by the Shelly device (e.g. wifi, eth) or for values that are updated only infrequently, such as temperatures.
💡 Note: The switch component also includes temperature measurements. To refresh this temperature more frequently, the switch component itself must be published.
⚠️ Avoid publishing the same components by different scripts. For examplemqtt-discovery-selfscript by default publisheswifi.
Features
- Easy to use: just run it
- Publishes data from all components, including those not reported by Shelly by default
- Allows configuration of a specific instance (e.g.
temperature:0) or all instances of a component (e.g.temperature)
- Shelly Gen2, Gen3, or Gen4 device
- MQTT must be configured and enabled on the Shelly device
For installation instructions, see the Installation section.
Link to the script: link
Configuration parameters
The script is designed to run without any additional configuration.
While this is sufficient for most use cases, several settings can be customized if needed.
| Variable | Default Value | Description |
|---|---|---|
components |
["temperature"] |
List of components or their instances, e.g. temperature or temperature:0 |
refresh_period |
60 |
[seconds] Interval at which component state data is published |
publish_delay |
500 |
[milliseconds] Delay between publishing individual topics, to prevent internal Shelly MQTT queue overflow |