433mhz, infrared IR to and from MQTT on ESP8266

Can you elaborate on expected and actual behaviors?

It’s turning the lights on each time the gateway reboots?
This would be normal if MQTT messages are published with retain flag as each time gateway reboots is sending the on payload.

Or is it that the lights are on only when pushing the physical remote button/turning on from HA, then off immediately?
If you are using one light and one switch button then you need to have an off command posted in the same topic the on payload is included (something like “13981488off” or “13981489”; it has to be a code that is not posted by a 433 Mhz physical device) - have a look on posting no. 299 that refers to an automation for posting an off payload for PIR sensor. A switch would not need off payload after a certain number of seconds but rather with the next button press should post the off payload (toggle functionality).

Then, what is the functionality for the physical lights relay?
433 Mhz relays have 3 modes of operating: 2 modes (momentarily/doorbell type and toggle with one button remote) and a third one (latched) with two physical 433 Mhz remotes (press button X results in on, press button Y then off).

never tested but by just choosing Adafruit Huzzah on arduino ide when uploading it should work

It’s turning the lights on each time the gateway reboots
I think that retain flag is the reason, what I need is keeping the light as it was, gateway reboot don’t change the status

By the way anyone know which app can make Android phone to ibeacon? I used ibeacon emulator but every restart the app the macaddr change, so I can’t track it in HA through fake HM-10 module

Today the fake HM-10 module cause the nodemcu reboot randomly as @Petrica

Ah. Yes. I wasn’t looking at the whole error.

So, new issue: Cloning the repo doesn’t seem to bring the required libraries with it. What am I doing wrong here? Do I just have to install each library individually?

@1technophile, just wondering if you or someone else did a PCB for openmqttgateway so you could easily plug the IR/RF/BLE? Thanks!

Haven’t heard about that, it’s on my long list :slight_smile:

1 Like

the libraries should be placed on your arduino library folder, have you done that?

What is the error you get?

The error was “file not found” and I think the file was NewRemoteSensor.h or something.

I just git cloned https://github.com/hjgode/homewatch and moved all the contents of /homewatch/arduino/libraries to my Arduino/libraries folder. That cleared that up.

So I managed to upload it to the Huzzah. My problem now is that I’m not sure which pins I need to use and/or if I need to change one of the RF_RECEIER_PIN values in config_RF.h

I mean, GND and 3V were pretty easy to figure out.

It IS connected to the LAN for sure. So I’ve got that.

I don’t think it will work, you should better download all the libraries located into the libraries folder of openmqttgateway and place them into arduino library folder

Regarding the PIN just follow the documentation, if you don’t use RFM69 or I2C the following wiki doc will help you:

Arduino:
(https://github.com/1technophile/OpenMQTTGateway/wiki/Setup-Arduino)

ESP8266
(https://github.com/1technophile/OpenMQTTGateway/wiki/Setup-ESP8266)

V0.4-beta is out

This release add several gateways and sensors to the mix:

  • RFM69 bidirectional gateway, enable now to talk to moteino and other RFM69 based devices with the RFM69 advantages; long range, acknowledgment, encryption. This gateway is based on the work of @bbx10
  • I2C sensor support thanks to the work of @hannesdi
  • Over The Air update thanks to the work of @PatteWi
  • RF with KAKU protocol supported when sending MQTTtoRF2, thanks to the newremoteswitch library from @fuzzylogic
  • support now new IRRemote_ESP8266 library 2.x.x
  • HM-11 is now supported added to HM-10
  • I divided user_config.h into one config file per gateway/sensor so as to avoid taking all the parameters when using only parts of the gateway

This is a beta version, testers are welcome.

(https://github.com/1technophile/OpenMQTTGateway/releases)

1 Like

@Petrica im trying to create an automation to there takes sensor state and publish at to mqtt in json format
but i can’t find a way to publish a mqtt message.this will be working?

data_template:
  topic: "wc/switch/bulb/set/command/"
  payload:{"id": "123testid", "name": "Test Device", "distance": 5.678}

So I got it working with the Adafruit Feather Huzzah.

Here’s the hitch: I am only using the RF receiver module. No transmitter, no IR, no DHT. Mostly because I don’t have a need for all those other things at the moment, but also because the Huzzah is kind of a strange board. There seems to be no rhyme or reason to the order of the pins. For example, there is a Pin 0 and a Pin 2, but no Pin 1. So I had to comment out the IR component and change the RF_RECEIVER_PIN to 2 instead of 1. That’s the first way I found to make it work, and I stuck with it.

Now my problem is that these cheap door sensors only go one way. How do I reset the state of a binary sensor?

here it is from @Petrica

- 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"

Ah. I was looking at the wrong file, thinking I could do it from configuration.yaml. This makes sense though.

What’s a little weird about this is you can make the exact same payload_off code for each door sensor. Makes it easy to keep track of, I guess. It just seems like it would be a bad idea. :man_shrugging:

Thanks!

@jxjhheric
In addition to the right message you need to ensure also that posting is made to the correct topic. What type of switches and lights are you using? The topic seems a little confusing as you have named your topic switch and bulb & set and command. Is it the topic for the lights or for the switches?
Try to find what topic and payload combination work from command line then use that for the automation:
mosquitto_pub -h 192.168.x.y -t “wc/switch/bulb/set/command” -m ‘{“id”: “123testid”, “name”: “Test Device”, “distance”: 5.678}’
Use mosquitto_sub to verify what is posted and where (mosquitto_sub -h 192.168.x.y -t “wc/switch/bulb/set/command”). You can also use wildcards (mosquitto_sub -h 192.168.x.y -t “wc/switch/bulb/set/#” or mosquitto_sub -h 192.168.x.y -t “wc/switch/bulb/#”, etc.)
Refer to MQTT component for details on state, command and availability:


Also, a number of changes have been introduced in v.0.52 (refer to Breaking Changes section for MQTT switch in regard of the availability):

@teslas_moustache
You could include it into configuration.yaml but with a large number of components and automation things are going to get really scary. You can create a folder named “automation” inside “.homeassistant” folder. Inside “automation” create files (with “.yaml” extension) where you write each automation. Then in configuration.yaml include the following (make sure all the automation goes to this folder and do not remain inside configuration.yaml as you will get duplicate names):
automation: !include_dir_merge_list automation/

Look for splitting other components of the configuration.yaml into smaller parts:

that’s for mqtt_room component,

the topic: “wc/switch/bulb/set/command/” should be" home/BTtoMQTT/macaddr"

i test -m ‘{“id”: “123testid”, “name”: “Test Device”, “distance”: 5.678}’,work in developer tools mqtt page,

i have no idea how to write them in automation, the format is always wrong :sob:

What automation are you trying to set? (meaning what is the desired functionality)

as what you said above ,i try to set when thresholdbtdevice1 sensors is on , mqtt publish {“id”: “123testid”, “name”: “Test Device”, “distance”: 5.678}, so mqtt_room component can tracker my loction

in short ,i want to use ble in opengateway to work with mqtt_room component in ha

sorry about my poor English

Try this:

- alias: Automation_Test1
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: binary_sensor.thresholdbtdevice1
      to: 'on'
  action:
    - service: mqtt.publish
      data:
        topic: "home/BTtoMQTT/macaddr"
        payload: '{“id”: “123testid”, “name”: “Test Device”, “distance”: 5.678}'