Hi, right now I’m trying to integrate my denon rs232 control into esphome.
The current state is a custom arduino app with rest calls, and some additional home assistant config for a volume slider etc.
I’ve read for esphome i can use the uart platform for rs232 communication.
What I already have would be switching inputs via uart.
What I want to do is to create a light in esphome
Use On/Off for switching on/off my denon
and using the brightness slider of the light for writing volume values via uart
If that is somehow possible. (I guess this would be the only option for a custom slider control via esphome atm)
The light component in esphome has no uart. So I assume I would have to do something with an automation, when light is one eg write something to uart !?
Does anyone have any ideas how I could implement this?
httpServer.on("/Denon/Volume",HTTP_GET,[](){
int message = 20;
if(!(httpServer.arg("MV")== "")){
message = atoi(httpServer.arg("MV").c_str()); //Gets the value of the query parameter
//Save value
if((message >= 20)&&(message <=60)){
Serial.print("MV"+String(message)+"\r");
}
}
httpServer.send(200, "text/plain", "OK");
});
Thanks. That looks good for the next step. Right now I still struggle to get proper volume controls via uart. Basically I’m looking for some kind of interval mapping
Over Uart I have to send MV for the volume
In the example code above (old app, not esphome) I have set a custom range that goes from 20 to 60 where I set a value inbetween via rest call.
In Esphome I want something like:
When brightness of lightbulb changes, get the percentage e.g
50%
that would be (60-20)*0,5 + 20 = 40 as volume (so MV40 via uart)
when having e.g 60% volume → (60-20)*0,6 + 20 = 44 as volume
Then write the value I’ve got this way via uart.
Maybe this is somehow doable via custom light platform
I sadly didn’t get the lightbulb brightness slider working for volume controls, the functionality is now on simple switches. But yeah it works for use in automations.
In case anyone needs it, here’s the code
Can you give more details on how you have the AVR wired up. I can read status from a Denon AVR but cannot Write. I have read in places that pin one on the rs232 needs to be grounded to the chassis.
Have you ever got it to work ? I currently have a raspberry pi with a usb to rs232 cable connected via node-RED and MQTT which works like a charm. But would be great to remove the complexity and only use a ESP32