Using presentation() to secure GW communication
in order to achieve the self-healing of the network after the GW restart, I call in my nodes the presentation() every time I'm about to send a message. This works perfectly and serves its purpose! One drawback is the openhab2.log file on my BeagleBone is flooded with:
2017-10-01 20:28:11.352 [WARN ] [rs.internal.gateway.MySensorsGateway] - Presented child is alredy present in gateway
Hundreds of kilobytes a day. Is there a way to stop this logging?
@etxmsol I guess you could keep a table of which nodes you have presented in RAM on the GW, and not call the node again if it already has been called?
Could you take a step back and describe why the presentation needs to be done? Maybe this should be handled on another level (maybe at controller, or in the mySensors library)?
thanks for your reply. I was not clear on my purpose, my bad. I want a truly self healing network. I have a serial GW, connected to OpenHab2 running on a BeagleBone Black. I use the provided MySensorsSerialGW, connected over FTDI adapter to the USB on the BeagleBone. When on some reason, either GW or the BeagleBone. or both get restarted, the GW loses all information about the connected nodes. This is of course normal, the GW is a simple arduino nano program. The nodes (Arduino Mega), on the other hand are unaware. They send updates, but fail. To solve this issue, I figured out I could call the presentation() function (which is normally only called before Arduino's setup()) every time before sending a message (update status). Just to be sure, the node is registered with the GW. Another solution would be to restart the node, but this is not self healing. In the rare case when the GW was actually restarted, calling presentation() re-does registration. But in all other cases it leads to the warning message as described. I was wondering if I could suppress this message.
@etxmsol thanks for explaining
The gateway is stateless, so restarting it should not affect anything, except that it will miss messages sent while restarting of course.
Could this be an OpenHab2 issue?
I use Domoticz, and I've never had to make nodes re-present themselves after restarting my raspberry pi, nor after restarting the gateway.
yeah, it should be on the OpenHab side then. I've found an option in the OpenHab service (Karaf) to configure the level of the logging. The message comes actually from the MySensors binding (a part of MySensors infrastructure on the OpenHab side):
23:08:57.306 [WARN ] [rs.internal.gateway.MySensorsGateway] - Presented child is alredy present in gateway
The message type is WARN. I can change the logging level in OpenHab to ERROR. Then the warnings are no more. On the downside, I'll see no warnings at all, even the ones I need to see.
Probably the warning comes from the OpenHab to the binding. Still basically it should be possible to disable this specific warning in the MySensors binding somehow (binding config page?).
also, could you as a moderator move this topic to either Development or Controllers? It looks the discussion is quite specific
@etxmsol moved to OpenHab. Thanks.