Hello,
I use OH3 and wanted to Ping a Bluetooth Device. Sometimes i want to Ping every 40s and sometimes every 10s.
var results = executeCommandLine(Duration.ofSeconds(7), "/etc/openhab/scripts/bt_ping_nils.sh")
if (results == ON)
{
//do something
}
Nils_Handy_BT_Switch.sendCommand(results)
logInfo("BT Suche Aktiv", "Ergebnis von bt_ping_nils.sh: "+results)
At the same time a Thing is scanning every 40s for the Bluetooth device.
That is working. But sometimes I want to Scan every 10s or less.
Thing exec:command:nils_bt "Nils Handy BT" [command="sh /etc/openhab/scripts/BT.sh 1", interval=40, timeout=7, transform="REGEX((.*?))"]
Switch Nils_Handy_BT_Switch "Nils Handy BT" (RRD4J, gAnwesend_Nils) {channel="exec:command:nils_bt:output"}
BT Ping Script
if /usr/bin/sudo /usr/bin/l2ping -c 1 "MY MAC ADRESS" >/dev/null 2>&1
then
#set echo on
echo "ON"
else
#set echo off
echo "OFF"
fi
That is my error message:
[WARN ] [b.core.model.script.actions.BusEvent] - Cannot convert 'ON
' to a command type which item 'Nils_Handy_BT_Switch' accepts: [OnOffType, RefreshType].
[INFO ] [hab.core.model.script.BT Suche Aktiv] - Ergebnis von bt_ping_nils.sh: ON
[INFO ] [hab.core.model.script.BT Suche Aktiv] - Ergebnis von bt_ping_nils.sh: ON
Edit:
i use the Script BT.sh 1 and bt_ping_nils.sh but both does the same.