GithubHelp home page GithubHelp logo

nicolaus-hee / esp8266-benq-rs232-mqtt Goto Github PK

View Code? Open in Web Editor NEW
34.0 1.0 5.0 2.5 MB

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

C++ 100.00%
esp8266 esp8266-projects mqtt rs232-to-ttl benq arduino rs232 openhab

esp8266-benq-rs232-mqtt's Introduction

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

esp8266-benq-rs232-mqtt's People

Contributors

nicolaus-hee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

esp8266-benq-rs232-mqtt's Issues

ESP8266 firmware available?

Hello! This project looks 90% perfect for my application, but I need to control the projector with OSC rather than MQTT. I could bridge them, but trying to avoid another protocol for this one device. Is the source to the firmware available so I can take a stab at adding OSC? I'm envisioning using the same commandTopic forms, but adding an OSC listener that can receive them directly.

Home Assistant Integration?

This may be a stupid question so I apologize if it is.

Because this publishes MQTT messages, would that mean they could be picked up and used by Mosquito in Home Assistant?

Thank you

Bug in volume counter

void benq_set_volume(int target_volume) {
...
  for(int i = 0; i <= abs(delta); i++) {
...
}

should be:

void benq_set_volume(int target_volume) {
...
  for(int i = 1; i <= abs(delta); i++) {
...
}

Otherwise volume will go crazy with automation in Home Assistant, and it alway switch to 0 to 2 etc...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.