Hi
I have a nodemcu esp12n flashed with build 120 of espeasy.
It is connected to my wifi and is connecting to my mqtt broker (i use hassio).
I'm not sure if the device is functioning correctly...
I have been unable to figure out the default mqtt topics, as every guide I read has different mqtt topics for commands etc and I have tried them all and I don't know where my problem lies.
I've been using mqtt dash to test by subscribing and publishing to topics but I can't see any activity and the commands don't work.
I have the following relevant settings:
Config -> Main Settings -> Name: esp01
Config -> Main Settings -> Protocol: OpenHAB MQTT
Advanced Settings -> Subscribe template: /%sysname%/#
Advanced Settings -> Publish template: /%sysname%/%tskname%/%valname%
Hardware Settings -> Pin mode 16: Default
And under devices:
Device -> Task 1
Device: switch input
Name: led
IDX / Var: 250
1st GPIO: GPIO-16
Pull up: Yes
Inversed: No
Switch type: Switch
Switch button type: Normal Switch
Send boot state: No
Send data: Yes
Optional Settings -> Value Name 1: switch
Should the above config publish a value to my broker if i short GND - D0 (GPIO-16)?
What topic should it publish to?
Also: I don't know of any android mqtt clients that can subscribe to */*/* that would be more useful for testing.
Thanks
Kiwi
Help a noob , basic MQTT & switch setup (SOLVED)
Moderators: grovkillen, Stuntteam, TD-er
-
- New user
- Posts: 6
- Joined: 14 Jun 2018, 01:26
Help a noob , basic MQTT & switch setup (SOLVED)
Last edited by kiwijunglist on 14 Jun 2018, 04:13, edited 2 times in total.
-
- New user
- Posts: 6
- Joined: 14 Jun 2018, 01:26
Re: Help a noob , basic MQTT & switch setup
I found an answer to my question: MQTT-Spy (Java App) can subscribe and spy on all topics.
When I short GPIO 16 to GND I get
- Topic: esp01/led/switch
- Content: 1
and when it's unshorted I get
- Topic: esp01/led/switch
- Content: 0
When I short GPIO 16 to GND I get
- Topic: esp01/led/switch
- Content: 1
and when it's unshorted I get
- Topic: esp01/led/switch
- Content: 0
-
- New user
- Posts: 6
- Joined: 14 Jun 2018, 01:26
Re: Help a noob , basic MQTT & switch setup
If I want to connect an LED to the nodemcu do I wire it up like follows:
GPIO16 -> Resister -> LED -> GND
What are the correct settings?:
Config -> Main Settings -> Name: esp01
Advanced Settings -> Subscribe template: /%sysname%/#
Advanced Settings -> Publish template: /%sysname%/%tskname%/%valname%
Hardware Settings -> Pin mode 16: ?? Output Low ??
And under devices:
Device -> Task 1
Device: switch input
Name: led
IDX / Var: 250
1st GPIO: GPIO-16
Pull up: No
Inversed: No
Switch type: Switch
Switch button type: Normal Switch
Send boot state: No
Send data: Yes
Optional Settings -> Value Name 1: switch
If so what is the mqtt topic and content for controlling the LED?
I tried topic: "esp01/cmd" & content: "gpio,16,1" but it didn't work.
GPIO16 -> Resister -> LED -> GND
What are the correct settings?:
Config -> Main Settings -> Name: esp01
Advanced Settings -> Subscribe template: /%sysname%/#
Advanced Settings -> Publish template: /%sysname%/%tskname%/%valname%
Hardware Settings -> Pin mode 16: ?? Output Low ??
And under devices:
Device -> Task 1
Device: switch input
Name: led
IDX / Var: 250
1st GPIO: GPIO-16
Pull up: No
Inversed: No
Switch type: Switch
Switch button type: Normal Switch
Send boot state: No
Send data: Yes
Optional Settings -> Value Name 1: switch
If so what is the mqtt topic and content for controlling the LED?
I tried topic: "esp01/cmd" & content: "gpio,16,1" but it didn't work.
-
- New user
- Posts: 6
- Joined: 14 Jun 2018, 01:26
Re: Help a noob , basic MQTT & switch setup
http://192.168.178.100/control?cmd=GPIO,16,1
http://192.168.178.100/control?cmd=GPIO,16,0
{
"log": "GPIO 16 Set to 1",
"plugin": 1,
"pin": 16,
"mode": "output",
"state": 1
}
Is working to control the LED, but I can't get the MQTT to control it.
Protocol: OpenHAB MQTT
Device: esp01
Subscribe template: /%sysname%/#
Publish template: /%sysname%/%tskname%/%valname%
Device: switch input
Name: led
IDX/Var: 250
Value name: switch
Have tried [topic -> command]
esp01/cmd -> gpio,16,1
esp01/cmd -> 1
esp01 -> gpio,16,1
esp01/cmd/led/switch -> 1
esp01/led/switch -> 1
esp01/cmd/led/switch -> gpio,16,1
esp01/led/switch -> gpio,16,1
Unfortunately there is no documentation that I can find that correctly states mqtt commands for openhab mqtt protocol.
http://192.168.178.100/control?cmd=GPIO,16,0
{
"log": "GPIO 16 Set to 1",
"plugin": 1,
"pin": 16,
"mode": "output",
"state": 1
}
Is working to control the LED, but I can't get the MQTT to control it.
Protocol: OpenHAB MQTT
Device: esp01
Subscribe template: /%sysname%/#
Publish template: /%sysname%/%tskname%/%valname%
Device: switch input
Name: led
IDX/Var: 250
Value name: switch
Have tried [topic -> command]
esp01/cmd -> gpio,16,1
esp01/cmd -> 1
esp01 -> gpio,16,1
esp01/cmd/led/switch -> 1
esp01/led/switch -> 1
esp01/cmd/led/switch -> gpio,16,1
esp01/led/switch -> gpio,16,1
Unfortunately there is no documentation that I can find that correctly states mqtt commands for openhab mqtt protocol.
-
- New user
- Posts: 6
- Joined: 14 Jun 2018, 01:26
Re: Help a noob , basic MQTT & switch setup
Solved:
Topic is "/esp01/gpio/16"
Not "esp01/gpio/16"
Notice the extra / at the start.
Topic is "/esp01/gpio/16"
Not "esp01/gpio/16"
Notice the extra / at the start.
Who is online
Users browsing this forum: No registered users and 30 guests