I have several command line switches configured. I use them in a custom way. Some are a normal on off where as some are simply used to run 1 command using the on button and a separate command that is run by the off button. This has allowed me to create some custom switches to do what I want using command line. These are almost all completely IP control to operate either a TV or a Yamaha Receiver. I will show some examples as I go along.
This first photo shows a card I use in my master Bedroom for TV operations:
Power off is a simple On and Off button used
Apple TV / TiVo is an HDMI input 1 and 2; Off = Apple TV (HDMI 1) and On = Tivo (HDMI 2)
Sleep 30 /60 is: Off = 30 min Sleep timer ; On = 60 min Sleep timer
Sleep 90 /120 is: Off = 90 min Sleep timer ; On = 120 min Sleep timer
I wanted to help all understand how I use some of these command line switches to accomplish my goals.
The above card works 100% as I need and want it to without need for anything. It is simply an example to help communicate how I use it which comes into play with the following.
I am about to show you my Sirius Presets card I use. The first photo I will show is completely with everything showing off. Instead of using the on off for two separate lightning bolts (one for off and one for on) I am using a toggle on/off by using assumed_state: false within the switch in the customization file. I will follow the photo with a detailed explanation of its use:
Sirius All Off:
Here is an example of the power command line switch and the 1st preset:
command_on: echo -e "@MAIN:PWR=Standby" | nc 192.168.xxx.xxx 50000
command_off: echo -e "@MAIN:PWR=On" | nc 192.168.xxx.xxx 50000
friendly_name: Power Off
command_on: echo -e "@SIRIUSXM:PRESET=1\r\n" | nc 192.168.xxx.xxx 50000
command_off: echo -e "@SIRIUSXM:PRESET=1\r\n" | nc 192.168.xxx.xxx 50000
friendly_name: 80's on 8
The power switch has two separate commands: one for on and off.
The SiriusXM presets are the same command whether using on or off for a single preset SiriusXM channel. I have a total of 7 Presets and the one Power button.
The power button works exactly how I want with no suggestions needed. I simply turn it on or off and the toggle will represent its proper state.
It is with the Presets which I seek ideas or suggestions from the community. When I toggle a preset whether from on or off for the same Preset it will toggle the icon to either on or off based on how many times it is pressed. What I am wanting to do is find a method to remember what preset was last selected. The issue is let’s say I start by selecting a single channel such as 80’s on 8. The toggle will reflect on and turn blue and the other MDI icon is yellow. I want this to be the case for just 1 channel at a time. However when I change to an alternate channel such as Road Trip Radio, now I have multiple channels showing as on. Below is a photo showing multiple channels being on; it reflects the power of A/V being on with several Presets showing on (or active in my case):
Sirius Unfortunate Reality:
This is what I would prefer to be shown at any given time:
The above shows the power state of the Patio A/V equipment. It also shows one active Preset.
The assistance I am seeking is the best method to this. Ideally I am always starting from blank showing all presets off and the A/V system as off. I turn on the A/V and its state shows as expected. I will then tune a Preset such as 1 and that shows as on. Once pressed I want it to stay on until I select a different preset. Let’s say I then press Preset 3. I want some type of method to know to now turn Preset to an Off State and turn Preset 3 to an On State. Then when pressing each subsequent Preset it turns the newly selected one to On State and also turns the previous one to an Off State.
In the end I want to always show the Power State On and only 1 Active Preset at a time. This way when we are viewing the Sirius Preset card we always know what channel is tuned. I wasn’t sure if this is a job for the input boolean which I can say I know next to nothing about. I did some reading and felt maybe this is my answer. Additionally my receiver does offer a method to get the channel via IP control. I don’t know if Hassio has a way of receiving the GET response from the receiver and storing its information. Or a method to display that channel information on a card. Any tips or reference to HELP on such capabilities is appreciated.
I know this was a lot of information. I wanted to ensure I was able to effectively communicate my goal and present how I am using the command line switch which may be a but unconventional. If you read all of this post to this post, thank you! I appreciate any and all help you may be able to suggest and or offer.
One idea I thought I may try is just a simple automation. When the switch is turned on, send a command to turn off the other 6 switches. This may be simple enough to do since I only am using 7 presets. I was hoping for a more universal/cleaner way to do it when adding more switches for additional Presets.