I am successfuly controlling my projector. I have a list of shell commands in my configuration.yaml sending HEX codes connected to buttons in lovalce/automations/services/scripts, work like a charm. Here is my appraoch.
However, I need to read some states to be sure my buttons show proper state if my wife turns projector on by remote instead by HA app. In doing so, I guess that I need to send a command to the projector that should respond. The projector has unique codes for this that does not respond with only F or P (fail/pass) but with actual code, eg. āOK1ā for projector being powered on.
When I send a command the same way as I control it, I expect to see some responses on the serial integration but nothing happens there. I am lost here.
Yeah, this is what a command line sensor would do.
You send a command, and the response is the sensor state. Use the value_template to parse the raw response to make the state be what you need it to be.
No success. I am sending commands same way as I do for controlling the projector. I tried both Command line Sensor and Serial Sensor. Then I added an entity to the lovelace and wait for data. In the developer tools, both sensors shows no data.
The documentation of the projector has two kinds of commands you can send to it. First column sends commands to control it and return pass or fail (P or F). The second column has commands that return fail (F) or something particular to give you desired state, in case of projector being powered on, you ask, are you powered on? It returns āOK1ā. This is the reason I tried to send echo as in the case of controlling it. When I tried to control it using some app for serial communication, the app shows these returns. My question is how to read them in HA. I know the projector is responding. I cannot read it by HA
Thatās good. But echo isnāt going to get a reply.
Youāre going to have to figure out how to read replies.
Try opening another terminal and doing tail -f /dev/ttyUSB0. Then send that command and see if the reply comes over that other terminal.
If it does, try to see if you can do a ācatā and maybe the last response will be readable.
Stop the tail -f, then send another command and do a cat /dev/ttyUSB0. If that works, you can append the cat command to the end of your power on command for the response. Itās likely this wont workā¦but worth a shot.
One thing you could do is have a usb reader write to a file, then use a file sensor to parse that file. As long as you only get queries for the power state, it should be straight forward as you can assume the reply is always for āare you powered on?ā
I am totally new to Home Assistant and have scoured every topic I could find on this and have tried various things with no success. I have a an old (but still working perfectly and suits my needs just fine) 12 channel Sonance amp that I use for whole home audio. I have 5 zones: backyard, kitchen, living room, family room and bathroom. I have this all working in another āremote controlā application but I am converting to home assistant and this is the last piece I canāt get working there.
I would like to have 4 buttons for each zone, power on, power off, volume up and volume down. I have the serial commands. I can send them with the previous app I mentioned and it works. I can send them in a putty TCP session and it works. But I cannot figure out how to get a script built to send the same.
Example commands:
zone 2 power on :Z21\x0D hex version: 3a 5a 32 31 0d
zone 2 power off :Z20\x0D hex 3a 5a 32 30 0d
zone 2 volume up: :V2++\x0D hex 3a 56 32 2b 2b 0d
zone 2 volume down :V2ā\x0D hex 3a 56 32 2d 2d 0d
In Putty, it only works without the carriage return, but Iām hitting enter to trigger it.
The commands are sent to a global caceh itach ip2sl device and then via serial cable to the amp.
ip address is 192.168.1.114 and port 4999.
This topic seems about the closest to what Iām doing and is the most recent.
My vision for this is to have a Card with the media player at the top and the 4 control buttons at the bottom and to be able to short press the respective button. There are freedbacks with volume that could be used for a slider, but thatās not super important to me.
Any help or a point to a method would be very helpful
Hi,
happy to help. I havenāt figured out the problem of reading the commands. It was not super important for me and HA is simply a rabbit whole you can spent rest of your life. Thanks for @jocnnor for his idea but I still need to find some time to move on.
Regarding your question. I am doing exactly what you need. I believe that the solution I found is the most straitforward. Maybe I tuned it a bit to make it even easier.
The power on uses input boolean you can create in HA/configuration. If my wife uses Siri, it keeps the state of the projector. If she uses IR remote control, I need to manually change the state but thatās detail. Dynamic Black is another input boolean. All other buttons are just simple ācustom-buttonā sending a command.
The rest is probably written in my other topic. Check it out and if it is not enough for you, come back. I will check whether I modified something since then.
I really appreciate the response. Like you said, HA is a never ending rabbit hole. Itās frustrating in that I can send successful commands using an app that already works, the testing software provided by global cache for the itach ip2sl device, and Putty via telnet, but canāt do it (YET) with HA.
Iāve added a basic card for testing that looks like this:
I do have a USB to serial cable but have not tried the method you used for your projector of connecting the Pi4 directly to my amp. That requires some physical movement, relocating my pi to nearby the amp.
Itās baffling to me as a telnet session with putty sending just the plain text :Z21 to the ip/port triggers the zone 2 of the amp to come right on. Iād love to be able to replicate that with an HA button.
Ok. In my currently working setup I am using a 3rd party piece of hardware to tcp to serial communications. Itās from global cache, called itach ip2sl. I takes raw TCP commands and then communicates those to my amp via serial cable. So I can use a telnet to this device to send the commands on to my amp as well.
I have a usb to serial cable available so I have now moved my pi close to my amp and connected them. I see the serial info in the system hardware:
Have you been successful? When it comes to the proper syntax of the command, I was more successful in looking on general forums related to the topic rather than to forums of HA. Then, Roger, the guy who developed the software I used for testing (I am mentioning him in the other topic where I discussed the solution) was also very helpful but finally his software learnt me how to properly write the syntax
No success so far. Iām at a loss of how to trouble shoot further. Frustrating as Iām not seeing where the breakdown is. My only thinking is that the usb to serial connection requires some setup for baud rate, parity, etc. Iām not sure of a way to configure that.
Iāve continued to tinker with using telnet with netcat but will see if I can do some more tinkering with the direct connection.
I spent some hours to figure out the problem in the title of this topic: send command, read response. No success. There is definitely a way to have a sensor reading the device on the address but that should be able to read even success when I am sending commands to DLP projector when I am turning it on, which works. Sensor does not read that.
In your case. I did not set anything on the baud rate etc., I kept the defaults and it works. However, the telnet solution must be easy. What about some firewall on your router? Keep these barriers in mind as well
Hi SeldomSeen31 and for anyone else with a DAB1 - Sonance that they do not want to throw away
For me, my DAB1 is using 19200 baud rate, so I just needed to set the port speed (defaults to 9600) using stty -F /dev/ttyUSB1 19200