Single ui dashboard button, two functions

I'm making a node red dashboard ui which acts as a universal remote for my tv, decoder, soundsystem and dvd player.
I have two actions:

  1. Watch TV (turns on tv, decoder, soundsystem)
  2. Watch DVD (turns on tv, dvd and soundsystem)

Some dashboard buttons are for both actions the same: Pause, play, stop, etc... but their msg.payload is different. How can I set the same button, for example pause to contain the payload for pausing tv when watching tv and pause dvd when watching dvd?

Hi, Can you show your flow in order to add a little more context ?

I would suggest that you have a flow variable that is set to TV or DVD. Then when the pause button is pressed, you check that flow variable to see which device to act on.

Thanks for your reply. In the meantime I found out how to do it, was not as complicated as I thought.
Below is video of the final result.
The remote has four activities: WatchTV, Music, WatchMovie and Gaming. Each activity will power on the necessary equipment: tv, surround system, decoder, computer or led strip.
So eg activity WatchTV turns on the tv, decoder, led strip and sound system. Buttons needed to control the activity are enabled or disabled. For music activity it is useless to have the numeric buttons enabled, so in my flow these buttons are disabled.
The universal remote works either with simple ir commands over mqtt or http commands (to control vlc for movie). Music activity works with raspberry pi with shairport-sync (airplay). Shairport-sync has mqtt support, so I can control the playlist with mqtt commands. It also publishes the song and artist information over mqtt, so I can display it in the remote dashboard interface.
The activity buttons are also linked with homekit thanks to homekit bridged node. So I can ask siri to turn on any activity, like WatchTV.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.