433mhz, infrared IR to and from MQTT on ESP8266

You are right!! I guess i was kind sleepy and didnt tried the correct serial settings. Also, using the correct firmware you have to use the interrogation as in “AT+NAME?”, and old firwmare didnt require that. Many thanks! is it necessary to go to v550? The current version (v540) is enough right?

I really don’t know (I’ve used v540 for some time).

But again, I love flashy, new things, so I moved to v550 once I could :smiley:

The problem I had on v540 (Nodemcu resetting at some random times) is present on v550 and also when BT is connected to another Nodemcu so I think it’s BT hardware module fault and not a software issue. I guess I will order a genuine HM-10 module and try with that one.

Finally success!!! I did the upgrade to v550, and tried the commands to fix the leds. Thanks @Petrica! Led is still off, but I dont care :-). Now, going to find my devices IDs.

Btw… I had a nodemcu, but not sure if it’s still alive. It just output something that seems a coredump, or crash last words :-). Since I have a few Wemos D1 mini, i just put the openmqtt on one and it seems happy enough.

On a side note. is it possible to run openmqtt on a ESP32? I heard that the bluetooth libraries arent production ready yet.

Glad to help.

With serial monitor connected (baud rate 115200) it is showing the full MQTT topic for each device (it requires the devices not to be associated).

I’ve pinpointed the bluetooth addresses of my devices by moving around the gateway until I’ve reached a RSSI value of about -20 so not a very scientific method :smiley: .

I think it’s not yet available. ESP32 did not reached the same level of development as ESP8266.

Not tested yet, i have one waiting for me in my desk. I keep a look to the developement and will try when I think it is enough mature

could you add some other sensor to the openmqttgateway?such as pir (hc-sr501)

if i do it myself,what should i do?

Now that i have my scanner working, I’m wondering the best way to use it to do presence detection. It seems that with very little changing in the code we could use the MQTT Room Presence. This component expects a little json with id, name and distance. We could use the mac as the id and name and do a little math to transform the rssi into a positive “distance”. The component also expects a topic of the room name which is easily done defining it on user_config.h. I just have to understand how to work with strings in arduino (or use a little help :slight_smile: ).

You can try to replicate the other Zsensor files. If you do a mix between the examples and pir sensor tutorial you could produce a new ZsensorPIR and publish it.

@clyra, @jxjhheric
I think that using separate (433 Mhz/Z-wave/Zigbee) PIR sensors would be a better alternative to attaching a sensor to the gateway (either Bluetooth beacon or PIR such as HC-SR501) due to the followings:

  • one Nodemcu flashed with RF gateway software + Bluetooth or PIR module would be needed in each and every room; whilst for 433 Mhz system you need one sensor in each room, there is need for a single Nodemcu/Arduino in a location that has good coverage (preferably central room);
  • a wall socket would be needed near each gateway which limits greatly the possibilities where it could be located (you could place a wireless 433 Mhz sensor anywhere you like or need one);
  • cost of a Nodemcu + Bluetooth/PIR module for each room would be near the one of a 433 Mhz PIR;
  • for the Bluetooth sensor mesh to function properly you would need to have both following conditions met (i) keeping Bluetooth on and (ii) keeping it disassociated; so basically you cannot use the phone’s Bluetooth connection for other stuff;

One might think that the top disadvantage of 433 Mhz PIR sensors would be security. Although a valid point (having no authentication method means that anyone can post a code near your location and possibly turn your lights on or off; a larger concern would be for an alarm system than for simple lights control) it is unlikely that the system could be hacked remotely because an attacker would need to be near the receiver (within a 10-20 m at max; walls significantly limit the range of system) and know the codes for each of your devices.

I m planning to add json in v0.5 this way you would be able to interface it with this component.

1 Like

Hi there,

Thank you! Meanwhile I did a very crude patch and it seems to work with mqtt_room (WFM).

Add this line to user_config.h:
#define subjectBTtoMQTTRoom "home/BTtoMQTT/room/casa"

And modify ZgatewayBT.ino:

@@ -71,8 +71,11 @@ boolean BTtoMQTT() {
              String mac = onedevice.substring(53,65);
              String rssi = onedevice.substring(66,70);
              String mactopic = subjectBTtoMQTT + mac;
+             float distance = rssi.toInt() / -10.0;
+             String macjson = "{ \"id\": \"" + mac + "\", \"name\": \"" + mac + "\", \"distance\": \"" + String(distance) + "\" }";
              trc(mactopic + " " + rssi);
              client.publish((char *)mactopic.c_str(),(char *)rssi.c_str());
+             client.publish(subjectBTtoMQTTRoom,(char *)macjson.c_str());
              discResult = discResult.substring(78);
              #ifdef ESP8266
               yield();
2 Likes

Great I will try later.

hi
im having problwm to turn off my mqtt binary sensor
here is my yaml config
binary_sensor 2:
platform: mqtt
state_topic: ‘home/433toMQTT’
name: ‘vibration sensor’
payload_on: ‘11238158’
payload_off: ‘11238159’
sensor_class: motion

my 433mhz vibration sensor can only send payload on 11238158

i can see my 433mhz sensor sending payload on to my mqtt sensor
i created automation to turn off the sensor my using mqtt publish after 10 sec the sensor turned on
the automation works as i can see off payload 11238159 in my mqtt server BUT, the sensor state still on
despite payload off being sent to mqtt server via mqtt publish

What is the content of the automation? In what topic does it publish the payload off?

here it is. the automation generated by automation editort:

  • action:
    • delay: 00:00:10
    • alias: turn_off_vibration
      data:
      payload: ‘11238159’
      retain: ‘true’
      topic: ’ home/433toMQTT’
      service: mqtt.publish
      alias: off vibration sensor after 3 min
      condition: []
      id: ‘1503990112630’
      trigger:
    • entity_id: binary_sensor.vibration_sensor
      from: ‘off’
      platform: state
      to: ‘on’

same topic as payload on
\

try this (I’ve never used the automation editor and I find writing my own automation more logical):

- alias: turn_off_vibration
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: binary_sensor.vibration_sensor
      to: 'on'
      for:
        seconds: 10
  action:
    - service: mqtt.publish
      data:
        topic: "home/433toMQTT"
        payload: "11238159"