• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
working MQTT in version v8.1.5-nightly-1af4c284
#1
Lightbulb 
I have had the current nightly installed since yesterday and in the beginning I had a hard time in mqtt, but it works and it works wonderfully!

I thought for all those who have a hard time at the beginning and want to get an insight into how it can work
I make my config available in a slimmed-down version

I use an Amazon Echo dot with node-red skill as an extension to the mqtt.

(node-red: on the surface of node-red are emulated Wemo sockets which send an MQTT topic / message in order to switch pilight "parallel" itself


Quote:
Code:
{
    "devices": {
        "lightswitch": {
            "protocol": [ "generic_switch" ],
            "id": [{
                "id": 1
            }],
            "state": "on"
        },
        "Kaffeemaschine": {
            "protocol": [ "pollin" ],
            "id": [{
                "systemcode": 9,
                "unitcode": 1
            }],
            "state": "off"
        },
        "Serverstrom": {
            "protocol": [ "pollin" ],
            "id": [{
                "systemcode": 9,
                "unitcode": 8
            }],
            "state": "off"
        },
        "Vitrine": {
            "protocol": [ "pollin" ],
            "id": [{
                "systemcode": 25,
                "unitcode": 1
            }],
            "state": "off"
        },
        "Wohnwand": {
            "protocol": [ "pollin" ],
            "id": [{
                "systemcode": 25,
                "unitcode": 8
            }],
            "state": "off"
        },
        "Anlage": {
            "protocol": [ "promax" ],
            "id": [{
                "systemcode": 1,
                "programcode": 2
            }],
            "state": "off"
        },
        "Leselampe": {
            "protocol": [ "kaku_dimmer" ],
            "id": [{
                "id": 30,
                "unit": 0
            }],
            "state": "off",
            "dimlevel": 6
        },
        "Esstisch": {
            "protocol": [ "kaku_dimmer" ],
            "id": [{
                "id": 31,
                "unit": 6
            }],
            "state": "off",
            "dimlevel": 6
        },
        "outside": {
            "protocol": [ "sunriseset" ],
            "id": [{
                "longitude": 7.038100,
                "latitude": 51.475740
            }],
            "sunrise": 7.00,
            "sunset": 16.15,
            "sun": "set"
        },
        "time": {
            "protocol": [ "datetime" ],
            "id": [{
                "longitude": 7.038100,
                "latitude": 51.475740
            }],
            "year": 2018,
            "month": 2,
            "day": 11,
            "hour": 17,
            "minute": 50,
            "second": 40,
            "weekday": 0,
            "dst": 0
        
        
        }
    },
    "rules": {
        "sunsetON": {
            "rule": "IF DATE_FORMAT(time, %H%M%S) == 191500 OR (outside.sunset == DATE_FORMAT(time, %H.%M)) THEN switch DEVICE lightswitch TO on",
            "active": 1
        },
        "light-Weekday-off": {
            "rule": "IF lichtAUTO.state == on AND Anlage.state == off AND Esstisch.state == off AND DATE_FORMAT(time, %H%M%S) >= 220000 AND time.second == 0 THEN switch DEVICE lightswitch TO off",
            "active": 1
        },
        "switch-light": {
            "rule": "IF lightswitch.state == on THEN switch DEVICE Wohnwand AND Leselampe AND Vitrine To on ELSE switch DEVICE Leselampe AND Vitrine AND Kaffeemaschine TO off",
            "active": 1
        }},
        
    "gui": {
        "lightswitch": {
            "name": " Light switch",
            "group": [ "Daten" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "Serverstrom": {
            "name": "Server Media - Netzwerk",
            "group": [ "Daten" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "outside": {
            "name": "Sonnenaufgang / Sonnenuntergang",
            "group": [ "Daten" ],
            "media": [ "all" ]
        },
        "time": {
            "name": "Zeit",
            "format": "e/dd - DD.MM.YY HH:mm:ss",
            "group": [ "Daten" ],
            "media": [ "all" ]
        },
        "Vitrine": {
            "name": "Lego Vitrine",
            "group": [ "Flur " ],
            "media": [ "all" ],
            "readonly": 0
        },
        "Kaffeemaschine": {
            "name": "Kaffeemaschine",
            "group": [ "Küche " ],
            "media": [ "all" ],
            "readonly": 0
        },
        "Anlage": {
            "name": "Steckdose Anlage",
            "group": [ "Musik " ],
            "media": [ "all" ],
            "readonly": 0
        },
        "Esstisch": {
            "name": "Esstisch",
            "group": [ "Wohnzimmer" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "Leselampe": {
            "name": " Leselampe",
            "group": [ "wohnzimmer" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "Wohnwand": {
            "name": " Wohnwand",
            "group": [ "wohnzimmer" ],
            "media": [ "all" ],
            "readonly": 0
        }
    },
    "settings": {
        "log-level": 6,
        "pid-file": "/var/run/pilight.pid",
        "log-file": "/var/log/pilight.log",
        "webserver-enable": 1,
        "webserver-root": "/usr/local/share/pilight/webgui",
        "webserver-http-port": 5001,
        "webserver-cache": 1,
        "whitelist": "",
        "gpio-platform": "raspberrypi3"
    },
    "hardware": {
        "433gpio": {
            "sender": 0,
            "receiver": 1}
    },
    "registry": {
        "webserver": {
            "ssl": {
                "certificate": {
                    "location": "/etc/pilight/pilight.pem"
                }
            }
        },
        "pilight": {
            "version": {
                "current": "8.1.5"
            }
        },
        "hardware": {
            "RF433": {
                "mingaplen": 4420,
                "maxgaplen": 72900,
                "minrawlen": 26,
                "maxrawlen": 400
            }
        },
        "webgui": {
            "tabs": 1
        }
    }
}
Now for the syntax that node-red must send.

Quote:Node-red:     pilight/device/Wohnwand/state on

Quote:mosquitto:     mosquitto_pub -h 127.0.0.1 -t pilight/device/Wohnwand/state -m "on"

You could also send the whole thing to test via mosquitto or similar mqtt broker to test whether it works
if you now build appropriate links in node-red

Quote:[wemo module] ----- [MQTT OUT]


it is possible to load this into the device list via the Alexa app and then control it

"alexa, switch wohnwand to on"

there it is, a working crossover from "alexa" -> "node-red" -> MQTT in pilight
 
Reply
#2
(10-20-2020, 06:44 PM)Thank you for posting, confirmed that mqtt should work without any mqtt parameters in the config.json file. I got it setup, but publish back to pilight does not work with my setup. Wrote:
Code:
{
    "devices": {
        "tafel": {
            "protocol": [ "kaku_dimmer" ],
            "id": [{
                "id": 13578730,
                "unit": 10
            }],
            "state": "on",
            "dimlevel": 6
        },
        "kerst2": {
            "protocol": [ "kaku_switch_old" ],
            "id": [{
                "unit": 0,
                "id": 2
            }],
            "state": "off"
        }
    },
    "rules": {},
    "gui": {
        "tafel": {
            "name": "Tafel",
            "group": [ "woonkamer" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "kerst2": {
            "name": "Kerst verlichting buiten",
            "group": [ "woonkamer" ],
            "media": [ "all" ],
            "readonly": 0
        }
    },
    "settings": {
        "log-level": 6,
        "pid-file": "/var/run/pilight.pid",
        "log-file": "/var/log/pilight.log",
        "standalone": 1,
        "webserver-enable": 1,
        "webserver-root": "/usr/local/share/pilight/webgui",
        "port": 5000,
        "webserver-http-port": 5001,
        "webserver-https-port": 5002,
        "webserver-cache": 1,
        "whitelist": "",
        "gpio-platform": "none"
    },
    "hardware": {},
    "registry": {
        "webserver": {
            "ssl": {
                "certificate": {
                    "location": "/etc/pilight/pilight.pem",
                    "secure": 0
                }
            }
        },
        "pilight": {
            "version": {
                "current": "8.1.5"
            }
        },
        "hardware": {
            "RF433": {
                "mingaplen": 4420,
                "maxgaplen": 72900,
                "minrawlen": 26,
                "maxrawlen": 400
            }
        }
    }
}

I am running [color=rgba(0, 0, 0, 0.87)]version[/color][color=rgba(0, 0, 0, 0.87)] = v8.1.5-nightly-f5e75073.on rpi, pilight hardware is connected from remote pilight on windows.

[/color]

Code:
C:\pilight>pilight-daemon -S 192.168.1.54 -P 5000

When changing the status in the webgui on the rpi, the switch goes on and off.
The following command does update in mqtt, does not update webgui or switch.


Code:
mosquitto_pub -h 127.0.0.1 -t pilight/device/kerst2/state -m "off"

any tips are welcome, i would really like to get this working, since openhab3 the pilight plugin is not working any more, connecting through mqtt is next best thing.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  problem publish to pilight MQTT server Emiks5 9 1,819 09-12-2021, 07:27 AM
Last Post: DesmondOrask
  Nightly versions less than 8.1.5-59 missing? felfert 6 1,162 08-27-2021, 09:38 AM
Last Post: juliaa
  ping not working, am I missing something? steffeneilers 2 355 02-03-2021, 08:09 PM
Last Post: steffeneilers
  pilight-flash not working danny 14 3,608 12-12-2020, 10:00 AM
Last Post: tox
  Received state not updated in webgui, but working in illumina tobid 2 431 11-08-2020, 09:45 PM
Last Post: tobid
  MQTT external Broker (not local) configuration nicky 3 929 06-02-2020, 05:00 PM
Last Post: curlymo
  stable/nightly Release is no longer signed DSLeX 1 1,158 05-14-2020, 01:09 PM
Last Post: peteratoce
  MQTT cannot be disabled on nightly image ayeyebrazov 5 1,151 05-01-2020, 03:11 PM
Last Post: ayeyebrazov
  After upgrading 7.0 to 8.1.5 my flamingo SF-501P switches stopped working. gerrit312 23 5,345 04-30-2020, 02:58 PM
Last Post: ayeyebrazov
  tfa30 temperature-offset not working wseifert 2 1,286 04-09-2020, 02:46 PM
Last Post: curlymo

Forum Jump:


Browsing: 1 Guest(s)