I’m currently creating a remote control dashboard with AppDaemon for my Home Theater system. Basically, pretty much all the buttons needs to use the command_line platform because I’m sending RS232 commands over TCP to a GC-100 and a regular iTach IP2SL. I know both has components in Home Assistant, but neither of those supports RS232 (serial) commands… only IR.
So, right now I’m running a Python script that does the trick.
The issue I’m having right now is that all the command_line switches are indeed switches. It does make sense for turning on/off the projector, but it doesn’t when it comes to increase the volume, for instance.
Is it possible to have a single button that doesn’t act like a switch, which will be sending the very same command each time the Volume Up button is pressed?
You could create an input_boolean in Home Assistant and then set it up as a switch widget in HADashboard. Then, in an Appdaemon app, just listen for state change for the input_boolean and then run any python script you need when the state is changed.
You can also create a command line switch and use the same command for both command_on and command_off.
Go with option 1 and use the “momentary” option with the switch widget. This will toggle the switch off after a certain amount of time. Then, in an Appdemon app, only listen for state change to “on” and run your script to increase the volume. This will look better in the UI since the button will turn on for each press. To make a switch momentary, just add:
volume_up:
widget_type: switch
entity: input_boolean.volume_up
title: Volume up
momentary: 200 # Will toggle the switch back to "off" after 200ms.
I use the second option for volume control with a Broadlink rm mini and it works fine for me.
I’m already using the second option, but the problem I have right now is the Volume Up toggling between Colored and Grey everytime I press the button in the UI. In fact, changing the icon behavior would fit my needs!
I’ll look into the two other options for curiosity though!
Any ideas for keeping the icon color unchanged no matter the state of the switch (since it is not being used as a switch…)
Using the “momentary” option would make the switch turn on for just 200ms and then back off again wich gives a good visual indication that you pressed the button. You could also add:
volume_up:
widget_type: switch
entity: your_entity
icon_on: any_icon
icon_off: any_icon #same as icon_on
title: Volume up