Skip to content

Latest commit

 

History

History
81 lines (58 loc) · 4.2 KB

README.md

File metadata and controls

81 lines (58 loc) · 4.2 KB

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