Github Devices Community Docs Blog

Adafruit ESP8266 Feather for IR gateway?

Can anyone comment if the Adafruit ESP8266 Feather board is compatible with OMG?

I have been trying to replicate a Homeassistant IR gateway but I’m struggling.

The IR_EMITTER_PIN is set to be D0 or GPIO16. Since GPIO16 is also wired to the RTS LED I would expect the onboard LED (Red) to flash when I send a message. Is this correct?

I am trying to use the HIVEMQ package inside of Home Assistant.

I do see the OMG responses but I have not been able to flash the IR EMITTER LED and I don’t know why (3.3V should flash just as well as a 5V system correct?).

To send a message via HA I am using a topic of…
home/OpenMQTTGateway/commands/MQTTtoIR
and a message of
-m ‘{“value”:551489775}’

which should generate a NEC command.

I’ve given up on using the capture feature as I ran into trouble there when I realized that the Vishay TSOP44/48 IR receivers have the power connection swapped compared to the TSOP22/24 versions. My 44 version chip became real hot…

Thanks in Advance!

Hello

Yes it should be compatible.[quote=“68hc11, post:1, topic:723”]
The IR_EMITTER_PIN is set to be D0 or GPIO16. Since GPIO16 is also wired to the RTS LED I would expect the onboard LED (Red) to flash when I send a message. Is this correct?
[/quote]

Yes it should flash.
Could you post the begining of serial minitor output ?
Could you give the version of omg used ?
If it is v0.9.2 i suggest you to test with v0.9.3 beta.

Using the Ardunio IDE I get the best details, more than I see in Home Assistant HiveMQ…

I think my true struggle is how to actually send a message to OMG?

From Hive MQ after connection,
for Topic I enter

home/OpenMQTTGateway/commands/MQTTtoIR

and for message to OMG I put

-m '{"value":551489775}'

but I see no action?

I also have the IDE environment & MQTT Dash if sending from those environments is better but I am assuming my command is not quite right?

Thanks!

This is from V92 but I can try V93 if need be…

WM: [2] Connection result: WL_CONNECTED
*WM: [3] lastconxresult: WL_CONNECTED
*WM: [1] AutoConnect: SUCCESS
*WM: [1] STA IP Address: 192.168.1.225
connected…yeey :slight_smile:
saving config
{“mqtt_server”:“192.168.1.219”,“mqtt_port”:“1883”,“mqtt_user”:“MOSQTO”,“mqtt_pass”:"*****"}*WM: [3] freeing allocated params!
*WM: [3] unloading
OpenMQTTGateway mac:
84:F3:EB:5B:04:F1
OpenMQTTGateway ip:
192.168.1.225
1883
Connecting to MQTT by IP adress
192.168.1.219
IR_EMITTER_PIN
16
IR_RECEIVER_PIN
2
ZgatewayIR setup done
MQTT_MAX_PACKET_SIZE
1024
Setup OpenMQTTGateway end
client disconnected
MQTT connection…
failure_number
1
failed, rc=
-4
try again in 5s
MQTT connection…
Connected to broker
Subscription OK to the subjects
00:26:38.132 -> Uptime (s)
00:26:38.132 -> 120
00:26:38.132 -> omgStatusDiscovery
00:26:38.132 -> Pub json into:
00:26:38.132 -> homeassistant/binary_sensor/84F3EB5B04F1/config
00:26:38.132 -> {“stat_t”:“home/OpenMQTTGateway_ESP8266_IR/LWT”,“name”:“OpenMQTTGateway_ESP8266_IR”,“uniq_id”:“84F3EB5B04F1”,“dev_cla”:“connectivity”,“pl_on”:“online”,“pl_off”:“offline”,“pl_avail”:“online”,“pl_not_avail”:“offline”,“device”:{“name”:“OpenMQTTGateway_ESP8266_IR”,“manufacturer”:“OMG_community”,“sw_version”:“0.9.2”,“identifiers”:[“84F3EB5B04F1”]}}
00:26:38.132 -> gatewayIRDiscovery
00:26:38.132 -> CreateDiscoverySensor
00:26:38.132 -> gatewayIR
00:26:38.132 -> Pub json into:
00:26:38.179 -> homeassistant/sensor/84F3EB5B04F1gatewayIR/config
00:26:38.179 -> {“stat_t”:“home/OpenMQTTGateway_ESP8266_IR/IRtoMQTT”,“name”:“gatewayIR”,“uniq_id”:“84F3EB5B04F1gatewayIR”,“val_tpl”:"{{ value_json.value }}",“device”:{“name”:“OpenMQTTGateway_ESP8266_IR”,“manufacturer”:“OMG_community”,“sw_version”:“0.9.2”,“identifiers”:[“84F3EB5B04F1”]}}
00:26:38.179 -> {“uptime”:120,“freeMem”:37800,“rssi”:-58,“SSID”:“BMF”,“ip”:“192.168.1.225”,“mac”:“84:F3:EB:5B:04:F1”,“modules”:“IRHADiscovery”}
00:28:38.132 -> Uptime (s)
00:28:38.132 -> 240

There was a lot of improvment with v0.9.3beta regarding IR management, if you can check with this version it would be better.
Once updated to v0.9.3beta when you send your command:
home/OpenMQTTGateway/commands/MQTTtoIR
-m '{"value":551489775}'

You should see it coming in the serial monitor.

Well using 93beta IR I do see more messages now. I still don’t see the RED LED flash or seem to have output on GPIO16

15:29:42.720 -> Connecting to MQTT by IP adress
15:29:42.720 -> 192.168.1.219
15:29:44.220 -> IR_EMITTER_PIN
15:29:44.220 -> 16
15:29:44.220 -> IR_RECEIVER_PIN
15:29:44.220 -> 2
15:29:44.220 -> ZgatewayIR setup done
15:29:44.220 -> MQTT_MAX_PACKET_SIZE
15:29:44.220 -> 1024
15:29:44.220 -> Setup OpenMQTTGateway end
15:29:44.454 -> MQTT connection…
15:29:44.454 -> Connected to broker
15:29:44.454 -> Subscription OK to the subjects
15:30:27.347 -> Hey I got a callback
15:30:27.347 -> -m ‘{“value”:551489775}’
15:30:27.347 -> SendId prt

So while I was handling the ESP8266 I may have done something?

15:37:43.409 -> home/OpenMQTTGateway/SYStoMQTT
15:37:43.409 -> {“uptime”:120,“freeMem”:39448,“rssi”:-46,“SSID”:“BMF”,“ip”:“192.168.1.225”,“mac”:“84:F3:EB:5B:04:F1”,“modules”:“IRHADiscovery”}
15:37:43.456 ->
15:37:43.456 -> Exception (2):
15:37:43.456 -> epc1=0x3ffed3f8 epc2=0x00000000 epc3=0x00000000 excvaddr=0x3ffed3f8 depc=0x00000000
15:37:43.456 ->
15:37:43.456 -> >>>stack>>>
15:37:43.456 ->
15:37:43.456 -> ctx: sys
15:37:43.456 -> sp: 3fffedb0 end: 3fffffb0 offset: 01a0
15:37:43.456 -> 3fffef50: 00000002 00000000 00000020 4010135e

what would be the simplest command to flash GPIO16 (and red LED)?

Thanks!

Could you post a picture of your setup so as to see the different connection?

This is very strange, could you try to reset the board and/or erase the flash?

So I pulled my 3 wires to the IR Emitter.

It looks like the crash is related to the 2 minute status update…

16:16:24.820 -> Uptime (s)
16:16:24.820 -> 120
16:16:24.820 -> omgStatusDiscovery
16:16:24.820 -> Pub json into:
16:16:24.820 -> homeassistant/binary_sensor/84F3EB5B04F1/config
16:16:24.820 -> {“stat_t”:“home/OpenMQTTGateway/LWT”,“name”:“OpenMQTTGateway”,“uniq_id”:“84F3EB5B04F1”,“dev_cla”:“connectivity”,“pl_on”:“Online”,“pl_off”:“Offline”,“pl_avail”:“Online”,“pl_not_avail”:“Offline”,“device”:{“name”:“OpenMQTTGateway”,“manufacturer”:“OMG_community”,“sw_version”:“0.9.2beta”,“identifiers”:[“84F3EB5B04F1”]}}
16:16:24.820 -> gatewayIRDiscovery
16:16:24.820 -> CreateDiscoverySensor
16:16:24.820 -> gatewayIR
16:16:24.820 -> Pub json into:
16:16:24.820 -> homeassistant/sensor/84F3EB5B04F1gatewayIR/config
16:16:24.867 -> {“stat_t”:“home/OpenMQTTGateway/IRtoMQTT”,“name”:“gatewayIR”,“uniq_id”:“84F3EB5B04F1gatewayIR”,“val_tpl”:"{{ value_json.value }}",“device”:{“name”:“OpenMQTTGateway”,“manufacturer”:“OMG_community”,“sw_version”:“0.9.2beta”,“identifiers”:[“84F3EB5B04F1”]}}
16:16:24.867 -> {“uptime”:120,“freeMem”:39448,“rssi”:-48,“SSID”:“BMF”,“ip”:“192.168.1.225”,“mac”:“84:F3:EB:5B:04:F1”,“modules”:“IRHADiscovery”}
16:16:24.867 -> Pub json into:
16:16:24.867 -> home/OpenMQTTGateway/SYStoMQTT
16:16:24.867 -> {“uptime”:120,“freeMem”:39448,“rssi”:-48,“SSID”:“BMF”,“ip”:“192.168.1.225”,“mac”:“84:F3:EB:5B:04:F1”,“modules”:“IRHADiscovery”}
16:16:24.914 ->
16:16:24.914 -> Exception (2):
16:16:24.914 -> epc1=0x3ffed420 epc2=0x00000000 epc3=0x00000000 excvaddr=0x3ffed420 depc=0x00000000
16:16:24.914 ->
16:16:24.914 -> >>>stack>>>
16:16:24.914 ->
16:16:24.914 -> ctx: sys
16:16:24.914 -> sp: 3fffedb0 end: 3fffffb0 offset: 01a0
16:16:24.914 -> 3fffef50: 00000002 00000000 00000020 4010135e

And you don’t had that before(no error at 120s), if I understand well ?
PS : it seems you are still in v0.9.2beta.

To begin little by little you could use only ZactuatorONOFF and try to switch on a led on your board.

This should not appear in the callback, you should see only :
{“value”:551489775}

I think you don’t need -m with hiveMQ. Maybe try to search some example on how posting json with hiveMQ.

I will look into json.

I did reflash the ESP8266 again & cleared the flash first, same reaction.

Correct using 9.2 release did work properly reporting status every 2 minutes.

So the 9.2 beta is what I get when I downloaded nodemcuv2-ir-firmware.bin so I was assuming that was just a typo?

So digging into JSON I found I wasn’t properly formatted. The white spaces weren’t correct.

{ “value” :551489775 }

appears to work & I see my IR LED actually working!

If I revert back to 9.2 it doesn’t work so I guess I need to wait on 9.3 release (or figure out why I seem to be running 9.2beta?).

Thanks for the help so far!

ah ha! The gateway name changes between the 2 software versions!

home/OpenMQTTGateway_ESP8266_IR/commands/MQTTtoIR
vs
home/OpenMQTTGateway/commands/MQTTtoIR

so now I’ve gotten 9.2 to work as well.

Thanks for the support, I’ve learned a bunch so far!

I think it is a typo and you are running the v0.9.3beta with the link provided, i forgot to update test_config.h file…

Do you still get your error message at 120s with the last version ?

Yes the v0.9.3beta still seems to crash when it processes the 2 minute update. v0.9.2 functions for me.

I am able to manually trigger the ESP8266 using the Home Assistant HiveMQ publish but I have not been able to configure it in the yaml to work as of yet. Will try to use the IDE monitor function too.

switch:
platform: mqtt
name: masterbedmoodlamp
state_topic: “home/OpenMQTTGateway_ESP8266_IR/commands/MQTTtoIR”
command_topic: “home/OpenMQTTGateway_ESP8266_IR/commands/MQTTtoIR”
payload_on: { “value” :16712445 }
payload_off: { “value” :16712445 }
qos: “0”
retain: true

So this works for me, now to add automation & random color picker…

name: masterbedmoodlamp
state_topic: “home/OpenMQTTGateway_ESP8266_IR/commands/MQTTtoIR”
command_topic: “home/OpenMQTTGateway_ESP8266_IR/commands/MQTTtoIR”
value_template: ‘{{ value_json.state }}’
payload_on: ‘{ “value” :16712445 }’
payload_off: ‘{ “value” :16712445 }’
state_on: “ON”
state_off: “OFF”
optimistic: false
qos: “0”
retain: true

1 Like