Shelly Scripts Suite

What started as a single script has grown into a full suite! You can check out the whole collection on GitHub: michalk-k/shelly-scripts

:rocket: Shelly Script Upload Utility

This utility handles uploading any script to a Shelly device via the RPC API. It can grab a local file or download a script directly from a URL (like GitHub).

Features

  • Bash and PowerShell version
  • Upload from remote location or local file
  • Supports Shelly device authentication
  • Chunked uploads (required by Shelly) & Progress indicator
  • Option to set the Autostart and Run after upload
  • Recognize already uploaded script by its name to overwrite it, if requested.

deploy_script

:bar_chart: MQTT Discovery: Scripts Monitor

This is a script designed to run directly on your Shelly Gen2+ device.

It monitors the state of all installed scripts and pushes that data to Home Assistant. The state of all installed scripts is collected and reported to sensor entity, which is registered in HA using MQTT discovery.

The entity tracks the total number of running scripts and provides deep-dive attributes for each one:

Example of sensor attributes available:

{
  "scripts": [
    {
      "enable": true,
      "id": 1,
      "mem_peak": 14294,
      "mem_used": 9282,
      "name": "ble-pasv-mqtt-gw",
      "running": true
    },
    {
      "enable": false,
      "id": 2,
      "name": "mqtt-discovery-self",
      "running": false
    },
    {
      "enable": true,
      "id": 3,
      "mem_peak": 4270,
      "mem_used": 2982,
      "name": "scripts/mqtt-discovery-scr-mon.shelly.js",
      "running": true
    },
    {
      "enable": false,
      "id": 4,
      "mem_peak": 12852,
      "mem_used": 9268,
      "name": "mqtt-discovery-self.shelly.js",
      "running": true
    },
    {
      "enable": false,
      "id": 5,
      "name": "test",
      "running": false
    },
    {
      "enable": false,
      "id": 6,
      "name": "test.shelly.js",
      "running": false
    }
  ],
  "scripts_mem_free": 3178,
}

:arrows_counterclockwise: MQTT Periodic Component Publisher

It republishes the states of selected components at a configurable interval. It’s perfect for tracking things that update infrequently, like temperature sensors, or for capturing system data that Shelly doesn’t natively push (ie wifi). You can target specific instances (e.g., temperature:0) or everything in a category (e.g., temperature).

Publishing is throttled to avoid overloading of Shelly internal MQTT queue.

:house: MQTT Discovery: SELF

This script automatically registers all Shelly components in Home Assistant using MQTT Discovery. It’s a great alternative if you want to avoid manual YAML configuration or external Python scripts.

I’ve done a deeper dive on this one in a previous post: Shelly Script MQTT Discovery

:satellite: MQTT Discovery: BLE

This one registers BLE sensors and buttons (proxied through your Shelly Gen2+) to Home Assistant via MQTT Discovery.

Check out the full breakdown here: Shelly Script for BLE Devices

1 Like