MAX! Cube - can I restart the Cube from the rule?

While that post message is of interest to me as well, it’s rather academic. You shouldn’t be in need of rebooting the cube. If you think you are try to fix that first - 2.4 has a couple of relevant fixes and if your cube is losing config at times, consider running the binding in exclusive access mode.

I am running the binding in exclusive mode and it happend from time to time that I set some temperature on particular valve via the cube, but the valve doesn’t register it. But other valves work fine at the same moment. Restarting the cube help (unpluging+pluging from power source). So I expect invoking the restart via API helps too.
BTW I meantime managed to get the message, it’s

HTTP PUT http://192.168.2.102:8080/rest/things/max:bridge:NEQ1442746/config
content-type: application/json
body: {"action-cubeReboot":1234}

Now I just need to find how to call it from rules, but that shouldn’t be a problem.

While that post message is of interest to me as well. :wink:

I also integrated the free memory and the duty cycle item to my sitemap.

image

I could also see, after a few weeks the free memory Item goes down from 50 to 0 in one day, without any actions.

In this case, I restart the cube, by disconnect from the electricity or restart the cube by parameter in the Paper UI.

image

Or via HABmin.

I think there is a bug in the cube, the memory will not be cleaned several times.

There’s probably a more simple explanation, it can be a RF problem. Less probably it’s with an improper setup of that valve.

Possible, but that didn’t happen to me (yet). Do you run latest cube firmware and OH milestone ?

Yesterday I double checked it. Max! SW (1.4.6) said FW latest. OH release build 2.3.0-1

Hi All,

Based on the Information from shrap i was able to create a Simple Solution using an Rule, which is enough for me at the moment.

My Rule:

rule "Reboot Cube on Failures"
        when
                Item Reboot_Cube received command //Dummy Switch Item
        then
       
        if (receivedCommand==ON ) {
            sendHttpPutRequest("http://192.168.xxx.xxx:8080/rest/things/max:bridge:OEQ1944954/config","application/json",'{"action-cubeReboot":"1234"}')
        }
end

Hope this helps someone not to waste hours in trying :wink:

2 Likes

Do you get any exception in log after calling this? I get this:

2018-11-02 19:05:00.185 [INFO ] [nternal.handler.MaxCubeBridgeHandler] - Rebooting MAX! Cube max:bridge
2018-11-02 19:05:00.194 [ERROR] [st.core.internal.thing.ThingResource] - Exception during HTTP PUT request for update config at 'things/max:bridge:NEQ1442746/config'
java.lang.StringIndexOutOfBoundsException: String index out of range: -3
	at java.lang.String.substring(String.java:1931) [?:?]
	at org.openhab.binding.max.internal.command.UdpCubeCommand.receiveUdpCommandResponse(UdpCubeCommand.java:139) [205:org.openhab.binding.max:2.3.0]
	at org.openhab.binding.max.internal.command.UdpCubeCommand.send(UdpCubeCommand.java:95) [205:org.openhab.binding.max:2.3.0]
	at org.openhab.binding.max.internal.handler.MaxCubeBridgeHandler.cubeReboot(MaxCubeBridgeHandler.java:281) [205:org.openhab.binding.max:2.3.0]
	at org.openhab.binding.max.internal.handler.MaxCubeBridgeHandler.handleConfigurationUpdate(MaxCubeBridgeHandler.java:230) [205:org.openhab.binding.max:2.3.0]
	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.updateConfiguration(ThingRegistryImpl.java:92) [108:org.eclipse.smarthome.core.thing:0.10.0.oh230]
	at org.eclipse.smarthome.io.rest.core.internal.thing.ThingResource.updateConfiguration(ThingResource.java:425) [118:org.eclipse.smarthome.io.rest.core:0.10.0.oh230]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) [170:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) [170:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) [170:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160) [170:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) [170:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) [170:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) [170:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) [170:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [170:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [169:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [169:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [169:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [169:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [169:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [169:org.glassfish.jersey.core.jersey-common:2.22.2]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [170:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [170:org.glassfish.jersey.core.jersey-server:2.22.2]
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) [167:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) [167:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) [167:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) [167:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) [167:org.glassfish.jersey.containers.jersey-container-servlet-core:2.22.2]
	at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) [15:com.eclipsesource.jaxrs.publisher:5.3.1.201602281253]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [183:org.ops4j.pax.web.pax-web-jetty:6.0.9]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [82:org.eclipse.jetty.security:9.3.21.v20170918]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284) [183:org.ops4j.pax.web.pax-web-jetty:6.0.9]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [85:org.eclipse.jetty.servlet:9.3.21.v20170918]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [183:org.ops4j.pax.web.pax-web-jetty:6.0.9]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.Server.handle(Server.java:534) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [84:org.eclipse.jetty.server:9.3.21.v20170918]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) [76:org.eclipse.jetty.io:9.3.21.v20170918]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) [76:org.eclipse.jetty.io:9.3.21.v20170918]
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [76:org.eclipse.jetty.io:9.3.21.v20170918]
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [87:org.eclipse.jetty.util:9.3.21.v20170918]
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [87:org.eclipse.jetty.util:9.3.21.v20170918]
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [87:org.eclipse.jetty.util:9.3.21.v20170918]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [87:org.eclipse.jetty.util:9.3.21.v20170918]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [87:org.eclipse.jetty.util:9.3.21.v20170918]
	at java.lang.Thread.run(Thread.java:748) [?:?] 

I get the same exception, but it works. The Cube reboot.

Thanks, @Cyborg2k, for the code. I’ve modified it a little:

when
	Item MaxCubeReset received command ON
then
    var result = sendHttpPutRequest("http://localhost:8080/rest/things/max:bridge:XYZ1234567/config","application/json","{action-cubeReboot:1234}",9000)
	MaxCubeReset.postUpdate(OFF)
    logInfo("manual-cube-reboot", "Reboot MAX! Cube, result={}", result)
end

Note that I used localhost, so no need to update openHAB’s IP address should it change one day.

I’ve also created a rule that should automatically trigger a reboot when the cube is out of free memory slots:

Item

Number MaxCubeFreeMemorySlots "Free Memory Slots" <pressure> {channel="max:bridge:XYZ1234567:free_mem"}

Rule

rule "automatic max cube reboot"

when
	Item MaxCubeFreeMemorySlots changed to 0
then
    logInfo("auto-cube-reboot", "No more free memory slots on MAX! cube - requesting reboot")
    var result = sendHttpPutRequest("http://localhost:8080/rest/things/max:bridge:XYZ1234567/config","application/json","{action-cubeReboot:1234}",9000)
    sendMail("openhab.admin@domain.com>", "openHAB warning", "MAX! Cube had no more free memory slots! MAX! Cube reboot automatically triggered.")
	MaxCubeReset.postUpdate(OFF)
end

I’m not 100% sure that the automatic rule works, because I have to wait until the cube’s memory slots get used up, which happens only very occasionally here. So the rule hasn’t really run yet.

I’ve also found and fixed the exception.

1 Like

Hi there,

Since I’m also facing the memory slot issue on my MaxCube I’m glad to have found this thread …

Unfortunately, I’ve got the error message below in the log:

[INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'maxcubereboot.rules', using it anyway:
The value of the local variable result is not used
[INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'maxcubereboot.rules'

// maxcubereboot.rules

rule "MaxCube reset (manuell)"
when
	Item vMaxCubeReset received command ON
then
    var result = sendHttpPutRequest("http://localhost:8080/rest/things/max:bridge:KEQXXXX/config","application/json","{action-cubeReboot:1234}",9000)
	vMaxCubeReset.postUpdate(OFF)
    logInfo("manual-maxcube-reboot", "Reboot MAX! Cube, result={}", result)
    postUpdate(EventLog, "manueller MaxCube Reboot")        // eventlog.rules
            Thread::sleep(100)
                sendPushoverMessage(pushoverBuilder("manueller MaxCube Reboot").withSound("none"))
end



rule "automatic max cube reboot"
when
	Item MAXCubeLANGatewayFreeMem changed to 0
then
    logInfo("auto-maxcube-reboot", "No more free memory slots on MAX! cube - requesting reboot")
    var result = sendHttpPutRequest("http://localhost:8080/rest/things/max:bridge:KEQXXXX/config","application/json","{action-cubeReboot:1234}",9000)
    postUpdate(EventLog, "No more free memory slots on MAX! cube - requesting reboot")        // eventlog.rules
            Thread::sleep(100)
                sendPushoverMessage(pushoverBuilder("No more free memory slots on MAX! cube - requesting reboot").withSound("none"))
	vMaxCubeReset.postUpdate(OFF)
end
// max.items

Number  MAXCubeLANGatewayFreeMem        "MAX!Cube: Freie Speicherplätze"        (gM,gR,Gmax)       {channel="max:bridge:KEQXXXX:free_mem"}
Number  MAXCubeLANGatewayDutyCycle      "MAX!Cube: Auslastungsgrad"             (gM,gR,Gmax)       {channel="max:bridge:KEQXXXX:duty_cycle"}
Switch  vMaxCubeReset                   "MAX!Cube: Reset"                       (gM,gR,Gmax)

I would really appreciate if anyone could point me in the right direction.

Thanks,
Selter

This shouldn’t actually be a problem. The message is just telling you that you have defined a variable result, and you do not use its value anywhere. This probably refers to the second rule “automatic max cube reboot” because in the other one, result is used in the log message.

However, the configuration is being used nonetheless. To get rid of the message, it may make sense to add result to the log message.

Ok, this helped.

Another question:

My current log shows:

[WARN ] [nternal.handler.MaxCubeBridgeHandler] - Last Send Command discarded. Duty Cycle: 21, Free Memory Slots: 49

Shouldn’t the rule for automatic reboot trigger when changed to 50 instead of 0 ??

Item MAXCubeLANGatewayFreeMem changed to 0

I did a manual reset via vMaxCubeReset button - but not sure whether it worked as I got this message:

[INFO ] [st.core.internal.thing.ThingResource] - Received HTTP PUT request for update configuration at 'things/max:bridge:KEQXXXX/config' for an unmanaged thing 'max:bridge:KEQXXXX'.

[INFO ] [e.model.script.manual-maxcube-reboot] - Reboot MAX! Cube, result={"error":{"message":"Cannot update Thing max:bridge:KEQXXXX as it is not editable.","http-code":409},"entity":{"statusInfo":{"status":"ONLINE","statusDetail":"NONE"},"editable":false,"label":"MAX! Cube LAN Gateway","configuration":{"room5":"Wohnzimmer","rfAddress":"0e902e","room6":"Selter","room3":"Bad-OG","serialNumber":"KEQXXXX","action-cubeReset":-1,"room4":"Pumpe","refreshInterval":30,"room7":"Schlafzimmer","room8":"Kind","ipAddress":"192.168.178.27","room1":"Bad-EG","room2":"Kueche","action-cubeReboot":-1,"ntpServer1":"ntp.homematic.com","port":62910,"ntpServer2":"ntp.homematic.com","exclusive":true,"maxRequestsPerConnection":1000},"properties":{"serialNumber":"KEQXXXX","firmwareVersion":"01.13","modelId":"Cube","vendor":"eQ-3 AG"},"UID":"max:bridge:KEQXXXX","thingTypeUID":"max:bridge","channels":[{"linkedItems":["MAXCubeLANGatewayFreeMem"],"uid":"max:bridge:KEQXXXX:free_mem","id":"free_mem","channelTypeUID":"max:free_mem","itemType":"Number","kind":"STATE","label":"Freie Speicherplätze","description":"Zeigt an, wie viele freie Speicherplätze im MAX! Cube LAN Gateway für Befehle zur Verfügung stehen.","defaultTags":[],"properties":{},"configuration":{}},{"linkedItems":["MAXCubeLANGatewayDutyCycle"],"uid":"max:bridge:KEQXXXX:duty_cycle","id":"duty_cycle","channelTypeUID":"max:duty_cycle","itemType":"Number","kind":"STATE","label":"Auslastungsgrad","description":"Zeigt den Auslastungsgrad für Befehle (in %) an.","defaultTags":[],"properties":{},"configuration":{}}]}}

You want it to boot on every message ? My understanding is that the cube has 50 FREE slots by default. Any single message reduces that to 49.
You only want to boot (if at all, I would not do that and certainly not automatically) no sooner than that now drops to 0 (= queue full).

2 Likes

Thanks for clarifying - seems that I misunderstood the concept of memory slots.

Hi Selter,

I do get exactly the same message with my setup, and it seems the cube does not reboot… where you able to get it working? If yes, was there any more to be adjusted?

Thanks and regards
Karsten

I still get from time to time these messages:

Last Send Command discarded. Duty Cycle: 0, Free Memory Slots: 0

But I haven’t investigated it further - I don’t control the heating system via openhab.

You’re probably sending more messages than allow per the hour [time interval].

Could you please let me know what kind of messages are relevent?

All to result in RF comms.