I have a pop up whereby I can choose one of many Sonoff (MQTT Tasmota) switches and via notification see that switches operating info such as RSSI, network, gui_name, hw_name, etc...
So if I choose "1
" in my pop up, the switch info that is displayed via a notification node is for context.flow.sw1_wifi
. If I choose "2
" the switch is context.flow.sw2_wifi
.
But so far I have to write a function node such as:
if (msg.payload === 1)
{
RSSI = context.flow.sw1_wifi.RSSI;
network = context.flow.sw1_wifi.network;
etc....
}
if(msg.payload === 2)
{
RSSI = context.flow.sw2_wifi.RSSI;
network = context.flow.sw2_wifi.network;
etc....
}
Is there any way to make it work along these lines?
if (msg.payload === 1) object = context.flow.sw1_wifi;
if (msg.payload === 2) object = context.flow.sw2_wifi;
RSSI = object + . RSSI;
network = object + . network;
etc....
TIA