- Platform information:
- Hardware: Raspberry Pi 3B+
- OS: Raspbian
PRETTY_NAME=“Raspbian GNU/Linux 8 (jessie)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“8”
VERSION=“8 (jessie)” - Java Runtime Environment:
java version “1.8.0_65”
Java™ SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot™ Client VM (build 25.65-b01, mixed mode) - openHAB version: 1.8.3
- Issue of the topic:
I created a “combined” MQTT command under a new switch like so:
Switch Sw_Oversteek_Fietspadverlichting "Oversteek - Fietspadverlichting" <switchnew> (Lights)
{mqtt="
>[geertvc:home/gelijkvloers/LightChange/Lt_Oversteek_Garage:command:ON:MAP(openclose.map)],
>[geertvc:home/gelijkvloers/LightChange/Lt_Oversteek_Garage:command:OFF:MAP(openclose.map)],
<[geertvc:home/gelijkvloers/LightChange/Lt_Oversteek_Garage:state:MAP(openclose.map)],
>[geertvc:home/gelijkvloers/LightChange/Lt_Oversteek_Inkom:command:ON:MAP(openclose.map)],
>[geertvc:home/gelijkvloers/LightChange/Lt_Oversteek_Inkom:command:OFF:MAP(openclose.map)],
<[geertvc:home/gelijkvloers/LightChange/Lt_Oversteek_Inkom:state:MAP(openclose.map)],
>[geertvc:home/verdiep/LightChange/Lt_Oversteek_Kleine_Living:command:ON:MAP(openclose.map)],
>[geertvc:home/verdiep/LightChange/Lt_Oversteek_Kleine_Living:command:OFF:MAP(openclose.map)],
<[geertvc:home/verdiep/LightChange/Lt_Oversteek_Kleine_Living:state:MAP(openclose.map)],
>[geertvc:home/verdiep/LightChange/Lt_Oversteek_Keuken:command:ON:MAP(openclose.map)],
>[geertvc:home/verdiep/LightChange/Lt_Oversteek_Keuken:command:OFF:MAP(openclose.map)],
<[geertvc:home/verdiep/LightChange/Lt_Oversteek_Keuken:state:MAP(openclose.map)],
>[geertvc:home/verdiep/LightChange/Lt_Oversteek_Zit_En_Eetruimte:command:ON:MAP(openclose.map)],
>[geertvc:home/verdiep/LightChange/Lt_Oversteek_Zit_En_Eetruimte:command:OFF:MAP(openclose.map)],
<[geertvc:home/verdiep/LightChange/Lt_Oversteek_Zit_En_Eetruimte:state:MAP(openclose.map)]"
}
However, those commands are also defined already under existing switches, like so:
Switch Sw_Oversteek_Garage "Oversteek - Garage" <switchnew> (OD_Oversteek, Lights)
{mqtt="
>[geertvc:home/gelijkvloers/LightChange/Lt_Oversteek_Garage:command:ON:MAP(openclose.map)],
>[geertvc:home/gelijkvloers/LightChange/Lt_Oversteek_Garage:command:OFF:MAP(openclose.map)],
<[geertvc:home/gelijkvloers/LightChange/Lt_Oversteek_Garage:state:MAP(openclose.map)]"
}
As you can see, the first 3 MQTT commands of my “combined” switch command are the same as the ones defined for my single Sw_Oversteek_Garage switch.
The same is valid for the other MQTT commands in my “combined” switch command: they already exist under another switch definition.
Question:
Instead of redefining the MQTT commands literally in my “combined” switch command, can I refer to the existing switch commands from within my “combined” switch command?
Something like this:
Switch Sw_Oversteek_Fietspadverlichting "Oversteek - Fietspadverlichting" <switchnew> (Lights)
{
Switch Sw_A,
Switch Sw_B,
Switch Sw_C,
....
}
I know this is a simplistic representation, but you know what I’m trying to achieve…
This would avoid having to type the same MQTT commands twice: once for the individual switch commands and once for the “combined” switch command.
PS: Yes, I’m still using openHAB 1.8.3 to my great satisfaction… Don’t see any reason yet to move over to the bleeding edge openHAB stuff…