Beiträge von Marco Schmidt

    In deiner Homebridge-Config steht: stat/sonoff/POWER. sonoff ist der von Tasmota übermittelte Topic. In deinem Tasmota steht aber TV unter topic. Das muss identisch sein.


    Wieso hast du in Tasmota "Generic" eingestellt? Da muss der Sonoff-Typ rein, also vermutlich Basic.


    Übernimm die Standard-Config von Mosquitto, bind_adress ist nicht notwendig, zumindest dann nicht, wenn Homebridge und Mosquitto auf dem gleichen Server laufen.


    Zusammengefasst:


    Tasmota: Umstellen auf Basic, topic ändern in tv (klein geschrieben, linuxfreundlich)

    -------------

    Config (nano /etc/mosquitto/mosquitto.conf) von Mosquitto anlegen bzw. ändern in:


    # Place your local configuration in /etc/mosquitto/conf.d/

    #

    # A full description of the configuration file is at

    # /usr/share/doc/mosquitto/examples/mosquitto.conf.example


    pid_file /var/run/mosquitto.pid


    persistence true

    persistence_location /var/lib/mosquitto/


    log_dest file /var/log/mosquitto/mosquitto.log


    include_dir /etc/mosquitto/conf.d

    --------------


    Prüfen, wo mosquitto installiert wurde mit: which mosquitto


    /etc/systemd/system/mosquitto.service muss entsprechend lauten (Pfad anpassen, falls which mosquitto einen anderen Pfade ergibt, als: /usr/local/sbin/):


    [Unit]

    Description=Mosquitto MQTT Broker daemon

    After=network.target

    Requires=network.target


    [Service]

    Type=forking

    RemainAfterExit=no

    StartLimitInterval=0

    PIDFile=/var/run/mosquitto.pid

    # Note: The following paths may be different on your system.

    ExecStart=/usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf -d

    ExecReload=/bin/kill -HUP $MAINPID

    Restart=on-failure

    RestartSec=2


    [Install]

    WantedBy=multi-user.target

    -----------------

    Homebridge-Config muss dann folgendermaßen lauten (sofern Mosquitto auf dem gleichen Server, wie Homebridge läuft):


    {

    "accessory": "mqtt-switch-tasmota",

    "switchType": "outlet",

    "name": "TV",

    "url": "mqtt://127.0.0.1",

    "username": "",

    "password": "",

    "topics": {

    "statusGet": "stat/tv/RESULT",

    "statusSet": "cmnd/tv/POWER",

    "stateGet": "tele/tv/STATE"

    },

    "onValue": "ON",

    "offValue": "OFF",

    "activityTopic": "tele/tv/LWT",

    "activityParameter": "Online",

    "startCmd": "cmnd/tv/TelePeriod",

    "startParameter": "60",

    "manufacturer": "ITEAD",

    "model": "Sonoff",

    "serialNumberMAC": "XX:XX:XX:XX:XX:XX"

    }


    MAC-Adresse des Sonoffs noch eintragen.

    Viel Erfolg. Bei MEL sollte ein Adapter 170 kosten. Deshalb lese ich die Temps per MobileAlert-Sensoren aus und schalte mittels Broadlink. Klappt wunderbar. Temp über 24 schalte AC an. Demnächst kommen noch Xiamo Fenstersensoren dazu, schließlich soll die Anlage ausgehen, wenn das Fenster aufgeht.



    Sent from my iPhone using Community

    Und falls die Schalter damit nicht funktionieren, probier mal die Minimalkonfiguration:


    {

    "accessory": "mqtt-switch-tasmota",

    "switchType": "outlet",

    "name": "SteckdoseLicht1",

    "url": "mqtt://127.0.0.1",

    "username": "",

    "password": "",

    "topics": {

    "statusGet": "stat/steckdoselicht/POWER1",

    "statusSet": "cmnd/steckdoselicht/POWER1",

    }

    },

    {

    "accessory": "mqtt-switch-tasmota",

    "switchType": "outlet",

    "name": "SteckdoseLicht2",

    "url": "mqtt://127.0.0.1",

    "username": "",

    "password": "",

    "topics": {

    "statusGet": "stat/steckdoselicht/POWER2",

    "statusSet": "cmnd/steckdoselicht/POWER2",

    }

    }

    Wenn du also den topic in steckdoselicht geändert hast und die Schalter in:


    {

    "accessory": "mqtt-switch-tasmota",

    "switchType": "outlet",

    "name": "SteckdoseLicht1",

    "url": "mqtt://127.0.0.1",

    "username": "",

    "password": "",

    "topics": {

    "statusGet": "stat/steckdoselicht/RESULT",

    "statusSet": "cmnd/steckdoselicht/POWER1",

    "stateGet": "tele/steckdoselicht/STATE"

    },

    "onValue": "ON",

    "offValue": "OFF",

    "activityTopic": "tele/steckdoselicht/LWT",

    "activityParameter": "Online",

    "startCmd": "cmnd/steckdoselicht/TelePeriod",

    "startParameter": "60",

    "manufacturer": "ITEAD",

    "model": "Sonoff",

    "serialNumberMAC": "XX:XX:XX:XX:XX:XX"

    },

    {

    "accessory": "mqtt-switch-tasmota",

    "switchType": "outlet",

    "name": "SteckdoseLicht2",

    "url": "mqtt://127.0.0.1",

    "username": "",

    "password": "",

    "topics": {

    "statusGet": "stat/steckdoselicht/RESULT",

    "statusSet": "cmnd/steckdoselicht/POWER2",

    "stateGet": "tele/steckdoselicht/STATE"

    },

    "onValue": "ON",

    "offValue": "OFF",

    "activityTopic": "tele/steckdoselicht/LWT",

    "activityParameter": "Online",

    "startCmd": "cmnd/steckdoselicht/TelePeriod",

    "startParameter": "60",

    "manufacturer": "ITEAD",

    "model": "Sonoff",

    "serialNumberMAC": "XX:XX:XX:XX:XX:XX"

    }

    Merkste was?


    In Homebridge haben wir konfiguriert:


    "statusGet": "stat/steckdoselicht/RESULT",

    "statusSet": "cmnd/steckdoselicht/POWER",

    "stateGet": "tele/steckdoselicht/STATE"


    Im Log von Tasmota steht:


    stat/Stube/POWER1


    Meinst du, das funktioniert so?


    Im Übrigen musst du für den 2. Schalter in Homebridge nochmal so einen Schalter anlegen. Entsprechend sind in beiden Schaltern die Werte zu ändern. Also z.B. nicht POWER sondern POWER1 und beim 2. Schalter POWER2.

    Wieso 2 Schalter? Es muss nur einer auftauchen. Die ganze config.json-Konfiguration, die ich gepostet habe, ist nur für einen Schalter. Nämlich erst einmal für steckdosenlicht. Also nochmal von vorn.


    systemctl stop mosquitto

    killall -9 mosquitto


    mosquitto


    Log posten.

    Du machst jetzt folgende Schritte.


    systemctl daemon-reload

    systemctl stop mosquitto

    systemctl disable mosquitto


    nano /etc/systemd/system/mosquitto.service


    Folgenden Inhalt reinkopieren:


    [Unit]

    Description=Mosquitto MQTT Broker

    Documentation=man:mosquitto(8)

    Documentation=man:mosquitto.conf(5)

    ConditionPathExists=/etc/mosquitto/mosquitto.conf

    After=xdk-daemon.service


    [Service]

    ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

    ExecReload=/bin/kill -HUP $MAINPID

    User=mosquitto

    Restart=on-failure

    RestartSec=10


    [Install]

    WantedBy=multi-user.target


    strg und o zum speichern

    strg und x zum schließen


    systemctl daemon-reload

    systemctl enable mosquitto

    systemctl start mosquitto


    Anschließend gibst du im Reiter MQTT deinen Sonoffs bitte ordentliche Namen ohne Querstrich, also nicht: Steckdose/Licht sondern steckdoselicht z.B., mit Schrägstrich wird es niemals funktionieren.


    Anschließend muss die config.json der Homebridge noch angepasst werden, beachte am Ende des Schalters die Mac-Adresse. Ist im Tasmota-Menü unter Informationen:


    "accessories": [

    {

    "accessory": "mqtt-switch-tasmota",

    "switchType": "outlet",

    "name": "SteckdoseLicht",

    "url": "mqtt://127.0.0.1",

    "username": "",

    "password": "",

    "topics": {

    "statusGet": "stat/steckdoselicht/RESULT",

    "statusSet": "cmnd/steckdoselicht/POWER",

    "stateGet": "tele/steckdoselicht/STATE"

    },

    "onValue": "ON",

    "offValue": "OFF",

    "activityTopic": "tele/steckdoselicht/LWT",

    "activityParameter": "Online",

    "startCmd": "cmnd/steckdoselicht/TelePeriod",

    "startParameter": "60",

    "manufacturer": "ITEAD",

    "model": "Sonoff",

    "serialNumberMAC": "XX:XX:XX:XX:XX:XX"

    }


    Alles neustarten mit: reboot und es sollte gehen.