How to disable and enable things by script?

my problem:
KEBA-Wallbox is connectet via FRITZ-repeater and WLAN to my FRITZ-Box. After several houres the Repeater ist disconnectet for some seconds and then connectet again. I can´t fix this Problem.
Is it possible to disable and enable the Thing KEBA-Wallbox, when occours a connection error, my be after 10 seconds?
As i have no idea about programming i would be thankfull with help!
Raspberry Pi B01

OpenHABian, openHAB 2.5.2-1


Keba-Wallbox P30 v 3.08.4

Thing keba:kecontact:1 [ ipAddress=“”, refreshInterval=30 ]

Dimmer KebaCurrentRange {channel=“keba:kecontact:1:maxpresetcurrentrange”, autoupdate=“false”}
Switch KebaSwitch {channel=“keba:kecontact:1:enabled”, autoupdate=“false”}
Switch Fahrzeug_eingesteckt {channel=“keba:kecontact:1:vehicle”}
Number KebaPower {channel=“keba:kecontact:1:power”}
Number KebaSessionEnergy {channel=“keba:kecontact:1:sessionconsumption”}
Number KebaTotalEnergy {channel=“keba:kecontact:1:totalconsumption”}

The question is, what is your problem? If the plug is disconnected for some seconds and then reconnects, where is the harm? What do you want to do, where is the core of the problem?

I did that here. Just change the binding to adapt it:

Maybe its bit of an overkill for your problem.

Here’s how I disable THINGS in my rules.

		sendHttpPutRequest("", "application/json", 'false', 5000)							// Disable Discovered HUE Bridge 1
		sendHttpPutRequest("", "application/json", 'false', 5000)							// Disable Discovered HUE Bridge 2

To ENABLE them; just change ‘false’ to ‘true’

I have rules to disable and enable THINGS based on Internet connectivity being lost and certain THINGS needing that Internet connectivity.

Best, Jay

@ NoneWhereTo
My Problem is the Fritz-Repeater. Sometimes he disables and enables connection to FritzBox for approx. 10 seconds. In this time Thing KEBA shows Connection_Error and does not work anymore. After disabeling and enabeling again all is fine till next break of Fritz-connection

@ m4rk and 5iver
Thanks for your try to help, but i don´t understand what you want to tell me, - i am just a stupid user and have really no idea about programming!

@ jwiseman
Also thanks for help, i took your idea and tried to create a rule to disable and enable my KEBA-Thing:
rule “TEST”
Item PowerLadung received command ON
createTimer(now.plusSeconds(10), [ |
sendHttpPutRequest(“”, “application/json”, ‘false’)])
createTimer(now.plusSeconds(30), [ |
sendHttpPutRequest(“”, “application/json”, ‘true’)])


As trigger i use a switch, i had in my items, and with this switch it works. Now i would like to trigger the rule with the Event:

[hingStatusInfoChangedEvent] - ‘keba:kecontact:095e5da8’ changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): An exception occurred while while polling the charging station

and i have no idea how to realise this.

Example rule here

Problem solved
Many thanks to all helpers, specially to jwiseman and rosko57!

Great !!!

    Many thanks for help

    It works and i am happy!

    Elmar (Schmitt)
1 Like