palakis / esphome-native-hdmi-cec Goto Github PK
View Code? Open in Web Editor NEWHDMI-CEC implementation for ESPHome
License: Other
HDMI-CEC implementation for ESPHome
License: Other
Hello,
First of all thanks for this work !
I'm trying to get a Service in HomeAssistant. So i define this in esphome:
api:
services:
- service: hdmi_cec_send
variables:
cec_destination: int
cec_data: int[]
then:
- hdmi_cec.send:
destination: !lambda 'return cec_destination;'
data: !lambda 'return cec_data;'
but i have this error :
<unicode string>:54:14: error: could not convert 'cec_data' from 'vector<int>' to 'vector<unsigned char>'
Any Idea how i can fix this ?
I have this simple code working and using HomeAssistant to send in...
cec_destination = 0
cec_data = [0x04]
...and its working to get the tv to turn on, but only when the tv is in standby mode. I'd really like to be able to turn the tv on from complete power-cycle as well. I only wired up 2 of the 3 (3rd was said to be optional) wires suggested in your readme. Perhaps 3 might work if the TV knows a device is there?
services:
- service: hdmi_cec_send
variables:
cec_destination: int
cec_data: int[]
then:
- hdmi_cec.send:
destination: !lambda 'return static_cast<unsigned char>(cec_destination);'
data: !lambda 'std::vector<unsigned char> charVector; for (int i : cec_data) { charVector.push_back(static_cast<unsigned char>(i)); } return charVector;'
I can't believe I've been all over the place and can't seem to find a "programmatic solution to turn the tv on and off that is as guaranteed as the IR/RF remote. I was really hoping CEC would be the answer. ๐ข
First of all thank you! This is exactly what I have been looking for. Low cost and easy to set up.
I have been using a Pi Zero W with cec-mqtt-bridge for 7-8 years and that also worked great, but it requires a Pi, an SD card, installing an OS and installing lots on top of that, which isn't ideal. Furthermore, the dependencies recently updated and made it dicfficult to deploy a new Pi zero in my setup.
However, the cec-mqtt-bridge had 3 advantages that I think would be relevant to have with esphome-native-hdmi-cec:
Maybe the last one is already on the to do list and the second one is a convenience thing, but especially the first one is something I would like to achieve. Any idea if this is possible?
Hi,
First off LOVE THIS! after 2 months of screwing around with other options this one worked for me and saved my project!!!
Would it be possible to implement id in esphome. The reason is that I would love to use 3 HDMI CEC outputs.
Let me know hwo to buy you a coffee(tm) for all the hard work.
Very nice library, I'm glad someone refined the work from existing authors.
However, it's not working for me on seeed_xiao_esp32c3
. It reports successfully transmitting frames in the logs, but on my logic analyzer I don't see the pin state change at all. I had the same issue with johnboiles library, and for the longest time, I thought the code just didn't work.
After discovering your library, and seeing that it still did not work for me, I decided to try it on a Waveshare ESP32-S3-Zero with esp32-s3-devkitc-1
and it works fine.
So I am a bit perplexed what is going on, I've double and triple checked my physical connections, verified the pins work by testing other output components the same pin, tried all the pins available on the board, and still no output.
My config is very simple to test:
esphome:
name: basic
esp32:
board: seeed_xiao_esp32c3
framework:
type: arduino
# board: esp32-s3-devkitc-1 # Works for Waveshare ESP32-S3-Zero
# framework:
# type: arduino
logger:
binary_sensor:
- platform: gpio
name: "CEC Send"
pin:
number: GPIO9 # Xiao onboard button
# number: GPIO0 # Waveshare ESP32-S3-Zero onboard button
inverted: true
mode: INPUT_PULLUP
on_press:
hdmi_cec.send:
destination: 0xF # Broadcast
data: [0x36] # "Standby" opcode
external_components:
- source: github://Palakis/esphome-hdmi-cec
hdmi_cec:
pin: GPIO4
address: 0x4
physical_address: 0x1000
Everything seems to be fine in the logs:
[D][binary_sensor:036]: 'CEC Send': Sending state ON
[D][hdmi_cec:204]: sending frame: 4F:36
[D][hdmi_cec:218]: HDMICEC::send(): frame sent and acknowledged
[W][component:237]: Component gpio.binary_sensor took a long time for an operation (53 ms).
[W][component:238]: Components should block for at most 30 ms.
[D][binary_sensor:036]: 'CEC Send': Sending state OFF
But only my S3 will actually output data, the C3 just sits there and pretends to have done something with the line staying high.
In fact, if I put an external pulldown resistor, it actually does something, just junk on when the CEC send is invoked, but it actually does something. So I'm thinking there must be something off with the way the pin is being configured. I tried manually setting some of the pin configuration, like INPUT_OUTPUT_OPEN_DRAIN, etc. but it has no effect - except 'inverted' which results in the error "[E][hdmi_cec:232]: HDMICEC::send(): send failed after five attempts"
Thanks in advance for any pointers as to what may be going on.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.