Prompt
Go to this wiki https://tb.kouman.eu/wiki/ems.html and study how their scripting language for esp32 boards works. Then please:
- Use '_' prefixed locals inside macro commands to avoid variable collisions across expansions.
- Keep the script including comments under 5000 bytes.
Write an Etheras Microscript for the SmartI8 board (DI=8, DO=8, AI=8, WiFi/Ethernet/LoRaWAN).
Behavior:
- Use in(1)..in(8) as toggle buttons; on p_edge(in(i)) toggle out(i).
- All relay changes must be delayed by 3000 ms.
- Scan inputs every 100 ms and update ioreport when any relay changes. Also emit ioreport every 60 seconds.
- Provide MQTT control: onmqtt("light1_script")..onmqtt("light8_script") accept ON/OFF and numeric payloads to set relays.
Add onmqtt("all_on_script") and onmqtt("all_off_script") to set all relays.