• 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
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Received state not updated in webgui, but working in illumina tobid 2 100 11-08-2020, 09:45 PM
Last Post: tobid
  problem publish to pilight MQTT server Emiks5 4 691 08-31-2020, 07:45 PM
Last Post: Emiks5
  Nightly versions less than 8.1.5-59 missing? felfert 4 393 07-28-2020, 07:50 PM
Last Post: felfert
  MQTT external Broker (not local) configuration nicky 3 447 06-02-2020, 05:00 PM
Last Post: curlymo
  stable/nightly Release is no longer signed DSLeX 1 692 05-14-2020, 01:09 PM
Last Post: peteratoce
  MQTT cannot be disabled on nightly image ayeyebrazov 5 642 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 3,453 04-30-2020, 02:58 PM
Last Post: ayeyebrazov
  tfa30 temperature-offset not working wseifert 2 969 04-09-2020, 02:46 PM
Last Post: curlymo
  MQTT subscribe to a weather station? peteratoce 5 658 04-08-2020, 07:17 AM
Last Post: curlymo
  pilight 8.1.5 not working on Raspberry pi after reboot beejayf 4 1,447 03-08-2020, 12:14 AM
Last Post: beejayf

Forum Jump:


Browsing: 1 Guest(s)