OpenMQTTGateway with Mi Band 2

Ahā€¦ I got it after change the line ending setting to Both NL & CR.

When I executeā€¦

AT+NAME = MLT-BT05
AT+VERSION = MLT-BT05-V4.1

What should I do next?

hi,

It seems you have a clone :-(. Try: AT+ROLE1 and then AT+DISC?. Then the hm10 should report what it find. If you got yourself this deep, you may want to look on the ā€œ433mhz, infrared IR to and from MQTT on ESP8266ā€ thread. @1technophile told me how to reflash the hm-10 so you turn a clone in to a ā€œoriginalā€ hm-10 :slight_smile:

my badā€¦ @Petrica told me :-). (433mhz, infrared IR to and from MQTT on ESP8266)

Thanks. Iā€™m wondering where to buy the genuine HM10 or 11? Iā€™m going to build around 9 gateways. Reflashing the firmware sounds like too much trouble for me.

I sent these commandsā€¦

AT+ROLE1
AT+DISC?

It returns ERR

If sent these (without ?)ā€¦

AT+ROLE1
AT+DISC

It just returns OK but nothing after that.

I notice Happy Bubbles is using PTR5518 bluetooth module. I am wondering can I use this instead of HM 10 or 11?

Hi Ben :slight_smile:

With the latest Attack of the Clones :smiley: it seems that HM10 became more like an embedded function rather than a specific hardware.

Look at my previous post that includes the Youtube video for the flashing of HM10 on a clone:

Although I have an anti-talent for soldering, Iā€™ve managed to follow it and to flash the clone.

Iā€™ve since had several issues with the clone (MQTT connection reset - not a full NodeMCU reboot) so I ordered a ā€œgenuineā€ HM10:

https://www.aliexpress.com/item/HM-10-transparent-serial-bluetooth-4-0-bluetooth-serial-port-module-with-logic-level-transformation/32238168582.html?

Iā€™m unsure whether this is genuine or not however Iā€™ve received it yesterday (it comes with v545) and I replaced the clone with this one so I didnā€™t need to solder anything on this one. So far, so good. I havenā€™t got any MQTT reset. The ā€œgenuineā€ board has a black PCB instead of blueish/azure on the clone however I really donā€™t think this is the only difference (and it is also 3/4 times more expensive than the clone :slight_smile: )

May I ask what you plan to use the BT gateway for? If planning to use it for lights then it might be too lazy (there is a 10 second interval between scans which could be reduced however not below a reasonable threshold to be used with turning lights on). We have described several limitations to using BT gateway:

1 Like

In banggood the brand is keyes
https://www.google.fr/url?sa=t&source=web&rct=j&url=https://m.banggood.com/fr/KEYES-HM-10-6-Pin-Transparent-BLE-Bluetooth-V4_0-Serial-Port-Module-With-Logic-Level-Translator-p-1023524.html&ved=0ahUKEwivtJGFh7jWAhUcOsAKHdwKASYQFgggMAA&usg=AFQjCNHnNkjqGvAu84bFM_vvHD71LNGgug

1 Like

Thanks. I plan to use it as room presence detector similar to Happy Bubbles so that when it detects no one in the room, it will trigger the automation to turn off lights and fans. It will solve the problem where lights would turn off if someone stay still for too long in a room. For turning on things, I feel motion sensor is more suitable. Anyway thanks for the link. I will purchase this and give this project another chance.

@masterkenobi

If finding yourself in the dark is the problem, I would suggest adjusting the automation that takes care of the light in order to reset the timer each time a new movement is recorded (thus the light wonā€™t turn off after 5 minutes since PIR was triggered for the first time when entering the room but rather 5 minutes after last PIR trigger in the respective room).

I can provide the configuration. I employ:
i) several automation that are also dependent on the sun (above/below horizon), on the light switches state and the light level in the room (i.e when blinds are shut);
ii) scripts, used for triggering the lights on and for resetting the one responsible for turning on; and
iii) input sliders (in order to control the various properties of the light bulbs).

I started with several automation that called different scenes however in scenes I couldnā€™t use input sliders as values for color codes or temp color so I moved to scripts.

thanks for your suggestion. I think my automation for lights is similar with yours. I believe you need to move around within 5 minutes otherwise the lights will turn off. Also, when everyone has left the room, the lights will remain on for at least 5 minutes. To reduce false positive, you can increase the timer to longer duration, but that also means the lights will remain on longer after everyone has left the room.

I believe BLE room presence tracker will solve this problem. The lights will automatically turn off immediately when no one is in the room or someone can sleep peacefully with the fan on without worry the fan would turn off by itself.

Also I plan to create an automation with personalize greeting to every occupants when they walk into the living room every morning.

Anyway, I have ordered the new BLE modules and it will take at least a month to reach me. While waiting for this, I plan to troubleshoot problem with the BH1750 light sensors. Anyone knows why it fails to read from LightSensor BH1750?

Iā€™ve mentioned 5 minutes only as a reference value :slight_smile for the resettable script.

I have different settings (RGB/CT), light intensity and timers (15/5/1 minutes) for: day (above_horizon), sunset to midnight (after: sunset) and midnight to sunrise (before: sunrise). Also, I use 433 wall switches which have different timers (1 hour during day, 15 min after sunset). And switches override PIR sensors.

I found that using 2 PIR sensors in each room helped covering all the blind spots so each time a movement is recorded the timer is reset by either unit.

BLE room presence has the disadvantage that the person must carry the token all the time (while for PIR the person is the token). This is not really convenient while at home as the phone/keys might be left in another room and the lights would stay on in that room even if there is no movement; although would help to know where the token (keys/phone) was left. Obviously, if used for tracking, the phone requires having BT on and not associated to any device.

I use Tile for finding devices associated with a tablet and my secondary phone so that I can find them regardless of location. Usually the secondary phone has BT off and when I arrive home the Tile on the keychain is not associated, so it would be picked up by the BT Gateway. After arriving home, the Tile connects to the tablet so that I can use it for finding the keys or the wallet.

In regard of the light sensor, the last beta of OpenMQTT introduced also the ADC reading so that cheap LDR sensors (coupled with 1K resistor) could be used on the A0 pin.

Agree. As per the title, I plan to use Mi Band 2 as the token. Iā€™m already wearing this 24/7. Thatā€™s why I plan to use it as room presence tracker.

Thatā€™s good news. Will try this out instead. Thanks!

My bad, didnā€™t knew what the Mi Band 2 is :slight_smile:

I donā€™t know what the battery drain might be when it would permanently scan for the phone to connect to as compared to the case when it is connected 24/7.

Hi all,

Maybe we could use the counter sensor now: keep a counter for each room. If counter = 0 then turn off the light :-).

Hi,

Do you mean each event in the room (PIR sensor/open door sensor/BLE tracker) to be added to the counter and then have the counter reset (at 0) when there are no events for 1 hour/10 minutes/etc?

Pls correct me if Iā€™m wrong. From my understanding, the band power consumption will not be more than what itā€™s already is. The gateway wonā€™t actually pair it like the phone pair with it. The gateway just ā€œsniffā€ the BLE signal and itā€™s strength which is readily available.

I donā€™t think counter sensor works like this.

No, the band wonā€™t connect to the Gateway (but neither to the phone as otherwise it wonā€™t send the beacon signal).
As the band it is not connected it will broadcast, continuously, this signal in order to find the device it was paired to. Iā€™m unsure how much battery will drain each case.
I have a semi-smartwatch (screen always on) that should lasts about 1 mo per charge and sometimes disconnects from the phone (quite antique) and it wonā€™t reconnect by its own (for days). I found that the battery lasts longer (3-4 days longer) when it is connected to the phone. However, it also depends on a lot more factors such as type of activity (as it monitors steps, sleep), room temperature, etc.

I rarely pair my band to my phone coz I donā€™t want to drain my phone battery by leaving the Bluetooth on all the time. At most once a day to see my sleep quality. I guess it wonā€™t makes any different in my case coz I donā€™t really connect my band to any phone anyway.