ESPEasy Basics

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
namirda
Normal user
Posts: 53
Joined: 22 Jan 2016, 17:09

ESPEasy Basics

#1 Post by namirda » 22 Jan 2016, 17:23

Hi - newby here!

I have been playing with ESPEasy/OpenHAB for the last couple of days and not getting very far. I am using ESPEasy Build 70 with Arduino IDE 1.6.5 and successfully uploaded the sketch to my 8266.

It connects to the network, connects to the MQTT broker but does not subscribe to any topics - see log output below :

INIT : Booting Build nr:70
IP : Static IP :192.168.1.71
WIFI : Connecting... 1
WIFI : Connected!
INIT : I2C
MQTT : Connected to broker
Subscribed to:
INIT : Boot OK
INIT : Normal boot
WD : Uptime 0 ConnectFailures 0 FreeMem 26128
WD : Uptime 1 ConnectFailures 0 FreeMem 26064
WD : Uptime 1 ConnectFailures 0 FreeMem 26048

1) I understood that it should subscribe to the topic /ESP8266-01/# where ESP8266-01 is the name of my device - any ideas what I might be doing wrong here?
2) How can I increase the verbosity of the log output?
3) I would like to test this properly with MQTT.fx before I move on to OpenHAB. Exactly what do I have to publish and to which topic to switch my LED on or off. In the tutorial it mentions something like "ESP8266-01/gpio/2:command:ON:1" but it's not quite clear to me.

Thanks for any help

N

kr0815
Normal user
Posts: 136
Joined: 18 Nov 2015, 18:24

Re: ESPEasy Basics

#2 Post by kr0815 » 22 Jan 2016, 19:44

As far as i understand it, the option to subscribe to a Topic is not implemented, ESPEasy only sends MQTT Messages
Try it with an Android App, you will see the Messages

To control LEDs, Relais,..., you Need to sent HTTP Commands

Martinus

Re: ESPEasy Basics

#3 Post by Martinus » 23 Jan 2016, 10:43

The ESP will both subscribe and publish to the MQTT broker service. But it looks like the MQTT templates are empty in your case.

Could you navigate to tools/advanced and check these fields, they should contain something and these should be the default settings:
mqtt_settings.png
mqtt_settings.png (5.04 KiB) Viewed 18417 times
If they are empty you can enter the data manually and submit.

kr0815
Normal user
Posts: 136
Joined: 18 Nov 2015, 18:24

Re: ESPEasy Basics

#4 Post by kr0815 » 23 Jan 2016, 11:11

If subscribing to a template, how could i use it to control a GPIO or to get some text on a lcd ?

Martinus

Re: ESPEasy Basics

#5 Post by Martinus » 23 Jan 2016, 11:37

kr0815 wrote:If subscribing to a template, how could i use it to control a GPIO or to get some text on a lcd ?
If I want to turn on the blue led on the NodeMCU V1 board with the system name "DemoESP" I publish the message "0" to:

/DemoESP/GPIO/16

This will pull GPIO-16 low and the led will start to shine...

You can also use PWM. On a NodeMCU V1 board, to let the other blue led shine just a tiny bit, publish "900" to:

/DemoESP/PWM/2

But MQTT subscribing implementation is very limited and we only implemented a quick and dirty way to control GPIO states.
Only supports GPIO on/off and PWM values.

namirda
Normal user
Posts: 53
Joined: 22 Jan 2016, 17:09

Re: ESPEasy Basics

#6 Post by namirda » 23 Jan 2016, 21:58

Martinus wrote:The ESP will both subscribe and publish to the MQTT broker service. But it looks like the MQTT templates are empty in your case.

Could you navigate to tools/advanced and check these fields, they should contain something and these should be the default settings:
mqtt_settings.png
If they are empty you can enter the data manually and submit.
Thanks Martinus - that fixed it. I wonder why the defaults were blank?

namirda
Normal user
Posts: 53
Joined: 22 Jan 2016, 17:09

Re: ESPEasy Basics

#7 Post by namirda » 24 Jan 2016, 10:30

Thanks - I'm make small progress but it is sooo frustrating!

I have finally managed to get EasyESP talking nicely to OpenHAB via mosquito and I can switch on and off the leds on the board. I can also read from EasyESP to detect whether the gpio pins are high or low. I am now trying to use the pwm commands to adjust the brightness of the leds but failing dismally. Can anybody give me example entries for my sitemap and items files which will do the job?

Another little problem is that the Android app does not refresh after a change is detected by mqtt - the events log shows that the change has been detected but the screen does not refresh. Any ideas where I should look for the problem?

Perhaps these are questions better asked on the openhab forum??

Thanks

N

namirda
Normal user
Posts: 53
Joined: 22 Jan 2016, 17:09

Re: ESPEasy Basics

#8 Post by namirda » 30 Jan 2016, 10:13

Martinus wrote:
kr0815 wrote:If subscribing to a template, how could i use it to control a GPIO or to get some text on a lcd ?
If I want to turn on the blue led on the NodeMCU V1 board with the system name "DemoESP" I publish the message "0" to:

/DemoESP/GPIO/16

This will pull GPIO-16 low and the led will start to shine...

You can also use PWM. On a NodeMCU V1 board, to let the other blue led shine just a tiny bit, publish "900" to:

/DemoESP/PWM/2

But MQTT subscribing implementation is very limited and we only implemented a quick and dirty way to control GPIO states.
Only supports GPIO on/off and PWM values.
Hi Martinus.

Is there any plan to implement MQTT support for pulse and servo output? HTTP works as per the wiki but it is very slow. Surely that must be a common requirement?

Thanks

N

cerino
New user
Posts: 1
Joined: 14 Feb 2017, 11:31

Re: ESPEasy Basics

#9 Post by cerino » 14 Feb 2017, 12:03

I have similar problem and i don't want to start other topic. I start to explain:
I have version 120 512 kb.
I correctly connect to broker and subscrive to "/esp1/#" (esp1 is system name) but i can't command the gpio.
I tried to send on topic "/esp1/gpio/12" the message "0" or "1" without any success.
Then i tried to topic "/esp1/GPIO/12", to topic "esp1/gpio/12", to topic "esp1/GPIO/12". nothing appens, seems that esp cant read broker messages... on esp log nothing appens but on mqqt server log all messages are published correctly.
I tried also to subscrive to "esp1/#" (without the initial "/") and made again all tests sending message "0" , "1", "on", "ON", "off", "OFF" to all topic mentioned above but still nothing.
I can regularly control gpio with REST sending form a browser "http://Local_ESP_IPaddress/control?cmd=GPIO,12,0" and " "http://Local_ESP_IPaddress/control?cmd=GPIO,12,1".
Can suggest me some other test to understand why it can't read MQTT message even if regularly connected and subscribed ??

luisfcosta
New user
Posts: 8
Joined: 20 May 2017, 07:23

Re: ESPEasy Basics

#10 Post by luisfcosta » 24 May 2017, 16:50

Hi Cerino

I am also experiencing the same with stable release 120. Did you find a solution to your problem?
My nodemcu does not act on broker messages - using OpenHAB MQTT solution, despite it's not stable (looses connection to the broker)
I am playing with a linknode R8 and espeasy 120
Thanks

luisfcosta
New user
Posts: 8
Joined: 20 May 2017, 07:23

Re: ESPEasy Basics

#11 Post by luisfcosta » 24 May 2017, 21:34

I think I found an answer!
Once I upgraded to 147 RC8 using the flash.cmd method, I can control my relays using mosquitto_pub -t "{devicename}/gpio/16" -m "1" [or "0"].
My MQTT broker receives the same message, so I am able to keep track of what is ON of OFF.

At least the board is able to listen to the broker! Now my next challenge is to send a more user-friendly command such as: mosquitto_pub -t "{devicename}/LivingRoomLight/switch" -m "1" [or "0"]. I just don't want to remember the pin mapping.
Any hints?
The documentation is very poor and I wouldn't mind updating it. I am sure others have the same struggle.

Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 46 guests