-
Platform information:
- Hardware: Raspberry 3B
- OS: Openhabianpi
- Java Runtime Environment: openjdk version “1.8.0_265”
- openHAB version: 2.5.9.-1
-
Issue of the topic: I want to start a PC via Openhab and manually. The script starting the PC via GPIO -> Relais-Module works well. I want the switch to be changed when the PC returns a ping. Therefore I added a first rule with a logging info, but when the Item changes the rule is not entered.
-
Please post configurations (if applicable):
- Items configuration related to the issue
Switch Cubic “Cubic [%s]”
Switch cubic_Run {channel=“exec:command:cubic:run”, autoupdate=“false”}
String cubic_Args {channel=“exec:command:cubic:input”}
Switch CubicPing { channel=“network:pingdevice:cubic:online” }
Number:Time CubicResponseTime { channel=“network:pingdevice:cubic:latency” }
- Sitemap configuration related to the issue
sitemap cubic label=“Cubic Buttons”
{
Frame {
Switch item=Cubic
//Text item=YourNumber
}
Frame {
Text item=CubicPing label="ping cubic [%s]"
Text item=CubicResponseTime label="Cubic Response Time [%s]"
}
}
- Rules code related to the issue
rule “ping state changed”
when
Item CubicPing changed
then
if (CubicPing == OFF)
{
Cubic.postUpdate(OFF)
logInfo("cubic.rules","Cubic.postUpdate->OFF")
}
if (CubicPing == ON)
{
Cubic.postUpdate(ON)
logInfo("cubic.rules","Cubic.postUpdate->ON")
}
end
- Services configuration related to the issue
- If logs where generated please post these here using code fences:
2020-10-18 17:23:22.348 [vent.ItemStateChangedEvent] - CubicPing changed from NULL to ON
2020-10-18 17:23:22.414 [vent.ItemStateChangedEvent] - CubicResponseTime changed from NULL to 21.0 ms
2020-10-18 17:23:53.001 [vent.ItemStateChangedEvent] - CubicResponseTime changed from 21.0 ms to 20.0 ms
2020-10-18 17:24:53.078 [vent.ItemStateChangedEvent] - CubicResponseTime changed from 20.0 ms to 22.0 ms
2020-10-18 17:25:53.155 [vent.ItemStateChangedEvent] - CubicResponseTime changed from 22.0 ms to 24.0 ms
The result is shown in the Screenshot of the Basic-UI. Ping works well but the switch still shows / thinks the PC is off. The switch should also switch to ON if the ping changes to ON. The same with OFF.
I think it has something with the “autoupdate” to do.
Thanks in advance for any hint.
regards Dirk