Hello, PC - Windows 10.
I tried do it locally and didn’t work.I got nodemcu board and I’d like to switching relays via node-red dashboard. When I want to test it out with local mqtt broker then I dont know what is the ip address of the mqtt broker: I tried on my Arduino IDE const char* mqtt_server = "127.0.0.1"; // tried "localhost" and didn't work too
Am I supposed to put there my computer ip? IPv4 address from cmd → ipconfig and in Local_mosca’s Server attribute?
I got MOSCA MQTT broker on my node-red flow and I configured it like this:
MQTT Port: 1883
MQTT WS port 8080
username and password too
//MQTT out node settings below
Server: Local_mosca // when I click to edit it I got name:Local_mosca, Server: localhost, Port: 1883
Topic: device1/relay1 // and so on relay 2,3
On my Arduino IDE: // NETWORK CONNECTION
const char* ssid = “xxxxx”;
const char* password = “xxxxxx”;
const char* mqtt_server = “127.0.0.1”; // tried “localhost” and didn’t work too
Got this error in Git Bash all the time.
[info] [mqtt-broker:Local_mosca] Connection failed to broker: mqtt://localhost:1883
my flow to import [ { "id": "5aaaa13.ece6d6", "type": "tab", "label": "Flow 1", "disabled": false, "info": "" }, { "id": "2ae6863d.4dde9a", "type": "ui_switch", "z": "5aaaa13.ece6d6", "name": "", "label": "Relay1", "tooltip": "", "group": "d7c12b74.277828", "order": 1, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "topicType": "str", "style": "", "onvalue": "1", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "animate": true, "x": 230, "y": 140, "wires": [ [ "6e4f621f.b2f1e4" ] ] }, { "id": "80ec7e53.05efd8", "type": "ui_switch", "z": "5aaaa13.ece6d6", "name": "", "label": "Relay2", "tooltip": "", "group": "d7c12b74.277828", "order": 2, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "1", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "x": 230, "y": 180, "wires": [ [ "31c609d9.aa546e" ] ] }, { "id": "2b95a165.3c9426", "type": "ui_switch", "z": "5aaaa13.ece6d6", "name": "", "label": "Relay3", "tooltip": "", "group": "d7c12b74.277828", "order": 4, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "1", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "x": 230, "y": 220, "wires": [ [ "400c763c.ec8bf" ] ] }, { "id": "528863e0.79eb54", "type": "ui_switch", "z": "5aaaa13.ece6d6", "name": "", "label": "Relay4", "tooltip": "", "group": "d7c12b74.277828", "order": 6, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "topicType": "str", "style": "", "onvalue": "1", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "animate": true, "x": 230, "y": 260, "wires": [ [ "f9f33605.5751e8" ] ] }, { "id": "6e4f621f.b2f1e4", "type": "mqtt out", "z": "5aaaa13.ece6d6", "name": "", "topic": "device1/relay1", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "c2171c49d307eaa2", "x": 440, "y": 100, "wires": [] }, { "id": "31c609d9.aa546e", "type": "mqtt out", "z": "5aaaa13.ece6d6", "name": "", "topic": "device1/relay2", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "c2171c49d307eaa2", "x": 440, "y": 160, "wires": [] }, { "id": "400c763c.ec8bf", "type": "mqtt out", "z": "5aaaa13.ece6d6", "name": "", "topic": "device1/relay3", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "c2171c49d307eaa2", "x": 440, "y": 220, "wires": [] }, { "id": "f9f33605.5751e8", "type": "mqtt out", "z": "5aaaa13.ece6d6", "name": "", "topic": "device1/relay4", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "c2171c49d307eaa2", "x": 440, "y": 280, "wires": [] }, { "id": "99ad7065ff1dd3d4", "type": "ui_switch", "z": "5aaaa13.ece6d6", "name": "", "label": "Relay5", "tooltip": "", "group": "d7c12b74.277828", "order": 8, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "topicType": "str", "style": "", "onvalue": "1", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "animate": true, "x": 220, "y": 400, "wires": [ [ "411e5124b6e9a0eb" ] ] }, { "id": "cddee8360c65a5d8", "type": "ui_switch", "z": "5aaaa13.ece6d6", "name": "", "label": "Relay6", "tooltip": "", "group": "d7c12b74.277828", "order": 3, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "topicType": "str", "style": "", "onvalue": "1", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "animate": true, "x": 220, "y": 440, "wires": [ [ "b82f275a09c2c85a" ] ] }, { "id": "788058fe20b8b4d1", "type": "ui_switch", "z": "5aaaa13.ece6d6", "name": "", "label": "Relay7", "tooltip": "", "group": "d7c12b74.277828", "order": 5, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "topicType": "str", "style": "", "onvalue": "1", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "animate": true, "x": 220, "y": 480, "wires": [ [ "d2cdace5db0a42cd" ] ] }, { "id": "a9184772581f2d91", "type": "ui_switch", "z": "5aaaa13.ece6d6", "name": "", "label": "Relay8", "tooltip": "", "group": "d7c12b74.277828", "order": 7, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "topicType": "str", "style": "", "onvalue": "1", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "animate": true, "x": 220, "y": 520, "wires": [ [ "ec0d86e688fd3536" ] ] }, { "id": "411e5124b6e9a0eb", "type": "mqtt out", "z": "5aaaa13.ece6d6", "name": "", "topic": "device1/relay5", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "c2171c49d307eaa2", "x": 430, "y": 360, "wires": [] }, { "id": "b82f275a09c2c85a", "type": "mqtt out", "z": "5aaaa13.ece6d6", "name": "", "topic": "device1/relay6", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "c2171c49d307eaa2", "x": 430, "y": 420, "wires": [] }, { "id": "d2cdace5db0a42cd", "type": "mqtt out", "z": "5aaaa13.ece6d6", "name": "", "topic": "device1/relay7", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "c2171c49d307eaa2", "x": 430, "y": 480, "wires": [] }, { "id": "ec0d86e688fd3536", "type": "mqtt out", "z": "5aaaa13.ece6d6", "name": "", "topic": "device1/relay8", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "c2171c49d307eaa2", "x": 430, "y": 540, "wires": [] }, { "id": "f59f79b79b593285", "type": "mosca in", "z": "5aaaa13.ece6d6", "mqtt_port": 1883, "mqtt_ws_port": 8080, "name": "", "username": "", "password": "", "dburl": "", "x": 280, "y": 780, "wires": [ [] ] }, { "id": "d7c12b74.277828", "type": "ui_group", "name": "Controls", "tab": "f57a184e.4f4fa", "order": 1, "disp": true, "width": "6", "collapse": false }, { "id": "c2171c49d307eaa2", "type": "mqtt-broker", "name": "Local_mosca", "broker": "localhost", "port": "1883", "clientid": "", "usetls": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willPayload": "", "willMsg": {}, "sessionExpiry": "" }, { "id": "f57a184e.4f4fa", "type": "ui_tab", "name": "ESP32", "icon": "dashboard", "disabled": false, "hidden": false } ]