MQTT Import

Moderators: grovkillen, Stuntteam, TD-er

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

MQTT Import

#1 Post by namirda » 01 Apr 2016, 21:20

I have noticed several people recently asking for a means to display data from remote sensors. The official globalsync option is the official response to this demand and is a fully fledged and very flexible custom messaging service between ESPEASY units.

For those who are already using MQTT I would like to offer a simpler alternative which I have called 'MQTT Import' This is a plugin which subscribes to specific MQTT messages published by remote ESPEasy Units and imports them to the local unit making them available for display or use in your rules. It is not required to have ‘MQTT Import’ available on the remote units – only the local unit to which import is required.

The plugin ‘MQTT Import’ can be downloaded from the ESPEasy Plugin Playground

https://github.com/ESP8266nu/ESPEasyPluginPlayground

If you would like to try it, download the two files _P210_MQTTImport.ino and Extra_Utilities.ino from the Playground. Add both files to your project folder and recompile/upload.

Insert ‘MQTT Import’ into your sketch using the webserver in the normal way.

‘MQTT Import’ can subscribe to up to four MQTT topics which are published by other ESP units. The settings show below illustrate how you could import three different sensor readings from unit ESP05

Image


The topics supplied as the MQTT Topics should be the same as the topics published by the remote ESP – this should normally be something like /%sysname%/%taskname%/%valuename%

If you wish to import more than 4 items, you can call ‘MQTT Import’ more than once and give different names to the two instances – for example Import1 and Import2.

Using the above example, it should now be possible to display the temperature from unit ESP05 or using it in your Rules by referring to it using the standard syntax [Import#Temperature] where ‘Import’ is the name you have given to the ‘MQTT Import’ instance and ‘Temperature’ is the corresponding value name.

In this way, it is possible to import remote sensor values into your local ESP using the services of your MQTT broker.

I have been using this for a couple of months now and it works well for me. Please give it a try and let me know if you have problems.

N

fluppie
Normal user
Posts: 79
Joined: 09 Oct 2015, 13:23

Re: MQTT Import

#2 Post by fluppie » 01 Apr 2016, 22:19

Very cool, now it's easy easy to build a "MQTT display" regardless the source 8-) 8-) 8-)

Code: Select all

Arduino: 1.6.8 (Windows 8.1), Board:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, Serial, 115200, 4M (3M SPIFFS)"

C:\Users\Philippe\Documents\Arduino\ESP Easy\ESPEasyR95_MQTTimport\_P210_MQTTImport.ino: In function 'boolean Plugin_210(byte, EventStruct*, String&)':

_P210_MQTTImport:163: error: 'PLUGIN_COMMAND' was not declared in this scope

     case PLUGIN_COMMAND:

          ^

exit status 1
'PLUGIN_COMMAND' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Any idea why this isn't compiling, I fetched the files from the plugin playground. I first tried to compile R95 with 1.6.8 and 2.1.0, this succeeds. But when adding the files from the plugin playground I get the error above.

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

Re: MQTT Import

#3 Post by namirda » 01 Apr 2016, 22:53

So sorry. I use a very customized version of ESPEasy and some inconsistencies creep in!

I have uploaded a new version of _P210_MQTTImport.ino to Github and it should be OK now.

N

msev
Normal user
Posts: 33
Joined: 13 Feb 2016, 18:24

Re: MQTT Import

#4 Post by msev » 02 Apr 2016, 09:46

Very cool! So would it be possible to display 8 things on an lcd (maybe on two pages) 20x4?

Namrida any chance you could upload the compiled bins (maybe with this mod for 8 things displayed) with this plugin somewhere. Would really appreciate it.

fluppie
Normal user
Posts: 79
Joined: 09 Oct 2015, 13:23

Re: MQTT Import

#5 Post by fluppie » 02 Apr 2016, 15:28

I have this plugin working :-). Tonight or tomorrow I'll check out the larger font / scrolling pages version :)

msev
Normal user
Posts: 33
Joined: 13 Feb 2016, 18:24

Re: MQTT Import

#6 Post by msev » 04 Apr 2016, 15:27

Ok so I will compile my own, so R95 and esp 2.1 right in Arduino IDE 1.6.8, is this cool? :D

So if I want 8 MQTT value topics how to do it, can you explain a bit more in detail namrida, can I pm you?

Also how then to display more than 8 topics on the 20x4 i2c lcd, like that its scrolling two pages. Is it currently just possible on the oled with your other plugin?

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

Re: MQTT Import

#7 Post by namirda » 04 Apr 2016, 22:08

Yes - better you compile on your own - it's good to learn! I am using R93, Core2.1 and Arduino 1.6.5 - I haven't yet tried 1.6.8.

If you want to import 8 MQTT topics, you will have to call my 'MQTT Import' plugin twice - and give each instance a different name such as Import1 and Import2. You can then refer to the imported values as [Import1#Value1], [Import2#Value2] etc.

The scrolling display plugin is only for the SSD1306 OLED

N

msev
Normal user
Posts: 33
Joined: 13 Feb 2016, 18:24

Re: MQTT Import

#8 Post by msev » 05 Apr 2016, 07:27

It was already in the description in the first post that "you will have to call my 'MQTT Import' plugin twice - and give each instance a different name such as Import1 and Import2".

But I don't know where in the code I have to do it. Can you post an example code please. Since I don't know how to do it.

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

Re: MQTT Import

#9 Post by namirda » 05 Apr 2016, 10:52

Hi msev

I think you need to do a bit more reading about ESP Easy! It is not difficult and the wiki is quite good.

You need to use your browser to view the webserver from your ESP you will see something like this:

Image

Add a new task and select "MQTT Import" from the drop down combobox. Complete the other parameters as described in my earlier post. If you need more than 4 imported items then add a second task in the same manner.

That's all there is to it!

Good Luck

N

TridentTD
Normal user
Posts: 5
Joined: 07 Apr 2016, 16:42

Re: MQTT Import

#10 Post by TridentTD » 07 Apr 2016, 16:55

I have just tried "MQTT Import" , it's excellent plugin .

However I found one problem
when MQTT connection fail like this ,

-------------------
CON : MQTT 210 Connection lost
CON : Import MQTT Failed to connect to broker
CON : Import MQTT Failed to connect to broker
WD : Uptime 7 ConnectFailures 26 FreeMem 27152
MQTT : Connection lost
MQTT : Failed to connected to broker
MQTT : Failed to connected to broker
CON : MQTT 210 Connection lost
CON : Import MQTT Failed to connect to broker
CON : Import MQTT Failed to connect to broker
WD : Uptime 7 ConnectFailures 28 FreeMem 27136
MQTT : Connection lost
MQTT : Failed to connected to broker
MQTT : Failed to connected to broker

------------------

After this , I can't connect to Webserver of ESPEasy for editing the config again.

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

Re: MQTT Import

#11 Post by namirda » 07 Apr 2016, 21:57

The 'MQTT Import' plugin creates its own MQTT client which is different from the one used by the ESPEasy framework. The log messages prefixed by 'MQTT'' are coming from the ESPEasy framework and those prefixed by 'CON' are coming from "MQTT Import".

Therefore both clients have trouble connecting to the broker - it is not only an 'MQTT Import' problem. Is your MQTT broker running OK?

Does your sketch run for some time before the MQTT connections fail - or does it never work?

Drum
Normal user
Posts: 265
Joined: 07 Feb 2016, 11:56

Re: MQTT Import

#12 Post by Drum » 08 Apr 2016, 09:26

Is there any way to use this to do something like turn off deep sleep? Ideally also maybe to trigger a .bin upload from a predefined location to update the firmware.

I expect there are other settings or commands that would be nice to trigger via MQTT as well.

Thanks,
Drum

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

Re: MQTT Import

#13 Post by namirda » 09 Apr 2016, 23:42

No you can't use 'MQTT Import' directly for this.

However, I think you might be able to use the code which I proposed as a solution to another problem in this post http://www.esp8266.nu/forum/viewtopic.p ... 5797#p5797.

Using that code you can give system commands via MQTT which I think is what you are looking for. If you send an MQTT message with the topic /ESP01/System ( change ESP01 to your device name) with payload 'NoSleep' and with the retain flag set, then when your module wakes up from its sleep, it will receive the retained message and should not go back to sleep. I think that is what you had in mind.

I have not tested this but I think it should work. Please le me know how you get on with it.

N

msev
Normal user
Posts: 33
Joined: 13 Feb 2016, 18:24

Re: MQTT Import

#14 Post by msev » 10 Apr 2016, 10:26

Aaaa now I understand namrida, thanks for explaining. I have already two esp's setup with 3 sensors each so I am aware of the tasks, but I didn't think of the immediately when I read the description :D.

This is great, this and the oled with big letters and problem solved :D.

Any chance you would also make a plugin for 20x4 lcd? :D

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

Re: MQTT Import

#15 Post by namirda » 11 Apr 2016, 08:23

I have just uploaded a new version of MQTT Import with a few bugs removed.

If you want to try it, then please download _P210_MQTTImport.ino and also the newest version of Extra_Utilities.ino.

TridentTD
Normal user
Posts: 5
Joined: 07 Apr 2016, 16:42

Re: MQTT Import

#16 Post by TridentTD » 11 Apr 2016, 12:17

I wish "MQTT Import" the next release , has to inform EVENT message too (for using in RULES control )
I have tried to edit Extra_Utilities from the line 172 like this.

#sorry for my english.
#Thank you.

Code: Select all

void logUpdates(byte ModNum,byte TaskNum, byte ValueNum, float NewValue)
{
        LoadTaskSettings(TaskNum);

        String log=F("");
        log+=ModNum;
        log += "  : [";
        log+=ExtraTaskSettings.TaskDeviceName;
        log+="#";
        log += ExtraTaskSettings.TaskDeviceValueNames[ValueNum];
        log += "] set to ";
        log += NewValue;
        addLog(LOG_LEVEL_INFO,log);

        if( String(ExtraTaskSettings.TaskDeviceName) != ""&& String(ExtraTaskSettings.TaskDeviceValueNames[ValueNum]) != "") {
          String event = F("");
          event += ExtraTaskSettings.TaskDeviceName;
          event +="#";
          event += ExtraTaskSettings.TaskDeviceValueNames[ValueNum];
          rulesProcessing(event);
        }
}
24.png
24.png (70.75 KiB) Viewed 7280 times
Last edited by TridentTD on 12 Apr 2016, 03:35, edited 3 times in total.

Drum
Normal user
Posts: 265
Joined: 07 Feb 2016, 11:56

Re: MQTT Import

#17 Post by Drum » 11 Apr 2016, 12:22

namirda wrote:No you can't use 'MQTT Import' directly for this.

However, I think you might be able to use the code which I proposed as a solution to another problem in this post http://www.esp8266.nu/forum/viewtopic.p ... 5797#p5797.

Using that code you can give system commands via MQTT which I think is what you are looking for. If you send an MQTT message with the topic /ESP01/System ( change ESP01 to your device name) with payload 'NoSleep' and with the retain flag set, then when your module wakes up from its sleep, it will receive the retained message and should not go back to sleep. I think that is what you had in mind.

I have not tested this but I think it should work. Please le me know how you get on with it.

N
Thanks I will take a look and see what I can do with this. It may take a while to get there, but I am moving in that direction.

TridentTD
Normal user
Posts: 5
Joined: 07 Apr 2016, 16:42

Re: MQTT Import

#18 Post by TridentTD » 11 Apr 2016, 12:58

Problem Report:

After config "MQTT Import" , it's ok to run.
But when I reboot ESPEasy. It's lost the taskname and valuename like this..
2.png
2.png (49.11 KiB) Viewed 7306 times

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

Re: MQTT Import

#19 Post by namirda » 11 Apr 2016, 23:55

There have been some changes to the webserver in ESPEasy R99 which hopefully should fix this problem.

Please try ESPEasy R99 along with V0.3 of MQTT Import from the playground.

@TridentTD - your proposal for passing imported values to Rules has been included.

N
Last edited by namirda on 12 Apr 2016, 04:11, edited 1 time in total.

TridentTD
Normal user
Posts: 5
Joined: 07 Apr 2016, 16:42

Re: MQTT Import

#20 Post by TridentTD » 12 Apr 2016, 03:38

namirda wrote:There have been some changes to the webserver in ESPEasy R99 which hopefully should fix this problem.

Please try ESPEasy R99 along with V0.3 of MQTT Import from the playground.

N
ESPEasy R99 + MQTT Import v0.3 ... ok now.

Thank you,

tozett
Normal user
Posts: 733
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MQTT Import

#21 Post by tozett » 22 Apr 2016, 15:09

i am on r103 and copied the plugin.ino into the easyesp source-dir.
when i compile/upload, i got this error. how to resolve? thankx
Attachments
Zwischenablage01.png
Zwischenablage01.png (42.94 KiB) Viewed 9480 times

tozett
Normal user
Posts: 733
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MQTT Import

#22 Post by tozett » 22 Apr 2016, 16:15

I didn read the thread until this error, only playground site.
Sobi missed the info from Post 1,
to have extra_utils..ino tooo.
I will try again with this...

tozett
Normal user
Posts: 733
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MQTT Import

#23 Post by tozett » 22 Apr 2016, 17:11

more luck: i could upload, had only this waringn:

Code: Select all

C:\Users\olaf\AppData\Local\Temp\build3173830164676676500.tmp\ESPEasy.cpp -o C:\Users\olaf\AppData\Local\Temp\build3173830164676676500.tmp\ESPEasy.cpp.o 
_P210_MQTTImport.ino: In function 'boolean Plugin_210(byte, EventStruct*, String&)':
_P210_MQTTImport.ino:22:24: warning: case label value exceeds maximum value for type [enabled by default]
_P210_MQTTImport.ino:169:10: note: in expansion of macro 'PLUGIN_COMMAND'
Verwende die zuvor kompilierte Datei: C:\Users\olaf\AppData\Local\Temp\build3173830164676676500.tmp\ESP8266WiFi\ESP8266WiFi.cpp.o
Verwende die zuvor kompilierte Datei: C:\Users\olaf\AppData\Local\Temp\build3173830164676676500.tmp\ESP8266WiFi\ESP8266WiFiAP.cpp.o

Deennoo
Normal user
Posts: 158
Joined: 07 Sep 2015, 13:03

Re: MQTT Import

#24 Post by Deennoo » 29 Apr 2016, 23:24

Thx for this plugin.

Does it can be use to "import" information from Domoticz ? who already got a mqtt connection.

Exemple

on an Oled Screen + Wemos + ESPEasy, i want to print a temp from an oregon sensor who is link to my domoticz with RFLink.

Allycat1972
Normal user
Posts: 25
Joined: 19 Apr 2016, 11:12

Re: MQTT Import

#25 Post by Allycat1972 » 19 May 2016, 13:41

Hi.

Is there a way to subscribe to topics on the MQTT broker as set in the config area of ESPEasy?

I want to display a temperature 'Setpoint' as defined in OpenHAB (published to Mosquitto) on an OLED screen attached to my ESP8266.

Is it simply a matter of adding the broker to the subscribe topic ? i.e. /broker/topic/value?

Scenario: -
I publish a temperature to an MQTT topic on my MQTT Broker (FishPI) called - /FishHAB5/Setpoint/Temp

Would I enter - '/FishPI/FishHAB5/Setpoint/Temp' in the MQTT Topic 1 to retrieve the value?

Many thanks.

dduley
Normal user
Posts: 93
Joined: 06 Feb 2016, 17:56

Re: MQTT Import

#26 Post by dduley » 24 May 2016, 06:38

Hi,

I tried to use the MQTT import plugin tonight. I compiled it into R107. It all seemed fine until I setup a task for MQTT Import. As soon as I pressed submit I got a stack dump and a reset. The ESP would boot up and then immediately do another stack dump and reset. Is MQTT Import not compatible with R107? I am loading it into an NodeMCU ESP-12E module.

Regards

Dave

Allycat1972
Normal user
Posts: 25
Joined: 19 Apr 2016, 11:12

Re: MQTT Import

#27 Post by Allycat1972 » 24 May 2016, 09:20

Allycat1972 wrote:Hi.

Is there a way to subscribe to topics on the MQTT broker as set in the config area of ESPEasy?

I want to display a temperature 'Setpoint' as defined in OpenHAB (published to Mosquitto) on an OLED screen attached to my ESP8266.

Is it simply a matter of adding the broker to the subscribe topic ? i.e. /broker/topic/value?

Scenario: -
I publish a temperature to an MQTT topic on my MQTT Broker (FishPI) called - /FishHAB5/Setpoint/Temp

Would I enter - '/FishPI/FishHAB5/Setpoint/Temp' in the MQTT Topic 1 to retrieve the value?

Many thanks.
Don't worry. It works as expected. OpenHAB was not publishing updated values to MQTT so there was nothing to read. Had to make a rule to publish values when the value changed. Bit 'work-around' but it works.! Thanks.

ricotrotter
Normal user
Posts: 7
Joined: 23 Jul 2016, 17:03

Re: MQTT Import

#28 Post by ricotrotter » 23 Jul 2016, 17:10

Hi,

I have been trying to compile the Plugin, with latest release (R113), but I get plenty of compilation errors.
I added extra utilities so that's not the issue. Errors seem to come from the pubsub library.
I used both the one delivered with Easpeasy and the pubsubclient (2.6.0).

Here is an extract from Arduino IDE error log:




_P210_MQTTImport:314: error: 'MQTT' does not name a type

void callback_210(const MQTT::Publish& pub) {

^

_P210_MQTTImport:314: error: expected unqualified-id before '&' token

void callback_210(const MQTT::Publish& pub) {

^

_P210_MQTTImport:314: error: expected ')' before '&' token

_P210_MQTTImport:314: error: expected initializer before 'pub'

void callback_210(const MQTT::Publish& pub) {

^

_P210_MQTTImport:27: error: no matching function for call to 'PubSubClient::PubSubClient(const char [1])'

PubSubClient MQTTclient_210(""); // Create a new pubsub instance

^

D:\Dropbox\Arduino\Projects\ESPEasy\_P210_MQTTImport.ino:27:31: note: candidates are:

In file included from D:\Dropbox\Arduino\Projects\ESPEasy\ESPEasy.ino:212:0:

D:\Dropbox\Arduino\libraries\arduino_454516\src/PubSubClient.h:116:4: note: PubSubClient::PubSubClient(const char*, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&, Stream&)

PubSubClient(const char*, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&);

^

D:\Dropbox\Arduino\libraries\arduino_454516\src/PubSubClient.h:116:4: note: candidate expects 5 arguments, 1 provided
I have visibly missed somthing...but I don't know what!?

Thanks!

tozett
Normal user
Posts: 733
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MQTT Import

#29 Post by tozett » 24 Jul 2016, 12:19

Do you have extra.tools.ino also?

ricotrotter
Normal user
Posts: 7
Joined: 23 Jul 2016, 17:03

Re: MQTT Import

#30 Post by ricotrotter » 25 Jul 2016, 12:19

Hi,

thanks for reply.
You mean Extra_Utilities.ino that can be found in https://github.com/ESP8266nu/ESPEasyPluginPlayground?
If so, yes.

For reference, my Arduino IDE is 1.6.9 and ESP Core is 2.3.0

Ricotrotter

tozett
Normal user
Posts: 733
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MQTT Import

#31 Post by tozett » 25 Jul 2016, 16:53

i did not tried to compile mqtt-import,
(as there is also an import -channel on the "normal" mqtt in espeasy, dont know if it get more open for more functions),
but i had normal compile issues with Core 2.3 on my arduino 1.6.5 IDE.
it worked with core 2.2.

may give IDE 1.6.5 and Core 2.2 a try, if this is the issue?

nightshark
Normal user
Posts: 25
Joined: 29 Apr 2016, 06:54

Re: MQTT Import

#32 Post by nightshark » 25 Jul 2016, 16:54

I am having the same problem as ricotrotter. I am using 1.6.5 with board version 2.2.0.

Code: Select all

ESPEasy.ino:249:29: error: no matching function for call to 'PubSubClient::PubSubClient(WiFiClient&)'
ESPEasy.ino:249:29: note: candidates are:
In file included from ESPEasy.ino:214:0:
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:47:4: note: PubSubClient::PubSubClient(String, uint16_t)
    PubSubClient(String hostname, uint16_t port = 1883);
    ^
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:47:4: note:   no known conversion for argument 1 from 'WiFiClient' to 'String'
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:46:4: note: PubSubClient::PubSubClient(IPAddress&, uint16_t)
    PubSubClient(IPAddress &ip, uint16_t port = 1883);
    ^
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:46:4: note:   no known conversion for argument 1 from 'WiFiClient' to 'IPAddress&'
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:43:4: note: PubSubClient::PubSubClient()
    PubSubClient();
    ^
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:43:4: note:   candidate expects 0 arguments, 1 provided
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:16:7: note: PubSubClient::PubSubClient(const PubSubClient&)
 class PubSubClient {
       ^
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:16:7: note:   no known conversion for argument 1 from 'WiFiClient' to 'const PubSubClient&'
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:16:7: note: PubSubClient::PubSubClient(PubSubClient&&)
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:16:7: note:   no known conversion for argument 1 from 'WiFiClient' to 'PubSubClient&&'
Controller.ino: In function 'void MQTTConnect()':
Controller.ino:75:14: error: 'class PubSubClient' has no member named 'setServer'
Controller.ino:76:14: error: 'class PubSubClient' has no member named 'setCallback'
Controller.ino:98:168: error: no matching function for call to 'PubSubClient::connect(const char*, char [26], char [64], const char*, int, int, const char [16])'
Controller.ino:98:168: note: candidates are:
In file included from ESPEasy.ino:214:0:
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:62:9: note: bool PubSubClient::connect(String)
    bool connect(String id);
         ^
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:62:9: note:   candidate expects 1 argument, 7 provided
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:65:9: note: bool PubSubClient::connect(String, String, uint8_t, bool, String)
    bool connect(String id, String willTopic, uint8_t willQos, bool willRetain, String willMessage);
         ^
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:65:9: note:   candidate expects 5 arguments, 7 provided
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:101:9: note: bool PubSubClient::connect(MQTT::Connect&)
    bool connect(MQTT::Connect &conn);
         ^
C:\Users\garrem03\Documents\Arduino\libraries\pubsubclient\src/PubSubClient.h:101:9: note:   candidate expects 1 argument, 7 provided
_P103_Event.ino: In function 'void Plugin_103_Action(byte, byte, int, int, byte)':
_P103_Event.ino:522:33: error: invalid conversion from 'char*' to 'byte {aka unsigned char}' [-fpermissive]
_P103_Event.ino:522:33: error: too few arguments to function 'void ExecuteCommand(byte, const char*)'
Command.ino:4:6: note: declared here
_P205_FrameOLED.ino: In function 'boolean Plugin_205(byte, EventStruct*, String&)':
_P205_FrameOLED.ino:210:34: error: no matching function for call to 'SSD1306Wire::init(int&)'
_P205_FrameOLED.ino:210:34: note: candidate is:
In file included from C:\Users\garrem03\Documents\Arduino\libraries\esp8266-oled-ssd1306-master/SSD1306Wire.h:31:0,
                 from C:\Users\garrem03\Documents\Arduino\libraries\esp8266-oled-ssd1306-master/SSD1306.h:30,
                 from _P205_FrameOLED.ino:30:
C:\Users\garrem03\Documents\Arduino\libraries\esp8266-oled-ssd1306-master/OLEDDisplay.h:114:10: note: bool OLEDDisplay::init()
     bool init();
          ^
C:\Users\garrem03\Documents\Arduino\libraries\esp8266-oled-ssd1306-master/OLEDDisplay.h:114:10: note:   candidate expects 0 arguments, 1 provided
_P205_FrameOLED.ino: In function 'void display_scroll(String*, String*, int)':
_P205_FrameOLED.ino:569:21: error: 'Dialog_Plain_12' was not declared in this scope
no matching function for call to 'PubSubClient::PubSubClient(WiFiClient&)'

tozett
Normal user
Posts: 733
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: MQTT Import

#33 Post by tozett » 25 Jul 2016, 17:08

i tried it with arduino 1.6.5, core 2.20 and pubsubclient 1.9 and pubsub 2.6
always with errors.
the developer of mqtt-import-plugin should have a look an update his sources, i guess...

User avatar
jsilver
Normal user
Posts: 23
Joined: 24 May 2016, 14:45
Location: Lewes, UK
Contact:

Re: MQTT Import

#34 Post by jsilver » 01 Aug 2016, 12:36

Alas namirda hasn't been seen here since April 2016. Does anyone have a forwarding address?

At what point should someone else step in and take over the code?

Drum
Normal user
Posts: 265
Joined: 07 Feb 2016, 11:56

Re: MQTT Import

#35 Post by Drum » 01 Aug 2016, 14:21

I don't know if it will help, but check the ESP releases thread and maybe try R114.

Martinus wrote
"Because the current R108, marked stable, still contains some bugs, it would be better to replace it with a newer version. R114 is available for evaluation. We moved to a newer MQTT client, it may improve connection issues. We also moved to Arduino core 2.3.0 because the 2.1.0 has issues with the servo library.

With this build, only core 2.3.0 is supported, so you need to upgrade the core package. I had some issues with the core upgrade, so i decided to download and configure a brand new portable setup using Arduino 1.6.9 with a fresh core 2.3.0 install.

R114 has been running for a week now in my environment. I successfully upgraded all my unit's using OTA. (NodeMCU 1.0 and ESP-01 black editions)

Changes since R108:

// Cleanup code, conditional core 2.0.0/2.1.0 support removed, changed to core 2.3.0
// Bugfix in rules processing with multiple value devices, only the first value would work as expected
// Bugfix for timezones other than whole hours offset. It is now set in +/- minutes
// Bugfix parsing rfid (SENSOR_TYPE_LONG) values in parseTemplate function
// Improved Serial Server plugin, reconnect handling
// Improved thingspeak and emoncms plugins (contributed by pm-cz)
// Fix HTU21d timing
// Moved to pubsubclient 2.6 library (source no longer compatible with 1.9 library, so use the 2.6 version!)"

ricotrotter
Normal user
Posts: 7
Joined: 23 Jul 2016, 17:03

Re: MQTT Import

#36 Post by ricotrotter » 02 Aug 2016, 15:01

Thanks for reply.
Though, I get no issue compiling ESPEasy normally.
It's the MQTT plugin that is having issue.
I will investigate further!

Martinus

Re: MQTT Import

#37 Post by Martinus » 03 Aug 2016, 18:26

jsilver wrote:Alas namirda hasn't been seen here since April 2016. Does anyone have a forwarding address?
You could send him a PM and he should get a regular mail to it's registered email address.
jsilver wrote:At what point should someone else step in and take over the code?
We have no policy for this. But if there is no response on PM, i can have a look. But remember that he might be on holiday (and so will i as of today...)

What need's to be done, is a migration to make it compliant to the new api that came with the newer pubsub library.

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

Re: MQTT Import

#38 Post by namirda » 05 Aug 2016, 06:31

Hi All,

Sorry about the silence but I have been busy on other projects for a while and did not realise how quickly stuff gets out of date in the ESPEasy world!

I have put an updated version of MQTTImport into the playground which runs with ESPEasy118, Core 2.3 and PubSub 2.6 - hopefully there will not be such frequent changes to the toolchain going forward!

Neil

ricotrotter
Normal user
Posts: 7
Joined: 23 Jul 2016, 17:03

Re: MQTT Import

#39 Post by ricotrotter » 05 Aug 2016, 11:28

Hi namirda,

thanks for the update!
I confirm I could compile it.
Not tested yet!
One only issue: string2float is duplicated from the extra_utilities files - I had to remove it manually as I need extra_utilities for other plugins.

Cheers
Rico

User avatar
jsilver
Normal user
Posts: 23
Joined: 24 May 2016, 14:45
Location: Lewes, UK
Contact:

Re: MQTT Import

#40 Post by jsilver » 05 Aug 2016, 20:01

namirda wrote:I have put an updated version of MQTTImport into the playground which runs with ESPEasy118, Core 2.3 and PubSub 2.6
Thank you Neil! I'll go and try it...

See, that's what happens when you write some really useful code and then get on with the rest of your life! :D

timsson
Normal user
Posts: 77
Joined: 25 Mar 2016, 22:00

Re: MQTT Import

#41 Post by timsson » 06 Aug 2016, 12:46

Thank you Neil! For me it works with ESPEasy118..
It is possiible to import a string or On/OFF with the mqtt-plugin?
I need it to write the state in my oled...

-----
mosquitto_sub -t /# -v
/ESP_03/window1/state open
/ESP_03/window2/state OFF
/Alarmsytem/state disarm
---
MQTT-plugin Name: Window1 -- Topic 1:/ESP_03/window1 -- Value Name 1: -- Formula Value1: string(open)
oled-plugin Line1: Floor: [Window1#Value1]
----->
Oled Line1:
Floor: open
or
System: disarm

User avatar
jsilver
Normal user
Posts: 23
Joined: 24 May 2016, 14:45
Location: Lewes, UK
Contact:

Re: MQTT Import

#42 Post by jsilver » 08 Aug 2016, 13:59

timsson wrote:It is possiible to import a string or On/OFF with the mqtt-plugin?
This would be really useful.

Also, I'm up and running with R118, OLED Framed, and MQTT-import too. Thanks Neil!

-macke-
Normal user
Posts: 10
Joined: 03 Sep 2016, 21:53

Re: MQTT Import

#43 Post by -macke- » 09 Sep 2016, 16:40

Hello!

I get this error when trying to install the plugin: I have Extra_Utilities in the same catalog:


C:\Users\Macke.BLUEBERRY\Documents\Arduino\libraries\ESPEasy\_P210_MQTTImport.ino: In function 'float string2float(String)':
_P210_MQTTImport:450: error: redefinition of 'float string2float(String)'

float string2float(String myString) {

^

Extra_Utilities:130: error: 'float string2float(String)' previously defined here

float string2float(String myString) {

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

Re: MQTT Import

#44 Post by namirda » 10 Sep 2016, 11:57

Hi,

You can delete string2float from extra_utilities - the function is duplicated in MQTT Import.

-macke-
Normal user
Posts: 10
Joined: 03 Sep 2016, 21:53

Re: MQTT Import

#45 Post by -macke- » 12 Sep 2016, 08:18

namirda wrote:Hi,

You can delete string2float from extra_utilities - the function is duplicated in MQTT Import.
Thanks :) Now it´s working!

This plugin was excatly what I was looking for. Great work :)

timsson
Normal user
Posts: 77
Joined: 25 Mar 2016, 22:00

Re: MQTT Import

#46 Post by timsson » 15 Nov 2016, 21:26

Hello,
Unfortunately I still have my problem.
Could someone help me to send a text with mqtt to the display?
Thanks

bassmint
Normal user
Posts: 9
Joined: 26 Nov 2015, 20:12

Re: MQTT Import

#47 Post by bassmint » 25 Nov 2016, 06:31

-macke- wrote:
namirda wrote:Hi,

You can delete string2float from extra_utilities - the function is duplicated in MQTT Import.
Thanks :) Now it´s working!

This plugin was excatly what I was looking for. Great work :)
I tried and had this issue. Tried the fix of deleting >string2float< but it throws out other errors that I don't understand.
I am not sure of what exactly I should be deleting. just the string2float, the entire section of such. I have tried many combinations and read many pages but still have not found a fix.

I am using arduino ide latest version and tried with 1.6.5 as suggesting in a post.
deleted ide and all data files and used fresh install

used latest versions of easyesp and test versions. had no luck with the mqttimport

any help appreciated.

FWIW none of the links in the forum posts don't seem work.

tia

Code: Select all

Arduino: 1.6.13 Hourly Build 2016/09/30 06:12 (Mac OS X), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, 115200, 4M (3M SPIFFS)"

/Users/jpe/Documents/Arduino/ESPEasy/ESPEasy.ino: In function 'void setup()':
ESPEasy:547: error: 'PluginInit' was not declared in this scope
     PluginInit();
                ^
ESPEasy:548: error: 'CPluginInit' was not declared in this scope
     CPluginInit();
                 ^
/Users/jpe/Documents/Arduino/ESPEasy/ESPEasy.ino: In function 'void loop()':
ESPEasy:657: error: 'PluginCall' was not declared in this scope
       if (!PluginCall(PLUGIN_SERIAL_IN, 0, dummyString))
                                                       ^
/Users/jpe/Documents/Arduino/ESPEasy/ESPEasy.ino: In function 'void run10TimesPerSecond()':
ESPEasy:686: error: 'PluginCall' was not declared in this scope
   PluginCall(PLUGIN_TEN_PER_SECOND, 0, dummyString);
                                                   ^
/Users/jpe/Documents/Arduino/ESPEasy/ESPEasy.ino: In function 'void runOncePerSecond()':
ESPEasy:734: error: 'PluginCall' was not declared in this scope
   PluginCall(PLUGIN_ONCE_A_SECOND, 0, dummyString);
                                                  ^
/Users/jpe/Documents/Arduino/ESPEasy/ESPEasy.ino: In function 'void SensorSendTask(byte)':
ESPEasy:872: error: 'PluginCall' was not declared in this scope
       success = PluginCall(PLUGIN_READ, &TempEvent, dummyString);
                                                                ^
/Users/jpe/Documents/Arduino/ESPEasy/ESPEasy.ino: In function 'boolean checkSystemTimers()':
ESPEasy:978: error: 'PluginCall' was not declared in this scope
         if (!PluginCall(PLUGIN_WRITE, &TempEvent, systemCMDTimers[x].action))
                                                                            ^
/Users/jpe/Documents/Arduino/ESPEasy/Controller.ino: In function 'boolean sendData(EventStruct*)':
Controller:38: error: 'PluginCall' was not declared in this scope
   PluginCall(PLUGIN_EVENT_OUT, event, dummyString);
                                                  ^
/Users/jpe/Documents/Arduino/ESPEasy/Extra_Utilities.ino: At global scope:
Extra_Utilities:130: error: expected ')' before 'myString'
 float (String myString) { 
               ^
Multiple libraries were found for "Servo.h"
 Used: /Users/jpe/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/Servo
 Not used: /Applications/Arduino.app/Contents/Java/libraries/Servo
exit status 1
'PluginInit' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

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

Re: MQTT Import

#48 Post by namirda » 08 Dec 2016, 10:16

Hi Bassmint - Sorry, I don't come by this forum very often any more.

You must be doing something wrong here.

Just to be sure that there have been no breaking changes for MQTTImport in the last few months, I downloaded ESPEasy R147 from GitHub and added the version of MQTTImport from the playground into the sketch directory.

It compiled and ran without problems first time. There should be no need to delete anything. I was using Arduino 1.6.11

Good Luck

n

bassmint
Normal user
Posts: 9
Joined: 26 Nov 2015, 20:12

Re: MQTT Import

#49 Post by bassmint » 09 Dec 2016, 07:48

thanks

will try again

tried again and found the issue is with Arduino IDE on MacOS Sierra. Needed v 1.6.12.

went in ok.

thanks again

Jeff
Normal user
Posts: 26
Joined: 18 Nov 2016, 18:35

Re: MQTT Import

#50 Post by Jeff » 15 Jan 2017, 13:54

Thanks.

It work, i understand the operation.

On the other hand of the MQTT plugin with idx = "1", i have this error on domoticz,

Code: Select all

2017-01-15 13:51:13.517 MQTT: Topic: domoticz/in, Message: {"idx":1,"nvalue":0,"svalue":"1"}
2017-01-15 13:51:13.517 Error: MQTT: unknown idx received!
To solve this problem, I create a fake switch "text" with idx = 1 (open database and change the idx)

Code: Select all

2017-01-15 14:01:32.042 MQTT: Topic: domoticz/in, Message: {"idx":1,"nvalue":0,"svalue":"1"}
2017-01-15 14:02:02.069 MQTT: Topic: domoticz/in, Message: {"idx":1,"nvalue":0,"svalue":"1"}
2017-01-15 14:02:32.098 MQTT: Topic: domoticz/in, Message: {"idx":1,"nvalue":0,"svalue":"1"}
2017-01-15 14:03:02.132 MQTT: Topic: domoticz/in, Message: {"idx":1,"nvalue":0,"svalue":"1"}
:D

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests