This script allows you to control your hue lights with a Shelly BLU Button or virtual buttons. You can turn on/off lights, change brightness and color temperature. (Requires firmware version: 1.3 or newer)
This script will control a light entity in Home Assistant via a virtual boolean component in Shelly. The script will listen for changes in the boolean component and will turn on or off the light entity in Home Assistant accordingly.
Keeps measured usage between a low (min_before_re_adding) and high (max_before_shedding) total power (watts), by controlling power to other devices
Adds schedule, device, and notification templates and functionality to the original load shedding script.
Use this script paired with advanced-load-shedding.js to add a second source - example, grid, PV, generator, etc.
Reads voltage data from the Shelly Plus Add-on, calculate the corresponding temperature using the Steinhart-Hart equation, and take action based on the temperature reading
Example how to use a Shelly BLU Motion, read advertising data, decode and turn on switch. (Requires firmware version 0.12.0-beta1 or newer)
This script allows the creation of personalized commands for a Telegram bot, providing the ability to define handlers for each command and support for advanced parameter validation. (Requires firmware version: 1.0.0-beta or newer)
Script that handles and parses events from all Shelly BLU devices and emits event with the received data. Made to be used with "ble-events-handler.js" script that handles the events (Requires firmware version: 1.0.0-beta or newer)
ble-events-handler.js: Handles event from the device (at the moment tested only with BLU events from "ble-shelly-blu.js" example
Do automations based on events and easy conditioning. This script must be used with another script that emits events for example "ble-shelly-blu.js" script. (Requires firmware version: 1.0.0-beta or newer)
Example how to use a 3rd party BLE sensor and execute actions based on conditions. (Requires firmware version 0.12.0-beta1 or newer)
Example how to use a 3rd party BLE sensor and execute actions based on conditions. (Requires firmware version 0.12.0-beta1 or newer)
Use your Gen2 device as a gateway between Shelly Blu button1 and other Shelly devices (no matter Gen1 or Gen2) by sending local requests by their local IP APIs.
Replicate activation_switch profile from Gen1 devices.
BLE passive mode scanner for non-battery operated Gen2 devices. Decoding protocols Mijia/ATC/pvvx/BTHome2, forwards data to the MQTT broker with Autodiscovery objects. (Requires firmware version 0.12.0-beta1 or newer)
Example how to use a Shelly BLU Button, read advertising data, decode and turn on switch. (Requires firmware version 0.12.0-beta1 or newer)
Example how to use a Shelly BLU DoorWindow, read advertising data, decode and turn on switch. (Requires firmware version 0.12.0-beta1 or newer)
This script will scan aired advertisement data, select Shelly BLU devices and will print their name and address (Requires firmware version 0.12.0-beta1 or newer)
Example how to use a 3rd party BLE sensor, read data and turn on switch based on the data. (Requires firmware version 0.12.0-beta1 or newer)
Example how to use a 3rd party BLE sensor, read environment data. (Requires firmware version 0.12.0-beta1 or newer)
Replicate Cycle switch feature from Gen1 devices. Allows for custom list of operations to cycle through.
http-notify-on-power-threshold.js: Shelly XPM - Send HTTP notification if power goes above threshold
This script subscribes for notifications, monitors the instanteneous power of the output switch and if that goes above a threshold value and if current time is within the active time window will send an HTTP notification
This script registers a HTTP handler endpoint and implements simple logic for requests and handlers for those requests. Reconfiguration of a Switch component as an example is included
This script exposes a /status endpoint that returns Prometheus metrics that can be scraped.
This script listens for the event when the output is turned on, and starts counting the power reported in NotifyStatus every minute. It is accumulated in a counter and if the combined consumption is over a threshold the output is turned off.
The script, when run, will fetch via REST api from a weather service the current conditions for a location check if cloud coverage is above or below certain percentage and respectively open or close window shades by calling a Shelly 2.5 (Gen1) endpoint.
The script, when run, will subscribe to events and handle "cover_open_to" and "cover_close_to" events to open or close a cover to a certain position. "cover_open_to" also supports a "not_before" configuration to prevent opening the cover before a certain time.
precipitation-irrigation.js: Turn on/off watering based on precipitation in last 24 hours (based on AccuWeather data)
If there was precipitation in the past period (24h) skip an irrigation cycle. Data is retrieved from a public wather API service for the location. You can use any Shelly Plus 1/Pro 1 ot Pro 2 to control your irrigation system. Don't forger to add AutoOFF for max Irrigation time and set a Schedule which start irrigation in device webUI. Note: Configure your Accuweather APIKEY and end points in the script once you add it.
This script listens for events when power changes to 0 and if the switch is still on then it alerts that something might have happened to the load.
Script that will monitor the inputs of a Shelly and if there was no user interaction with the input(s) It will call an URL with a predefined message
Use MQTT in scripting to provide backwards compatibility with Gen1 MQTT topics shellies/announce and shellies/command
Use MQTT in scripting to provide backwards compatibility with Gen1 MQTT topics shellies/announce, shellies/command, /command, /command/switch:0/output.
Publish device status, input and switch status
This script is registering a virtual switch device in HA.
The implementation is banal and directly reports switch state and controls a switch, but you can have a totally different virtual device: valve, light, scene.
Note: Requires configuration.yaml change in HA, please refer to the comments in the code of this file.
This script is registering a virtual switch device in HA.
Switch sensors are also registered as entities.
Note: Requires configuration.yaml change in HA, please refer to the comments in the code of this file.
Use MQTT in scripting to provide switch status updates on a custom topic
Setup an N-Way dimmer group using Gen3, Pro, or Plus dimmer products. One dimmer is connected to the light while the other dimmer products can be useed to remotely control the light and will reflect the current state of the light. This setup only requires wifi connectivity, the swiches communicate directly with each other. You will need to update the CONFIG GROUP with the IP addresses of all the switches in the group.
objects.js: mJS example of how to create custom Objects that interact with components (Switch in this case)
Example of how to create wrappers around RPC calls and using Object.create.
Use a script to notify directly on your mobile phone via a push notification service.
A remote Shelly abstraction Call an RPC method on the remote Shelly
When the script is run it will check if it is registered in the schedule and if not will register itself
When device boots and there is a schedule that has to be active at the moment it won't be executed. This script walks through the configured schedules and runs the one that should be active at that moment of time.
This script tries to execute HTTP GET requests within a set time, against a set of endpoints.
After certain number of failures the script sets the Switch off and after some time turns it back on.
Monitors any device or service that returns data from HTTP/HTTPS requests. Executes webhooks and/or updates MQTT topics.
Simple scene abstraction A scene is an array of actions or conditions that are played squentially.
An action can have a delay property, which means after executing the action function wait until proceeding to the next one.
A condition is an element of a scene that has property type:"cond". If the result is true, the scene continues with the next item, if it is false it stops.
Simple fix for outgoing Domoticz MQTTAD command 'GoToPosition'. Shelly firmware 0.x supported. Developed for ShellyTeacher4Domo.
Simple fix for outgoing Domoticz MQTTAD command 'GoToPosition'. Only Shelly firmware >= 1.x supported. Developed for ShellyTeacher4Domo.
Playing a scene with four Shellies with that have a lamp as a load.
Demonstration of a "Remote Shelly" wrapper object. object prototyping, and simple scene player.
Turn on when temperature is below CONFIG.tempBelowTurnOn.
Turn off when temperature is above CONFIG.tempAboveTurnOff.
For getting an API-KEY from Accuweather follow the instructions on their site for registering a new application, copy the key and paste it here.
This scripts periodically scans for access points with SSID matching the template for Shelly Plus device APs and if found, will connect to that AP and provision WiFi credentials.
Use MQTT in scripting to periodically provide switch status updates on the mentioned topic "<topic_prefix>/status/switch:0"
Example showing how to work with Input component's events.
Example showing how to read Input component's status.
Example showing how to work with Switch component's events.
Example how to read Switch notifications and listen for when active power is more than 4W.
Example of reading Switch component's status.
Monitor for valid IP assignment from DHCP server and reboot if not received within a certain time period.
This script is about shares any BLU product's complete payload to MQTT..