ok, it is quite ugly but it works.
Thing exec:command:pluglight [command="/opt/openhab2/conf/scripts/hs100.sh 192.168.10.42 9999 %2$s", interval=0, timeout=5, autorun=true]
Thing exec:command:pluglightcheck [command="/opt/openhab2/conf/scripts/hs100.sh 192.168.10.42 9999 check", interval=1, timeout=5]
Switch Pluggy “Lamp One” (FF_Lights, FF_Lights1, FF_Lights2, Lights) [ “Switchable” ]
(this switch is what you put into sitemap and into all groups)
String PlugOne {channel=“exec:command:pluglight:input”, channel=“exec:command:pluglightcheck:output”,autoupdate=“false”}
String PlugOneState “Plug One Status” {channel=“exec:command:pluglightcheck:output”}
(strings to communicate with the HS100)
and rules
rule "Plug One 1"
when
Item Pluggy changed from ON to OFF
then
// if ((Sensor2Lum.state<50) {
postUpdate(PlugOneState,“OFF”)
sendCommand(PlugOne,“OFF”)
logInfo(“Network”, "Switching Pluggy Off: "+PlugOneState.state )
// }
end
rule "Plug One 2"
when
Item Pluggy changed from OFF to ON
then
logInfo(“Network”, "Switching Pluggy On: "+PlugOneState.state )
// if (Sensor2Lum.state<50) {
postUpdate(PlugOneState,“ON”)
sendCommand(PlugOne,“ON”)
logInfo(“Network”, "Switched Pluggy On: "+PlugOneState.state )
// }
end
rule "Plug One 3"
when
Item PlugOneState changed from OFF to ON
then
logInfo(“Network”, "Switching Pluggy On: "+PlugOneState.state )
// if (Sensor2Lum.state<50) {
postUpdate(Pluggy,“ON”)
sendCommand(PlugOne,“ON”)
logInfo(“Network”, "Switched Pluggy On: "+PlugOneState.state )
// }
end
rule "Plug One 3"
when
Item PlugOneState changed from ON to OFF
then
logInfo(“Network”, "Switching Pluggy On: "+PlugOneState.state )
// if (Sensor2Lum.state<50) {
postUpdate(Pluggy,“OFF”)
sendCommand(PlugOne,“OFF”)
logInfo(“Network”, "Switched Pluggy On: "+PlugOneState.state )
// }
end