Shelly Gen2 BLE Gateway Script for BLU Button1 Integration

Enable seamless interaction between Shelly BLU Button1 and other Shelly devices with this Gen2 script, which facilitates local API requests based on button events. Users can map specific URLs to button actions like single, double, and triple pushes. The script efficiently queues and processes URL requests, subject to the limitation of five concurrent RPC calls. Before deployment, configure the MAC address for your BLU Button1, and define desired actions for each button event. Ideal for automating responses across different Shelly ecosystems, this script allows you to streamline control of various device generations.

* What you should change before using it:
bluButtonAddress -> You should put the mac address of your blu button here.
This script will help you find the mac address: https://github.com/ALLTERCO/shelly-script-examples/blob/main/ble-shelly-scanner.js

Actions:

You should put the urls here to be executed at the specified event. Urls that shoudl be called on single/short push of the button, must be placed in the singlePush object. This applies to the double and triple push as well. Example below.

Limitations:
At the moment there is a limit of 5 RPC calls at the same time and because of this, the script will execute every 3 urls with a 1 second delay.
Limitations can be check here: https://shelly-api-docs.shelly.cloud/gen2/Scripts/ShellyScriptLanguageFeatures#resource-limits

The order of the execution of the urls can't be guaranteed