Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By ridge
#29882 You are welcome! No two DIY home automation systems are the same!

I have not seen any node resets (at all) or mqtt server disconnects that did not successfully reconnect lately.
I have moved my openHAB server from the BeagleBone to a RPi B. The mosquitto broker is still on the BBB.
I have better luck with a manual install of openHAB than the repository installs that most online tutorials show.
I tried homeassistant.io as the control software... it works well with mqtt. It is still under heavy development, so I went back to openHAB again.

MQTT allows for a plug-and-play approach. Both homeassistant and openHAB were able to be used on the same local network at the same time over the same mosquitto broker with no problems at all. The nodes don't care who the mqtt commands are sent from. They only talk to the broker.

Other than learning how to use persistence and charts from within the openHAB package, no major upgrades to the system. OpenHAB charting needs an upgrade from the one included for better visuals.

InfluxDB and Grafana can be locally hosted but should really have a non-embedded 64bit system with a proper hard drive to run on. To that end, I have an Intel atom motherboard with the N2800 series device. This has possibly the worst video section and support of -any- product ever produced. First generation RPi's easily run multiple circles around this things video capabilities. It is only suited as a headless device. I think I may have found my database server. :)

InfluxDB 0.9.4.1 installed on the atom board running Ubuntu 14.04 64bit without a hitch. Grafana soon to follow. Then some mqtt glue from https://github.com/jpmens Either the standalone mqttwarn program or the availabe InfluxDB plugin for openHAB should get some sensor readings piped into the InfluxDB.

The latest InfluxDB version breaks the current openHAB plugin. I deleted InfluxDB 0.9.4.1 and installed InfluxDB 0.8.9.
The esp8266 node sensors, MQTT, openHAB, InfluxDB and Grafana are all playing together nicely now.
Here are two screen shots of graphs.
The first from within openHAB using the rrd4j database and built-in graphing.
The second is from the Grafana web interface using the InfluxDB.
You be the judge if the effort and added complexity of a commercial grade database and graphing software package is worth it for your needs.
openHAB_Chart.png

Grafana_Chart.png


-----------------update: September 29, 2015-----------------------

InfluxDB and Grafana are staying in my setup. Excellent results from both packages.
I did manage to create a self-inflicted denial of service attack that was difficult for me to understand and debug.

The current setup consists of 10 computers exchanging information:
8 esp8266 MQTT nodes
openHAB on RPi B
mosquitto broker on the same RPi B
InfluxDB and Grafana on Intel atom netbook class computer.

The Intel atom computer was rebooted and (unknown to me) given a different IP address from the router than was hardcoded in the configuration files for the openHAB InfluxDB plugin. It was not reachable for database updates.
This turned out to be the root cause of my overall setup going completely unstable, this error condition was not obvious.

As I had just transfered the mosquitto broker from the beaglebone black to the RPi, I wrongly assumed the mosquitto broker was acting very badly. All nodes were doing multiple connection attempts and resets. Sporadic limited data was getting through sometimes. Downloading from the internet was impossible.

It was some time and frustration with the nodes, RPi and mosquitto before I tried to access the database through Grafana and finally realized that the InfluxDB was unreachable. When the addressing was corrected, the system returned to its normal, stable self.

The silent failure of the openHAB InfluxDB plugin and flooding of network communications with unserviced database update attempts, causing the nodes to loose MQTT connection and reset was an interesting troubleshooting lesson.

Moral of the story?
(1) I should have set a static IP address on the Intel atom board.
(2) It is easier to debug things when only one change is done at a time. (Some lessons are learned over and over. ) :)
You do not have the required permissions to view the files attached to this post.
User avatar
By vazquezjm
#44831
ridge wrote:PubSubClient library for the esp8266: My previous setup used the 3 year old knolleary/pubsubclient library. It worked, but the better choice these days is the lmroy/pubsubclient library. https://github.com/Imroy/pubsubclient

Hi, why did you chose one over the other? I'm trying to decide which one to use, but it is not clear for me yet. Thanks
User avatar
By heshan
#50489 Hi everyone,

This is a great tutorial but due to being a newbie unable to compile the code.. I'm using a ESP8266MOD chipped (AI Thinker) arduino board (WeMos D1). note that I get these errors while trying to do a compile on my laptop before I load it onto the board. I only have one board and is being used for some other experiments hence I haven't had the chance to load it onto the actual board but I don't see how that could make a difference. Correct me if I'm wrong.

I keep getting the following errors;

Arduino: 1.6.8 (Windows 10), Board: "WeMos D1(Retired), 80 MHz, 921600, 4M (3M SPIFFS)"

Build options changed, rebuilding all
sketch_jul10a:49: error: 'MQTT' does not name a type

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

^

sketch_jul10a:49: error: expected unqualified-id before '&' token

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

^

sketch_jul10a:49: error: expected ')' before '&' token

sketch_jul10a:49: error: expected initializer before 'pub'

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

^

sketch_jul10a:28: error: no matching function for call to 'PubSubClient::PubSubClient(IPAddress&)'

PubSubClient mqttClient(mqttServer);

^

C:\Users\heshan\AppData\Local\Temp\arduino_modified_sketch_814435\sketch_jul10a.ino:28:35: note: candidates are:

In file included from C:\Users\heshan\AppData\Local\Temp\arduino_modified_sketch_814435\sketch_jul10a.ino:15:0:

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\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&);

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:116:4: note: candidate expects 5 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:115:4: note: PubSubClient::PubSubClient(const char*, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&)

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

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:115:4: note: candidate expects 4 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:114:4: note: PubSubClient::PubSubClient(const char*, uint16_t, Client&, Stream&)

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

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:114:4: note: candidate expects 4 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:113:4: note: PubSubClient::PubSubClient(const char*, uint16_t, Client&)

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

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:113:4: note: candidate expects 3 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:112:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&, Stream&)

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

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:112:4: note: candidate expects 5 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:111:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&)

PubSubClient(uint8_t *, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:111:4: note: candidate expects 4 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:110:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, Client&, Stream&)

PubSubClient(uint8_t *, uint16_t, Client& client, Stream&);

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:110:4: note: candidate expects 4 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:109:4: note: PubSubClient::PubSubClient(uint8_t*, uint16_t, Client&)

PubSubClient(uint8_t *, uint16_t, Client& client);

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:109:4: note: candidate expects 3 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:108:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&, Stream&)

PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&);

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:108:4: note: candidate expects 5 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:107:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, std::function<void(char*, unsigned char*, unsigned int)>, Client&)

PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:107:4: note: candidate expects 4 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:106:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, Client&, Stream&)

PubSubClient(IPAddress, uint16_t, Client& client, Stream&);

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:106:4: note: candidate expects 4 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:105:4: note: PubSubClient::PubSubClient(IPAddress, uint16_t, Client&)

PubSubClient(IPAddress, uint16_t, Client& client);

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:105:4: note: candidate expects 3 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:104:4: note: PubSubClient::PubSubClient(Client&)

PubSubClient(Client& client);

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:104:4: note: no known conversion for argument 1 from 'IPAddress' to 'Client&'

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:103:4: note: PubSubClient::PubSubClient()

PubSubClient();

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:103:4: note: candidate expects 0 arguments, 1 provided

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:83:7: note: PubSubClient::PubSubClient(const PubSubClient&)

class PubSubClient {

^

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:83:7: note: no known conversion for argument 1 from 'IPAddress' to 'const PubSubClient&'

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:83:7: note: PubSubClient::PubSubClient(PubSubClient&&)

C:\Users\heshan\Documents\Arduino\libraries\PubSubClient\src/PubSubClient.h:83:7: note: no known conversion for argument 1 from 'IPAddress' to 'PubSubClient&&'

sketch_jul10a:49: error: 'MQTT' does not name a type

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

^

sketch_jul10a:49: error: expected unqualified-id before '&' token

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

^

sketch_jul10a:49: error: expected ')' before '&' token

sketch_jul10a:49: error: expected initializer before 'pub'

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

^

exit status 1
'MQTT' does not name a type

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