ESP8266 based gateway between MQTT and IR. Use with PlatformIO. Works with ESP-01 (debug mode have to be disabled in globals.h)
- Receiving of IR transmission and publish it as MQTT messages
- Receive MQTT messages and send IR signal (multiple formats supported - NEC, RC5, LG, SONY, Global Cache )
- Storing raw IR messages on flash and transmitting via IR
- Constant current IR LED emitter circuit (based on Analysir schematic )
##Used librariers
- IRremoteESP8266 - https://github.com/markszabo/IRremoteESP8266/
- ArduinoJson - https://github.com/bblanchon/ArduinoJson
- PubSubClient - https://github.com/knolleary/pubsubclient
- WiFiManager - https://github.com/tzapu/WiFiManager
##Installation
###GPIO connections:
GPIO WEMOS | GPIO ESP01 | Usage |
---|---|---|
13 | 0 | IR receiver |
14 | 3 (Uart RX) | IR LED - connected via simple transistor amplifier |
15 (to +3,3V) | 2 (to GND) | Button - used for reset configuration |
2 (Weomos buildin) | not used | LED |
###BOM
- D1,D2 - 1N4148
- Q1 - NPN transistor
- IR1 - IR receiver
- IR LED1, IR LED2 - Infrared LED_PIN
- R1 - 3.3kΩ
- R2 - 2.5Ω
###Compilation and firmware uploading
TODO
##Usage
TODO
Property | Message format | Description | Example |
---|---|---|---|
_mqtt_prefix_/sender/storeRaw/_store_id_ | \d+(,\d+) | store raw codes sequence in slot no. _store_id_ | Topic: "_mqtt_prefix_/sender/storeRaw/10" Message: "32,43,54,65,32" |
_mqtt_prefix_/sender/sendStoredRaw | \d+ | Transmit via IR RAW code from provided slot | Topic: "_mqtt_prefix_/sender/sendStoredRaw" Message: "1" |
_mqtt_prefix_/sender/sendStoredRawSequence | \d+(,\d+)* | Transmit via IR sequence of RAW codes from provided slots | Topic: "_mqtt_prefix_/sender/sendStoredRawSequence" Message: "1,2,3" |
_mqtt_prefix_/sender/cmd | (ls|sysinfo) | Execute on device command, replay in topic _mqtt_prefix_/sender/cmd/result | Topic: "_mqtt_prefix_/sender/cmd" Message: "sysinfo" |
_mqtt_prefix_/sender/rawMode | (1|ON|true|.*) | Turn on/off reporting to controller received by device IR raw codes | Topic: "_mqtt_prefix_/sender/rawMode" Message: "1" |
_mqtt_prefix_/wipe | .* | Wipe configuration for next boot | Topic: "_mqtt_prefix_/wipe" Message: "1" |
_mqtt_prefix_/sender/(RC_5|RC_6|NEC|SAMSUNG|SONY|LG)/(\d+) | \d+ | Send IR signal based on type | Topic: "esp8266/02sender/RC_5/12" Message: "3294" |
_mqtt_prefix_/sender/sendGC | \d+(,\d+) | Send Global Cache code | Topic: "_mqtt_prefix_/sender/sendGC" Message: "32000,43,54,65,32,...." |
Property | Message format | Direction | Example |
---|---|---|---|
_mqtt_prefix_/sender/cmd/result | .* | Result of command | |
_mqtt_prefix_/receiver/_type_/_bits_/_panas_addr_ | \d+(,\d+)* | Send to controller received IR code | Topic: "_mqtt_prefix_/receiver/RC_5/12" Message: "3294" |
- Run MQTT server (mosquitto is fine)
- Configure MQTT server for OpenHab transport
- Register IR Transceiver to the same MQTT server
- Example items configuration:
Group gIR <own_ir> (All)
Switch ir_philips_on
"Philips Power" <own_ir> (gIR)
{mqtt=">[mosquitto:esp8266/02/sender/RC5/12:command:ON:56]", autoupdate="false"}
Switch ir_philips_volp
"Vol+" <own_ir> (gIR)
{mqtt=">[mosquitto:esp8266/02/sender/RC5/12:command:ON:1040]", autoupdate="false"}
Number ir_in_lg
"LG IR command [%d]" <own_ir> (gIR)
{mqtt="<[mosquitto:esp8266/02/receiver/NEC/32:state:default]"}
- Using in rules:
rule lgTVturnInfoScreen
when
Item ir_in_lg received update 551549190
then
// Do somenting after button press
end
rule initIRmodule
when
System started
then
// Turn off Philips after system start
postUpdate(ir_philips_on,OFF)
// Switch LG TV to HDMI 1
publish("mosquitto","esp8266/02/sender/sendGC","38000,1,69,343,172,21,22,21,22,21,65,21,22,21,22,21,22,21,22,21,22,21,65,21,65,21,22,21,65,21,65,21,65,21,65,21,65,21,22,21,65,21,65,21,65,21,22,21,22,21,65,21,65,21,65,21,22,21,22,21,22,21,65,21,65,21,22,21,22,21,1673,343,86,21,3732")
end