that’s strange…
the discover command does not provide any output
bash-5.0# python3.8 /usr/local/lib/python3.8/site-packages/OWNd/discovery.py
bash-5.0# ping 192.168.1.27
PING 192.168.1.27 (192.168.1.27): 56 data bytes
64 bytes from 192.168.1.27: seq=0 ttl=63 time=0.821 ms
64 bytes from 192.168.1.27: seq=1 ttl=63 time=0.396 ms
^C
--- 192.168.1.27 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.396/0.608/0.821 ms
bash-5.0#
on my windows laptop MH201 is discovered.
I saw another user some posts ago, has a similar issue and solved by moving both Gatweay and raspberry on the same physical switch… I just tried but it seems it didn’t helped.
Do you have any other idea?
thanks
Marco
If your Home Assistant instance is in the same network as your gateway and your gateway can be discovered by other devices (like a Windows PC), then it probably means that something is filtering SSDP traffic one way or another
If your switch or router has settings for Multicast traffic or device isolation, this might be something to look into
It is reasonable.
Anyway I still have same problem if I put on same switch mh201 and RPI with home assistant.
My windows laptop is connected with WiFi on the DSL router (so it should be in an even “worse” position, because it involves also another network equipment.
I will have a look if it would be possible to issue a tcpdump to check if I get that packets… but i need to understand if it is possible to run install and run tcpdump
another strange thing is that i was able to detect one of the router in my network by UPnP in home assistant. Isn’t UPnP using SSDP as well?
What do you think?
Any other idea?
If you can get tcpdump installed, yeah, that would be interesting to know.
Do you have any other device that is discovered by HA? Because UPnP is not in itself used by HA to discover things, so your router might have been found by zeroconf for instance…
i got an SSDP packet from a tcpdump session on HASSOS.
I’m currently managing my MH201 by a node-red integration. Can this somehow blocking the correct discovery process of your custom_component?
here the snap of the SSDP packet
if i remember well, also my smart TC samsung and my NAS synlogy were automatically discovered… maye also other devices were automatically discovered but i can’t remember all of them
That is strange because that ST: upnp:rootdevice
packet is exactly the one that is expected, and yet, the device is not discovered…
Can you show me what http://192.168.1.27:80/scenMod.xml
looks like?
sure, here it is
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<URLBase>http://192.168.1.27:80/</URLBase>
<device>
<deviceType>urn:schemas-bticino-it:device:IP scenario module:1</deviceType>
<friendlyName>MH201</friendlyName>
<manufacturer>BTicino S.p.A.</manufacturer>
<manufacturerURL>http://www.bticino.it</manufacturerURL>
<modelDescription>IP Scenario Module</modelDescription>
<modelName>MH201</modelName>
<modelNumber>1.0</modelNumber>
<modelURL>www.bticino.it</modelURL>
<serialNumber>00:03:50:81:05:74</serialNumber>
<UDN>uuid:upnp-IPscenarioModule-1_0-000350810574</UDN>
<serviceList>
<service>
<serviceType>urn:schemas-bticino-it:service:Reachability:1</serviceType>
<serviceId>urn:bticino-it:serviceId:Reachability</serviceId>
<SCPDURL>Reach_Serv.xml</SCPDURL>
<controlURL/>
<eventSubURL/>
</service>
</serviceList>
<presentationURL/>
</device>
</root>
there is also another MH201 in the network, but I don’t want to integrate it as well.
Can somehow conflicting with him during the discovery phase? I know that I can’t integrate both of them…
OK, I think I’ve found something strange…
Could you edit a file in your Home Assistant?
In /usr/local/lib/python3.8/site-packages/OWNd/discovery.py
, line 139, can you replace uuid:upnp-IPscenariomodule-
with uuid:upnp-IPscenarioModule-
please?
I’ve noticed in your screenshot that in your case it’s a capital M for “Module”…
If it works I’ll add this variant int the code and publish it in the next release.
one strange thing is that I see abnormal end of line char
anyway after your edit the output is succesfull
Address: 192.168.1.27
Port: 20000
Manufacturer: BTicino S.p.A.
Model: MH201
Firmware: 1.0
Serial: 00:03:50:81:05:74
Address: 192.168.1.28
Port: 20000
Manufacturer: BTicino S.p.A.
Model: MH201
Firmware: 1.0
Serial: 00:03:50:A1:03:28
but from home assistant GUI, i still cannot add it
The end-of-line thing is an aftereffect of a DOS file format on UNIX, it’s not critical at all, but it makes it a bit more cumbersome to edit files from one system in the other…
Did you restart HA after your edit? It’s probably necessary for the integration to “notice” the change
oh, sure… i don’t think to restart… sorry.
I did it right now, and now i got a different error from GUI
That’s a generic error message that is not sufficient to know what’s going on.
Do you have a more detailed error in the logs for that?
here it is
This error originated from a custom integration.
Logger: aiohttp.server
Source: custom_components/myhome/config_flow.py:100
Integration: MyHome (documentation, issues)
First occurred: 7:49:52 PM (1 occurrences)
Last logged: 7:49:52 PM
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 74, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 131, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 128, in post
return await super().post(request)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 63, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 72, in post
result = await self._flow_mgr.async_init(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 150, in async_init
flow, result = await task
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 176, in _async_init
result = await self._async_handle_step(flow, flow.init_step, data, init_done)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 257, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/myhome/config_flow.py", line 100, in async_step_user
CONF_HOST: self.context[CONF_HOST],
KeyError: 'host'
I think I’ve found an issue specific when “manually” adding a gateway (as opposed to auto-discovered) when there are multiple present on the network.
Give me some time to work on it and I’ll get back to you!
Oh great news.
I thought the one that I used was the only way to add a gateway.
I can switch off the other gateway as a workaround, but I prefer to keep it like that, so I can test your fix.
Thanks
Here you go, I’ve published version 0.7.7 that should fix your issue.
You can (re)install it via HACS, as usual. This will also automatically update OWNd to the latest version at the same time.
While I was knee deep in the config_flow
, I took the time to also add a feature that had been requested multiple times: you can now also add a custom gateway completely manually, with no discovery involved. Theoretically it also means you can now add gateways that are not in the same network as your Home Assistant instance.
Hi Julien,
thank you!
I already update.
Now I go one step forward.
I’m able to select it from drop down menu from the GUI, but i got another error during setup
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/myhome/gateway.py:152
Integration: MyHome (documentation, issues)
First occurred: 2:08:13 PM (1 occurrences)
Last logged: 2:08:13 PM
Error setting up entry MH201 Gateway for myhome
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 269, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/myhome/__init__.py", line 76, in async_setup_entry
await myhome_gateway.connect()
File "/config/custom_components/myhome/gateway.py", line 152, in connect
await self.event_session.connect()
File "/usr/local/lib/python3.8/site-packages/OWNd/connection.py", line 425, in connect
await self._negotiate()
File "/usr/local/lib/python3.8/site-packages/OWNd/connection.py", line 214, in _negotiate
raw_response = await self._stream_reader.readuntil(OWNSession.SEPARATOR)
File "/usr/local/lib/python3.8/asyncio/streams.py", line 629, in readuntil
raise exceptions.IncompleteReadError(chunk, None)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of undefined expected bytes
Apparently the gateway was setup correctly but there was an unknown error opening the event session after setup.
Can you try to just restart HA? I don’t think it will be necessary to setup your gateway again, just observe if the error re-occurs.
I did the restart but seems same error:
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/myhome/gateway.py:152
Integration: MyHome (documentation, issues)
First occurred: 3:38:19 PM (1 occurrences)
Last logged: 3:38:19 PM
Error setting up entry MH201 Gateway for myhome
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 269, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/myhome/__init__.py", line 76, in async_setup_entry
await myhome_gateway.connect()
File "/config/custom_components/myhome/gateway.py", line 152, in connect
await self.event_session.connect()
File "/usr/local/lib/python3.8/site-packages/OWNd/connection.py", line 425, in connect
await self._negotiate()
File "/usr/local/lib/python3.8/site-packages/OWNd/connection.py", line 214, in _negotiate
raw_response = await self._stream_reader.readuntil(OWNSession.SEPARATOR)
File "/usr/local/lib/python3.8/asyncio/streams.py", line 629, in readuntil
raise exceptions.IncompleteReadError(chunk, None)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of undefined expected bytes
I carefully checked and there is another log entry relayed to the component that seems related to the passwrod (I still have default)
This error originated from a custom integration.
Logger: custom_components.myhome
Source: /usr/local/lib/python3.8/site-packages/OWNd/connection.py:308
Integration: MyHome (documentation, issues)
First occurred: 3:38:11 PM (1 occurrences)
Last logged: 3:38:11 PM
Connection requires a password but none was provided while opening test session.This error originated from a custom integration.
Logger: custom_components.myhome
Source: /usr/local/lib/python3.8/site-packages/OWNd/connection.py:308
Integration: MyHome (documentation, issues)
First occurred: 3:38:11 PM (1 occurrences)
Last logged: 3:38:11 PM
Connection requires a password but none was provided while opening test session.
That second set of errors is normal, when gateways are discovered, they are prompted to check if a password is required or not, so nothing to worry about here.
In " /usr/local/lib/python3.8/site-packages/OWNd/connection.py", line 426 should be except ConnectionRefusedError:
, can you try to replace this with except (ConnectionRefusedError, asyncio.IncompleteReadError):
and restart HA?
Edit: nevermind, I’ve found a silly infinite loop error… let me fix it and publish it
1 Like