Hello! I am having trouble with knowing how to send serial ascii data from home assistant to an RS485 input of a device I built.
For many years(about 20), I have been using a home automation system I wrote in Visual Basic. The program kept growing over the years to the point that I needed to make a change for many reasons - too numerous to mention here. In the VB program, I would send data through a USB to RS485 converter, then to a RS485/Ethernet converter and onto the house network. At the other end, I have another RS485/Ethernet converter which then sends the RS485 data to the Mute box. The purpose of the Mute box is to control where audio announcements are heard on different floors of the house. The mute box receives a command such as “SZx1(crlf)” thru “SZx7(crlf)” which the box uses to mute any combination of 3 floors. This worked very well in the VB program so I am trying to switch it to Home Assistant.
I first added the RS485 converter to a USB port on HA and checked in “All Hardware” where I found the ID = “/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A10PF0PH-if00-port0”. I then added to the Yamal-Config file the following:
modbus:
name: Audio_zone
type: serial
method: rtu
port: /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A10PF0PH-if00-port0
baudrate: 9600
stopbits: 1
bytesize: 8
parity: N
I also have the following in the Yamal-config file:
then in Automations, I execute a shell command as:
action: shell_command.audz2
metadata: {}
data: {}
This is what I understood from what I have read on how to do this but, obviously, it doesn’t work. I sure would appreciate any help from someone who can see where I have gone wrong.
Thanks
Thank you for responding to my question. I have never used this forum before so I will take a look at the guidelines for YAML. The only reason I am using Modbus is that I had not found any other way to send data through the RS485 converter. Please let me know if there is. Everything I read said to use Modbus. The device I built just wants “SZx” and the number 1 thru 7 than a Cr Lf in RS485 format.
Thanks for your response. I had not considered using an esphome device because I knew nothing about them. After I read your response, I read up on ESP and will definitely consider the use of that the next time. Right now I would like to get what I have working since it has worked from my Visual Basic program for the past year.
I apologize for PeteRage, he should have provided the link.
The reason for this is that indentation is important! Just because HA accepted the YAML doesn’t mean it’s going to function like you think it should. There are helpful people here that are steeped in YAML/Python code that can spot errors of misindentation where HA cannot.
Hello! As to my dilemma with sending an ascii string out a usb port to my mute box, I have made a number of changes.
I removed Modbus from YAML config. and I changed the shell command to -
If first sets the baud rate and then sends the code. I realize the baud rate only needs to be sent once when the system boots but I don’t think that would be a show stoper.
The shell command is executed as part of an automation as:
This allows me to trun on a light which causes the code to be sent and then speek. The speeking works every time but not the code to the mute box.
Any help would be greatly appreciated.