nicolaus-hee / esp8266-benq-rs232-mqtt

Control a BenQ TH530 projector via its RS232 interface with an ESP8266, MQTT and openHAB.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

esp8266-benq-rs232-mqtt

Objective: Control this BenQ TH530 projector via its RS232 interface with an ESP8266, MQTT and openHAB.

Features

ℹ️ Read power / source / volume status
πŸ’‘ Read lamp mode & hours
⚑ Trigger power (on/off) commands
πŸ“Ί Trigger source changes (HDMI etc.)
πŸ”‡ Change volume or mute
πŸƒ Change lamp mode
πŸ“£ Publish status updates via MQTT
πŸ‘‚ Listen for MQTT commands
πŸ‘‰ Send custom commands via MQTT
πŸ’¬ Respond to custom commands via MQTT

Installation

1️⃣ Required hardware

  • ESP8266 (I used a Wemos D1 Mini)
  • RS232 to TTL converter with female DB9

2️⃣ ESP8266 and RS232 to TTL converter

  1. Wire ESP8266 and RS232 to TTL converter.
    (ESP β†’ TTL)
    G β†’ GND
    5V β†’ VCC
    D4 β†’ TXD
    RX β†’ RXD
  2. Add your MQTT broker & WiFI credentials to the esp8266-benq-rs232-mqtt.ino sketch, then flash it to your board.
  3. Plug the DB9 connector to the RS232 port of the projector.

βœ… Your ESP will now publish projector status MQTT messages and listen for commands.

3️⃣ openHAB (optional)

  1. Make sure you have the JsonPath transformation service, MQTT binding and a MQTT broker installed.
  2. Create a new Generic MQTT thing, choose 34c510f090:20807f1aae as the identifier.
  3. Edit the new thing, paste the contents of benq_thing.yaml in the 'Code' tab and save.
  4. Place benq.items in your openhab-conf/items folder (e.g. /etc/openhab/items)
  5. Place benq.sitemap in your openhab-conf/sitemaps folder or paste the contents to your existing sitemap.

βœ… You can now control the projector using the openHAB GUI.

OpenHAB projector channels

OpenHAB sitemap

4️⃣ Google Assistant via openHAB (optional)

  1. Complete the openHAB steps above.
  2. Connect your openHAB instance to the openHAB Cloud connector.
  3. Expose the newly created projector items to the openHAB Cloud (Settings β†’ openHAB Cloud β†’ Items to Expose).
  4. Ask Google Assistant to "Talk to openHAB" to link your openHAB Cloud account to your Assistant.

βœ… A TV device will appear in your Google Home app and you can now control the projector via the app or with voice commands such as "mute my TV".

Google Home app, room view

Google Home app, device view

Google Home app, assistant dialogue

MQTT implementation

stat topics are published by the module and contain status messages. cmnd topics are used to execute commands on the projector.

Topic Payload Comment
stat/projector/STATUS {"POWER":"ON","SOURCE":"HDMI","VOLUME":4, "LAMP_MODE":"ECO","LAMP_HOURS":105,"MUTE":"OFF"} Every 5 seconds
cmnd/projector/POWER ON, OFF Power on / off
cmnd/projector/SOURCE HDMI, SVID, VID, RGB, RGB2 Set source
cmnd/projector/VOLUME 0...10 Set volume
cmnd/projector/MUTE ON, OFF (Un)mute
cmnd/projector/LAMP_MODE LNOR, ECO, SECO, SECO2 Set lamp mode
cmnd/projector/COMMAND See BenQ docu, e.g. VOL=?
stat/projector/COMMAND {"COMMAND":"...","RESPONSE":"..."} Returns result of above

About

Control a BenQ TH530 projector via its RS232 interface with an ESP8266, MQTT and openHAB.


Languages

Language:C++ 100.0%