MQTT Mosquitto Shelly: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Zeile 20: Zeile 20:
 
=Unsichere Verbindnung=
 
=Unsichere Verbindnung=
 
[[Datei:Shelly-2.png]]
 
[[Datei:Shelly-2.png]]
 
+
=Schalten über die Konsole=
 
+
;An
 
+
*mosquitto_pub -h 172.26.255.100 -u xinux -P 123Start$ -t "shellyplus1-255/rpc" m '{"id":1,"src":"user","method":"Switch.Set","params":{"id":0,"on":true}}'
[[Datei:Shelly-3.png]]
+
;Aus
 +
*mosquitto_pub -h 172.26.255.100 -u xinux -P 123Start$ -t "shellyplus1-255/rpc" -m '{"id":1,"src":"user","method":"Switch.Set","params":{"id":0,"on":false}}'

Version vom 31. Oktober 2024, 11:00 Uhr

Der Mosquitto Broker

Installation
  • sudo apt install mosquitto mosquitto-clients
Passwot setzen
  • sudo mosquitto_passwd -c /etc/mosquitto/passwd xinux
Grundkonfiguration
  • sudo cat /etc/mosquitto/conf.d/default.conf
allow_anonymous false
password_file /etc/mosquitto/passwd
bind_address 0.0.0.0
log_type all
log_type debug
Restarten des Brokers
  • sudo systemctl restart mosquitto.service

Verbindung

  • Wir verbinden uns über WLAN(Smartphone mit dem Shelly.

Wlan Client

Shelly-1.png

Unsichere Verbindnung

Shelly-2.png

Schalten über die Konsole

An
  • mosquitto_pub -h 172.26.255.100 -u xinux -P 123Start$ -t "shellyplus1-255/rpc" m '{"id":1,"src":"user","method":"Switch.Set","params":{"id":0,"on":true}}'
Aus
  • mosquitto_pub -h 172.26.255.100 -u xinux -P 123Start$ -t "shellyplus1-255/rpc" -m '{"id":1,"src":"user","method":"Switch.Set","params":{"id":0,"on":false}}'