Shelly binding OH3.1.0RC1 (error shellyplug-s-b50ad5: CoAP Exception)

there are five of these messages. They seem to be COAP related ( invalid option number ).

I still haven’t the shelly binding working.
I installed a new docker image based on 3.3.0M1 and used as network bridge instead of host.
image
I configured CoLoT peer not as mCast but with the the port number of the docker.
image
In the log file I get the following info. What could be wrong?
2021-09-04 18:14:08.747 [WARN ] [y.internal.handler.ShellyBaseHandler] - shellyplug-s-b50ad5: CoIoT peer in device settings does not point this to this host

2021-09-04 18:14:08.765 [INFO ] [elly.internal.coap.ShellyCoapHandler] - shellyplug-s-b50ad5: CoAP Exception (Unknown Host)
In debug mode I get also this
2021-09-04 19:08:54.617 [DEBUG] [y.internal.handler.ShellyBaseHandler] - shellyplug-s-b50ad5: Unable to initialize: Invalid URL: , retrying later

I do not use the shelly binding ( yet ) but …
… reading this blog the default port seems to be 5683 and I would stay with the default port as I do not see a way to define the ColoT port in the binding setup.
… the container port 8080 is the openhab webinterface I doubt that it will react on ColoT service messages
… it may work in case you use port 5683 instead but not on port 8080 as far as I understand
Have you had a look to Advanced Users | openHAB ?

I tried 5683 and didn’t work either.

Who can explain what the messages below mean. They are identical for a container in host and bridge mode.
2021-09-06 21:47:59.194 [WARN ] [y.internal.handler.ShellyBaseHandler] - shellyplug-s-b50ad5: CoIoT peer in device settings does not point this to this host

2021-09-06 21:47:59.196 [INFO ] [elly.internal.coap.ShellyCoapHandler] - shellyplug-s-b50ad5: CoAP Exception (Unknown Host)

The mesage

is “caused” by this part of the code:

        if (config.eventsCoIoT && (tmpPrf.settings.coiot != null) && (tmpPrf.settings.coiot.enabled != null)) {
            String devpeer = getString(tmpPrf.settings.coiot.peer);
            String ourpeer = config.localIp + ":" + ShellyCoapJSonDTO.COIOT_PORT;
            if (!tmpPrf.settings.coiot.enabled || (profile.isMotion && devpeer.isEmpty())) {
                try {
                    api.setCoIoTPeer(ourpeer);
                    logger.info("{}: CoIoT peer updated to {}", thingName, ourpeer);
                } catch (ShellyApiException e) {
                    logger.debug("{}: Unable to set CoIoT peer: {}", thingName, e.toString());
                }
            } else if (!devpeer.isEmpty() && !devpeer.equals(ourpeer)) {
                logger.warn("{}: CoIoT peer in device settings does not point this to this host", thingName);
            }
        }

I would interpret it as:

  • the peer address of the configuration ( in the device ) does not match with the IP address that the binding detects for the openhab instance
  • as the comparision includeds ip address and port numbers either the address and/or the port does not match

COIOT_PORT seems to be a constant so it is not a good idea to change the default port which is 5683.

could be cause by this part of the code:

            discover();
        } catch (SocketException e) {
            logger.warn("{}: Unable to initialize CoAP access (socket exception) - {}", thingName, e.getMessage());
            throw new ShellyApiException("Network error", e);
        } catch (UnknownHostException e) {
            logger.info("{}: CoAP Exception (Unknown Host)", thingName, e);
            throw new ShellyApiException("Unknown Host: " + config.deviceIp, e);
        }

This page describe possible root causes for the exception.

Thanks Wolfgang. I checked everything and I’m sure IP address and Port number must be good.

Who can build a Synology spk version of OpenHab 3.1? or is there documentation with detailed steps for a non developer I can use to build a spk file

Another option is maybe to run openhab from a raspberry pi.
Is there a way to map the openhab files from a raspberry to a nas?
I mean the following file structure:
image
I want to avoid using a sd card for any data but use the more reliable synology nas for this.

Markus can you create a more detailed error logging to find the issue I have with Synoloy docker.
It is maybe to much asked but I can try :slight_smile:
The error I get is

2021-09-06 21:47:59.194 [WARN ] [y.internal.handler.ShellyBaseHandler] - shellyplug-s-b50ad5: CoIoT peer in device settings does not point this to this host

2021-09-06 21:47:59.196 [INFO ] [elly.internal.coap.ShellyCoapHandler] - shellyplug-s-b50ad5: CoAP Exception (Unknown Host)

The code below is shared by Wolfgang_s.
if the values of the expression in the code below can be logged than I can maybe see the issue

if (config.eventsCoIoT && (tmpPrf.settings.coiot != null) && (tmpPrf.settings.coiot.enabled != null)) {
String devpeer = getString(tmpPrf.settings.coiot.peer);
String ourpeer = config.localIp + “:” + ShellyCoapJSonDTO.COIOT_PORT;
if (!tmpPrf.settings.coiot.enabled || (profile.isMotion && devpeer.isEmpty())) {
try {
api.setCoIoTPeer(ourpeer);
logger.info("{}: CoIoT peer updated to {}", thingName, ourpeer);
} catch (ShellyApiException e) {
logger.debug("{}: Unable to set CoIoT peer: {}", thingName, e.toString());
}
} else if (!devpeer.isEmpty() && !devpeer.equals(ourpeer)) {
logger.warn("{}: CoIoT peer in device settings does not point this to this host", thingName);
}
}

Hi,
I found a working method to connect the shelly devices to a OH3 instance running on a Synology nas in a docker :slight_smile:
Maybe someone can give a explanation for this. I have the shelly device configured with username and password and CoAP protocol enabled. I have the username and password also configured in the shelly binding. I add manually the shelly device and get a error. Then I disable the device go to the advanced settings and disable the CoAP protocol and enable the device again. Then I get a username password error and if I manually enter the username and password it works.
But I also tried the same with disabling CoAP protocol on the device side and in the driver but that gives a different result.
Also any idea what disabling the CoAP protocol means for the connection?

Still searching for a good solution for my shelly devices.
I found maybe a solution to use macvlan.
I created this as follows

docker network create -d macvlan --subnet=192.168.100.0/24 --ip-range=192.168.100.88/29 --gateway 192.168.100.1 -o parent=ovs_eth1 mac-vlan

To run the penhab:3.2.0.M3-debian instance I use the command below

docker run --name=OpenHAB3.2.0.M3.mac-vlan --net=mac-vlan --ip=192.168.100.89 -v /volume1/docker/OpenHab3.1.0/addons:/openhab/addons –v /volume1/docker/OpenHab3.1.0/conf:/openhab/conf -v /volume1/docker/OpenHab3.1.0/userdata:/openhab/userdata -e “EXTRA_JAVA_OPTS=-Duser.timezone=Europe/Amsterdam” -d --restart=always openhab/openhab:3.2.0.M3-debian

but get the following error "docker: invalid reference format."
with winscp I can acces the folders
image

Who can help?

Format error. Is working!