Sonoff T1 2 Kanal in Homebridge einbinden

  • 1522678750: mosquitto version 1.4.10 (build date Fri, 22 Dec 2017 08:19:25 +0000) starting
    1522678750: Using default config.
    1522678750: Opening ipv4 listen socket on port 1883.
    1522678750: Error: Address already in use

  • ? mosquitto.service - Mosquitto MQTT Broker daemon

    Loaded: loaded (/etc/systemd/system/mosquitto.service; enabled; vendor preset: enabled)

    Active: activating (auto-restart) (Result: exit-code) since Mon 2018-04-02 16:35:47 CEST; 1s ago

    Process: 6721 ExecStart=/usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf -d (code=exited, status=203/EXEC)


    Apr 02 16:35:47 raspberrypi systemd[1]: Starting Mosquitto MQTT Broker daemon...

    Apr 02 16:35:47 raspberrypi systemd[1]: mosquitto.service: Control process exited, code=exited status=203

    Apr 02 16:35:47 raspberrypi systemd[1]: Failed to start Mosquitto MQTT Broker daemon.

    Apr 02 16:35:47 raspberrypi systemd[1]: mosquitto.service: Unit entered failed state.

    Apr 02 16:35:47 raspberrypi systemd[1]: mosquitto.service: Failed with result 'exit-code'.

  • 1522690327: mosquitto version 1.4.14 (build date Mon, 10 Jul 2017 23:48:43 +0100 ) starting

    1522690327: Using default config.

    1522690327: Opening ipv4 listen socket on port 1883.

    1522690327: Error: Address already in use

  • 1522692195: mosquitto version 1.4.14 (build date Mon, 10 Jul 2017 23:48:43 +0100 ) starting

    1522692195: Using default config.

    1522692195: Opening ipv4 listen socket on port 1883.

    1522692195: Opening ipv6 listen socket on port 1883.

    1522692196: New connection from 192.168.178.00 on port 1883.

    1522692196: New client connected from 192.168.178.00 as mqttjs_c37ee2c5 (c1, k10 ).

    1522692200: New connection from 192.168.178.01 on port 1883.

    1522692200: New client connected from 192.168.178.01 as Steckdose/Licht (c1, k15, u'DVES_USER').

  • [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

  • /usr/sbin/mosquitto


    # 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

  • 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.

  • 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.

  • 1522697688: mosquitto version 1.4.14 (build date Mon, 10 Jul 2017 23:48:43 +0100 ) starting

    1522697688: Using default config.

    1522697688: Opening ipv4 listen socket on port 1883.

    1522697688: Opening ipv6 listen socket on port 1883.

    1522697693: New connection from 192.168.178.37 on port 1883.

    1522697693: New client connected from 192.168.178.37 as steckdoselicht (c1, k15, u'DVES_USER').