OpenMQTTGateway with Mi Band 2

@happybubbles Great i will open an enhancement and check what can be done.

1 Like

Iā€™m sorry. I donā€™t mean to rush anything. But my HM-10 module just arrived. May I know how is it coming? Thanks in advance.

Did you try first to detect beacons with the gateway without happybubbles presence server ?

1 Like

Hi, any update for a HASSIO add on?

Lots of user are switching to HASS.IO

OK no problem. will try it in next few days.

is there any progress

This question is for @1technophile.

I finally have time to sit down and start rebuild a new gateway using OpenMQTTGateway on NodeMCU with the following modulesā€¦

  • 433Mhz Receiver/Transmitter
  • DHT22 temperature/humidity sensor
  • BH1750 light sensor
  • HM-10 BLE Bluetooth module

I must say Iā€™m impress with the progress of this project. I started with 433toMQTTto433 few months back and oh boy how much it has changed! Good job @1technophile!

Anyway, I hit a hiccup in setting up the gateway. When I verify the sketch, I received this errorā€¦

Arduino: 1.6.5 (Windows 8.1), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 1M (64K SPIFFS), ck, Disabled, None"

In file included from OpenMQTTGateway.ino:42:0:
User_config.h:62: error: 'byte' does not name a type
 const byte ip[] = { 192, 168, 1, 217 }; //ip adress
       ^
User_config.h:64: error: 'byte' does not name a type
 const byte gateway[] = { 192, 168, 1, 1 }; //ip adress
       ^
User_config.h:65: error: 'byte' does not name a type
 const byte Dns[] = { 192, 168, 1, 1 }; //ip adress
       ^
User_config.h:66: error: 'byte' does not name a type
 const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
       ^
OpenMQTTGateway.ino: In function 'boolean reconnect()':
OpenMQTTGateway:88: error: 'subjectMultiGTWIR' was not declared in this scope
OpenMQTTGateway.ino: In function 'void setup_wifi()':
OpenMQTTGateway:192: error: 'ip' was not declared in this scope
OpenMQTTGateway:193: error: 'gateway' was not declared in this scope
OpenMQTTGateway:194: error: 'subnet' was not declared in this scope
OpenMQTTGateway:195: error: 'Dns' was not declared in this scope

'byte' does not name a type

Any idea what went wrong?

UPDATE: OK. I manage to fix this by updating the Arduino IDE to the latest version. After I upload it to my NodeMCU and open up serial monitor, all I see isā€¦

 ets Jan  8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld

it keeps on repeating every few seconds. Iā€™m whatā€™s wrong?

Hello,

Thanks @masterkenobi, we are having more contributors and people to answer questions on this project what make it progressing faster.
I m happy that one of the first user measure the progress !

Regarding your issue you could try to update your ide to 1.8.4 and use nodemcu v1 as a board.

yes. i have updated my IDE to 1.8.4 and selected nodemcu v1 as the board. but I all I see is this in my serial monitorā€¦

 ets Jan  8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld

Did you update the esp8266 boards to 2.3.0 version in arduino ide -> board manager

Yes I haveā€¦

By the way, this is what I have selectedā€¦

Board: NodeMCU 1.0 (ESP-12E Module)
CPU Frequency: 80 MHz
Flash Size: 4M (3M SPIFFS)
Upload Speed: 115200

Not sure they are correct or not.

The issue is with v0.4 beta ?

sorry. what are you referring to? the Arduino IDE?

Anyway, I have uninstalled Arduino 1.8.4 and installed 1.8.1. Then I put all the libraries from https://github.com/1technophile/OpenMQTTGateway/tree/master/libraries to C:\Users<user>\Documents\Arduino\libraries. This is how I do itā€¦

  1. I ā€œDownload ZIPā€ in Github for each libraries and save it to C:\Users<user>\Documents\Arduino\libraries.
  2. I unzip each zip files.
  3. Then I renamed the folder name by removing any underscore, dash and the long random string at the back. For example; Adafruit_Sensor-e985f2253a687ef377cde3dcfb1f788830d1bc09 renamed to AdafruitSensor.

Then I modify the User_config.h as suchā€¦

  1. Uncomment #define I2C_Wiring
  2. Comment //#define Classic_Wiring
  3. Set my MQTT Parameters definitions
  4. Define network parameters and OTA parameters.
  5. Comment the following linesā€¦
  //#ifdef RFM69_Wiring
    //#define ZgatewayRFM69
  //#include "config_RFM69.h"
  //#endif
  //#define ZgatewayIR
  //#include "config_IR.h"

    //#define ZsensorBME280
    //#include "config_BME280.h"

In OpenMQTTGateway.ino, I had to remove && client.subscribe(subjectMultiGTWIR) on line 88 because it is throwing error. Iā€™m not using any IR module for this gateway.

Other changes I made are to config_BH1750.h, config_BT.h and config_DHT.h. I just modify the MQTT topics to make sure they are unique for each gateways.

Thatā€™s all I have done on the software side. Do you think this error is due to hardware or wiring issue?

I think I know why Iā€™m receiving this error. I selected the wrong upload speed. The correct speed I should select is 9600. However, when I upload the sketch, I receive errorā€¦

2017-09-20_191343

The pain!

When I verify the sketch, I received no error. I can upload other sketches without any error too. Any idea?

Try to upload without nothing connected maybe

Iā€™m talking about the OpenMQTTGateway version, did you downloaded this one:

After multiple trial and errors, I manage to upload without BH1750 and using classic wiring. But serial monitor still shows the same error. It got connected for awhile but then disconnected again with the same error came up.

I didnā€™t know I can use different version from Releases Ā· 1technophile/OpenMQTTGateway Ā· GitHub . I downloaded from hereā€¦

2017-09-21_110820

Still got a lot to learn on Github,

Anyway, I have reuploaded the sketch using v0.3.1 but still received the same error. I am wondering have I damaged my NodeMCU when I connected BH1750 to Vin (5V) on NodeMCU as per advice from @syssi (I just remember this). I going to get a replacement NodeMCU to try again.

UPDATE: I used v0.1 which is basically the same version with the one I used on the first gateway using the same wiring and still receive the same error.

Seems not related to the software, could you post a photo of the nodemcu and a screenshots of the parameters used for compilation

I got my replacement NodeMCU.

These are my results:

  1. OpenMQTTGateway v0.1 + RF -> Success
  2. OpenMQTTGateway v0.3.1 + RF -> Success
  3. OpenMQTTGateway v0.3.1 + RF + DHT -> Success
  4. OpenMQTTGateway v0.3.1 + RF + DHT + BT -> Success
  5. OpenMQTTGateway v0.4-beta + RF + DHT + BT (Classic Wiring) -> Success
  6. OpenMQTTGateway v0.4-beta + RF + DHT + BT + BH1750 (VCC on BH1750 connect to 3V3 on NodeMCU. I2C Wiring) -> Success (but received this error in Serial Monitor: Failed to read from LightSensor BH1750!)

I can conclude that the earlier NodeMCU is damaged. By what? I am not sure. Perhaps by connecting BH1750 VCC to NodeMCU Vin (5V). Can someone confirm this?

By the way, I am not receiving anything on this MQTT topic as well; home/BTtoMQTT/. Maybe its due to the HM-10 firmware issue. Will troubleshoot it next time. After 4 days of troubleshooting, I am glad I got this far.

1 Like

Hi,

When I first tried the bluetooth shield, the openmqttgateway was able to find it, but the scan didnt report anything. I disconected the shield from nodemcu (wemos d1 mini for me) and connected it diretcly to the computer with a FTDI adapter and then tried to scan manually with AT commands. Got it working this way. When I reconnected the shield to the wemos, it simply worked. Of course the whole history is bigger than that, because somewhere in the middle (while playing with AT commands i did something wrong and had to reflash it). But, Iā€™m sure that i saw the HM-10 connected and nothing scanned. My guess is that you need some AT command to put the HM-10 in scan mode, and maybe this is missing. @1technophile is this possible?