General remote control (with HADashboard)

i read a lot on the forum and i have seen several requests for a remote control option over time.
so i thought, why not generelize my own remote a bit and share it.


click on the picture to see the full remote

its a dashboard, so its a webpage.
you can use it in any iframe, or just as it is.

all you need is appdaemon 3.0 running and you can use this dashboard.
off course the first thing you need is what the buttons do.
i use a broadlink and have created switches in HA, but the nice thing is that you can connect all actions you like on this remote.
every button is a switch widget so you can use switches or input_booleans to connect to the buttons.
this is the dashboardfile:

##########################################################################################
# edit only the entities on the right side.
# all entities must be an input_boolean or switch
# if you want to leave out any entities, then you also need to delete them below,
# but you can set a dummy entity in home assistant and use that several times
##########################################################################################

titletext: &titletext                  "sat reciever"
power_entity: &power_entity            switch.satelliet_ontvanger_power
mute_entity: &mute_entity              switch.satelliet_ontvanger_mute
1_entity: &1_entity                    switch.satelliet_ontvanger_1
2_entity: &2_entity                    switch.satelliet_ontvanger_2
3_entity: &3_entity                    switch.satelliet_ontvanger_3
4_entity: &4_entity                    switch.satelliet_ontvanger_4
5_entity: &5_entity                    switch.satelliet_ontvanger_5
6_entity: &6_entity                    switch.satelliet_ontvanger_6
7_entity: &7_entity                    switch.satelliet_ontvanger_7
8_entity: &8_entity                    switch.satelliet_ontvanger_8
9_entity: &9_entity                    switch.satelliet_ontvanger_9
0_entity: &0_entity                    switch.satelliet_ontvanger_0
up_entity: &up_entity                  switch.satelliet_ontvanger_channel_up
down_entity: &down_entity              switch.satelliet_ontvanger_channel_down
volumeup_entity: &volumeup_entity      switch.satelliet_ontvanger_volume_up
volumedown_entity: &volumedown_entity  switch.satelliet_ontvanger_volume_down
rewind_entity: &rewind_entity          switch.satelliet_ontvanger_rewind
pause_entity: &pause_entity            switch.satelliet_ontvanger_pause
play_entity: &play_entity              switch.satelliet_ontvanger_play
forward_entity: &forward_entity        switch.satelliet_ontvanger_forward
record_entity: &record_entity          switch.satelliet_ontvanger_record
stop_entity: &stop_entity              switch.satelliet_ontvanger_stop
back_entity: &back_entity              switch.satelliet_ontvanger_back
ok_entity: &ok_entity                  switch.satelliet_ontvanger_ok

#######################################################################################
# dont edit the parts below unless you know how to change a dashboard.
# how to create and edit dashboards can be found here:
# http://appdaemon.readthedocs.io/en/latest/DASHBOARD_CREATION.html
#######################################################################################


title: *titletext
widget_dimensions: [60, 60]
widget_size: [1,1]
widget_margins: [3, 3]
columns: 4
global_parameters:
    use_comma: 1
    precision: 1

label1:
    widget_type: label
    title: *titletext
    title_style: "top:13px;font-size: 200%;"
power:
    widget_type: switch
    entity: *power_entity
    icon_on: mdi-power
    icon_off: mdi-power
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
mute:
    widget_type: switch
    entity: *mute_entity
    icon_on: mdi-volume
    icon_off: mdi-volume-off
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
one:
    widget_type: switch
    entity: *1_entity
    icon_on: mdi-numeric-1-box
    icon_off: mdi-numeric-1-box
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
two:
    widget_type: switch
    entity: *2_entity 
    icon_on: mdi-numeric-2-box
    icon_off: mdi-numeric-2-box
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
three:
    widget_type: switch
    entity: *3_entity 
    icon_on: mdi-numeric-3-box
    icon_off: mdi-numeric-3-box
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
four:
    widget_type: switch
    entity: *4_entity 
    icon_on: mdi-numeric-4-box
    icon_off: mdi-numeric-4-box
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
five:
    widget_type: switch
    entity: *5_entity 
    icon_on: mdi-numeric-5-box
    icon_off: mdi-numeric-5-box
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
six:
    widget_type: switch
    entity: *6_entity 
    icon_on: mdi-numeric-6-box
    icon_off: mdi-numeric-6-box
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
seven:
    widget_type: switch
    entity: *7_entity 
    icon_on: mdi-numeric-7-box
    icon_off: mdi-numeric-7-box
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
eight:
    widget_type: switch
    entity: *8_entity 
    icon_on: mdi-numeric-8-box
    icon_off: mdi-numeric-8-box
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
nine:
    widget_type: switch
    entity: *9_entity 
    icon_on: mdi-numeric-9-box
    icon_off: mdi-numeric-9-box
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
zero:
    widget_type: switch
    entity: *0_entity 
    icon_on: mdi-numeric-0-box
    icon_off: mdi-numeric-0-box
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
down:
    widget_type: switch
    entity: *down_entity 
    icon_on: mdi-arrow-down-drop-circle-outline
    icon_off: mdi-arrow-down-drop-circle-outline
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
up:
    widget_type: switch
    entity: *up_entity 
    icon_on: mdi-arrow-up-drop-circle-outline
    icon_off: mdi-arrow-up-drop-circle-outline
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
volume_down:
    widget_type: switch
    entity: *volumedown_entity 
    icon_on: mdi-volume-minus
    icon_off: mdi-volume-minus
    icon_style_active: "top: 38px;"
    icon_style_inactive: "top: 38px;"
volume_up:
    widget_type: switch
    entity: *volumeup_entity 
    icon_on: mdi-volume-plus
    icon_off: mdi-volume-plus
    icon_style_active: "top: 38px;"
    icon_style_inactive: "top: 38px;"
rewind:
    widget_type: switch
    entity: *rewind_entity
    icon_on: mdi-rewind
    icon_off: mdi-rewind
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
pause:
    widget_type: switch
    entity: *pause_entity
    icon_on: mdi-play-pause
    icon_off: mdi-play-pause
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
play:
    widget_type: switch
    entity: *play_entity
    icon_on: mdi-play
    icon_off: mdi-play
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
forward:
    widget_type: switch
    entity: *forward_entity
    icon_on: mdi-fast-forward
    icon_off: mdi-fast-forward
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
record:
    widget_type: switch
    entity: *record_entity
    icon_on: mdi-record-rec
    icon_off: mdi-record-rec
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;color:red;"
stop:
    widget_type: switch
    entity: *stop_entity
    icon_on: mdi-stop
    icon_off: mdi-stop
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
back:
    widget_type: switch
    entity: *back_entity
    icon_on: mdi-undo
    icon_off: mdi-undo
    icon_style_active: "top: 8px;"
    icon_style_inactive: "top: 8px;"
ok:
    widget_type: switch
    entity: *ok_entity
    icon_on: mdi-check-circle
    icon_off: mdi-check-circle
    icon_style_active: "top: 15px;font-size:600%;"
    icon_style_inactive: "top: 15px;font-size:600%;"
    #widget_style: "border-radius: 60px;"

layout:
    - label1(4x1)
    - power, spacer, spacer,mute
    - one,two,three,four
    - five, six,seven,eight
    - record,nine, zero
    - spacer,up(2x1)
    - volume_down(1x2),ok(2x2),volume_up(1x2)
    -
    - back,down(2x1)
    - rewind,stop,pause,forward

just put in your own entities, save the dashboard and have fun.

6 Likes

thank you Rene

1 Like

some pictures that show options


This is awesome! I was literally just checking on how to do this.

1 Like

Rene question.
Is there a way to turn off the memory presents when a subsequent one is pressed?
So if I use a colour for icon style active and press 1 it highlights that button; if I press 2 it also highlights that button. So is it possible to auto turn off 1 when 2 or other is pressed?

it changes color because the switch is on.
what i did is use an app to turn some buttons (that need to work as pushbuttons) off after they are turned on.

the app is this:

import appdaemon.plugins.hass.hassapi as hass
import datetime
import time

class auto_off(hass.Hass):

  def initialize(self):
    self.listen_state(self.keepoff,"switch")   

  def keepoff(self, entity, attribute, old, new, kwargs):
    turn_off = False
    if new == "on":
      for entity_part in self.args["entities"]:
        if entity_part in entity:
          turn_off = True
          for exclude_part in self.args["excludes"]: 
            if exclude_part in entity:
              turn_off = False
    if turn_off:
      self.turn_off(entity)
      self.log (entity + " used and turned off again")

with this yaml

auto_off:
  module: switch_reset
  class: auto_off
  entities:
    - tv_woonkamer
    - satelliet_ontvanger
    - kaarsen
  excludes:
    - power
    - mute
    - pause
    - kaarsen_aan

what it does is actually quit simple.
it listens to all switches.
if a switch is turned on it looks if in the switchname is a part like that in entities
but only if not a part from the exclude list is in it.

so in my case i listen to every switch that is named like “switch.satteliet_ontvanger_…”
and they are automaticly turned off except if it is “switch.satteliet_ontvanger_power” or “switch.satteliet_ontvanger_mute”

the turning off doesnt have effect, because i didnt set an action for that in the switch.

Rene, thank you very much. I’ve not done any apps in appdaemon so forgive-me for asking;
so i create a file called auto_off.??? and put it inside the conf/apps/ directory?

and then add the auto_off part to the existing appdaemon.yaml? under appdaemon, plugins?

if you look at the yaml you see:

module: switch_reset

that is normally the name of the py file.

so in this case you can create a py file with the code a gave and name it switch_reset.py
then you save that in the apps dir
then you take the yaml, edit it and save it as switch_reset.yaml in your apps directory.

for the yaml you can take any name, but its easier to keep the naming the same.
in some cases it is neccesary to restart appdaemon (and you must have apps switched of in your appdaemon.yaml off course)

thank you Rene, by switch on apps in appdaemon. yaml you mean disable_apps: 0
like this
https://hastebin.com/oyerovakel.cpp

right. or just remove the line.
if it was on 1 and you kept that, it would never start :wink:

I picked up a Logitech Harmony Hub this weekend and was attempting to set up something similar, although all I want at this time is power on/off and volume up/down. The power on/off works well, but the volume up/down buttons didn’t work a well as I would like. The main problem is that I can’t hold the buttons down to quickly change the volume. I have to repeatedly press the buttons, and possibly because I’m running this on a Pi 3B I can’t hit the buttons too fast. Is there any solution for this?

Rene, it’s not starting. Im getting this error.log
https://hastebin.com/ukelezeyah.rb

the problem is that most remotes dont have an option to set a volume level.
the only thing i can think of to solve that is to create a small app that listens to the switch and repeats it several times.

in my case (with a broadlink) i need to record the buttonpress to get the code in HA.
when i recorded the buttonpress i did push a little longer.
every time i activate the switch the amount of time i did record the button is pressed.

but i dont know how the harmony hub component functions.

@juan11perez that error is there because you removed all excludes.
if you dont want excludes we need to rewrite a part from the code or you just add 1 exclude like:

   excludes:
    - idontwanttoexcludeanything

thank you Rene, went with - idontwanttoexcludeanything and no errors.
fixed the switch.
but they’re not switching off.

what did you put in entities?
what are the switches you want to reset?
and did you restart appdaemon?

So this is the panel
https://hastebin.com/iqagujabax.sql

and looks like this

Im trying to get the presets to switch off, when i select a new one

with his yaml
auto_off:
module: switch_reset
class: auto_off
entities:

  • living_preset
  • master_preset
    excludes:
  • idontwanttoexcludeanything

please use code block when you show yaml, or noone can read it.

and did you reset appdaemon and reloaded the dashboard?

(by the way, not much left from the remote i presented :wink: )

:grinning::grinning::grinning:
well, your remote inspired this panel. wanted to have buttons for the presets instead of a input_number but didnt know how to go about it.
So thank you
I did restart appdaemon not sure about reloading. Just clear my browser cache.

you can check if it works in HA.
the switch should be turned off after you have turned it on.

in your appdaemon log after restart you should find that the app is loaded
and there should be no errors in the errorlog

to make sure the indention in the yaml needs to be like this:

auto_off:
  module: switch_reset
  class: auto_off
  entities:
    - living_preset
    - master_preset
  excludes:
    - idontwanttoexcludeanything

(and please i hope you have AD 3.0 or it wont work)

thanks Rene app is loaded
https://hastebin.com/ahidipatah.coffeescript
Im on AD 3.0
but switches stay on.