Info::SHELLY prise 230V connectée: explications

De wiki_pcwiki2
Aller à la navigationAller à la recherche

KEYWORDS: SHELLY, EXPLICATIONS

Le 24/05/2026:
Pour allumer à distance une lampe rouge à la Gacerie (pour que Geneviève sache qu'on arrive pas à la joindre), j'ai acheté une prise Shelly.
 NB: Il y a un site web sur l'IP que j'ai choisie (''192.168.1.246/pcroad@gmail.com/Fr...11'') .look also @ http://192.168.1.246/#/settings
 
 root@srv18:~# curl -s http://192.168.1.246/shelly
{"name":null,"id":"shellyplugsg3-9070694d1430","mac":"9070694D1430","slot":1,"model":"S3PL-00112EU","gen":3,"fw_id":"20251113-160645/1.7.3-gb71e9ac","ver":"1.7.3","app":"PlugSG3","auth_en":false,"auth_domain":null,"matter":true}
Il s'agit d'une Shelly Plus Plug S de Génération 3 (que j'ai plugguée en 192.168.1.246)
Pour connaître toutes les caractéristiques:
curl -s http://192.168.1.246/rpc/Shelly.GetConfig
root@srv18:~# curl -s http://192.168.1.246/rpc/Shelly.GetConfig
{"ble":{"enable":true,"rpc":{"enable":true}},"bthome":{},"cloud":{"enable":true,"server":"shelly-261-eu.shelly.cloud:6022/jrpc"},"knx":{"enable":false,"ia":"15.15.255","routing":{"addr":"224.0.23.12:3671"}},"matter":{"enable":true},"mqtt":{"enable":false,"server":null,"client_id":"shellyplugsg3-9070694d1430","user":null,"ssl_ca":null,"topic_prefix":"shellyplugsg3-9070694d1430","rpc_ntf":true,"status_ntf":false,"use_client_cert":false,"enable_rpc":true,"enable_control":true},"plugs_ui":{"leds":{"mode":"power","colors":{"switch:0":{"on":{"rgb":[0.000,100.000,0.000],"brightness":100.000},"off":{"rgb":[100.000,0.000,0.000],"brightness":100.000}},"power":{"brightness":100.000}},"night_mode":{"enable":false,"brightness":100.000,"active_between":[]}},"controls":{"switch:0":{"in_mode":"momentary"}}},"switch:0":{"id":0, "name":null,"initial_state":"restore_last", "auto_on":false, "auto_on_delay":60.00, "auto_off":false, "auto_off_delay":60.00,"power_limit":2500,"voltage_limit":280,"autorecover_voltage_errors":false,"current_limit":12.000,"reverse":false},"sys":{"device":{"name":null,"mac":"9070694D1430","fw_id":"20251113-160645/1.7.3-gb71e9ac","discoverable":true,"eco_mode":false},"location":{"tz":"Europe/Paris","lat":48.858200,"lon":2.338700},"debug":{"level":2,"file_level":null,"mqtt":{"enable":false},"websocket":{"enable":false},"udp":{"addr":null}},"ui_data":{},"rpc_udp":{"dst_addr":null,"listen_port":null},"sntp":{"server":"time.cloudflare.com"},"cfg_rev":8},"wifi":{"ap":{"ssid":"ShellyPlugSG3-9070694D1430","is_open":true, "enable":true, "range_extender": {"enable":false}},"sta":{"ssid":null,"is_open":true, "enable":false, "ipv4mode":"dhcp","ip":null,"netmask":null,"gw":null,"nameserver":null},"sta1":{"ssid":"Freebox-CA0C41-2.4Ghz","is_open":false, "enable":true, "ipv4mode":"dhcp","ip":null,"netmask":null,"gw":null,"nameserver":null},"roam":{"rssi_thr":-80,"interval":60}},"ws":{"enable":false,"server":null,"ssl_ca":"ca.pem"}}
Pour sauvegarder les valeurs actuelles: curl -s http://192.168.1.246/rpc/Shelly.GetConfig > /WEB/genevieve.thabard.com/sauvegardeShelly.20260524.json

Pour restaurer: curl -s -X POST http://192.168.1.246/rpc/Shelly.SetConfig -d @/WEB/genevieve.thabard.com/sauvegardeShelly.20260524.json

Pour ajouter les fonctionnalités mosquitto au Shelly:
curl -s -X POST http://192.168.1.246/rpc/MQTT.SetConfig -d '{
 "config": {
   "enable": true,
   "server": "192.168.1.18:1883",
   "user": "srv18",
   "pass": "fromspace",
   "topic_prefix": "shelly/plug_salon"
 }

}'

Attention: réponse du Shelly: {"restart_required":true} (il faut redémarrer le Shelly)
curl -s http://192.168.1.246/rpc/Shelly.Reboot
Reboot:
curl -s http://192.168.1.246/rpc/Shelly.Reboot
Maintenant récupérons le statut via mosquitto: (Attention: cela prend du temps):
mosquitto_sub -h 127.0.0.1 -p 1883 -u srv18 -P fromspace -t "shelly/plug_salon/#" -v

Shelly/plug_salon/online true

Allumons la lampe via mosquitto:
mosquitto_pub -h 127.0.0.1 -p 1883 -u srv18 -P fromspace -t "shelly/plug_salon/rpc" -m '{"method":"Switch.Set", "params":{"id":0, "on":true}}'

Éteignons la lampe:
mosquitto_pub -h 127.0.0.1 -p 1883 -u srv18 -P fromspace -t "shelly/plug_salon/rpc" -m '{"method":"Switch.Set", "params":{"id":0, "on":false}}'

Obtenons le status immédiatement: 
mosquitto_pub -h 127.0.0.1 -p 1883 -u srv18 -P fromspace -t "shelly/plug_salon/rpc" -m '{"method":"Switch.GetStatus", "params":{"id":0}}'