Closed fcrisciani closed 3 years ago
Hi! I'll admit the doc is not very clear on that point... Manually adding a gateway is not possible in the configuration.yaml file.
What can be done if the off-chance case where Home Assistant does not auto-discover the gateway is to go in the "Integrations" page and click "Add Integration", then select MyHome from there. This will use the integration's own discovery mechanism that is very similar to the one used by Home Assistant, so it has the same limitations with regards to networking.
The reason for this is that going through this config flow is necessary for Home Assistant in order to create "Devices" and not just "Entities".
So unfortunately the extensions finds a gateway but it's not the one that I want to use and there seems to be no way to change the ip adress from the UI itself. Right now my current workaround is to change the config_flow.py and add the gateway manually in code. I was wondering if you can think to any better way to specify a gateway manually even if there is some auto discovered.
What's your gateway that is not discovered and what is the one that is?
So I have 2 myhome systems that are separate from the myhome bus point of view but they share the same network with the home assistant. The gateway that is not discovered is an hold mh200 that is in the older system apartment.
<!-- G E N E R A L I N F O -->
<date>30/07/2008</date>
<webserver_type>MH200</webserver_type>
<!--VERSIONE_FIRMWARE--> <ver_webserver>2.1.2</ver_webserver> <ver_webserver_hw>0</ver_webserver_hw> <!--ultima service pack installata--> <latest_sp>MH200_2_1_2.fwz</latest_sp>
<!-- G E N E R A L I N F O -->
The other one is a new gateway f452 if I recall correctly the name
Can you show me what the discovery mechanism sees?
You need to run python3.8 /usr/local/lib/python3.8/site-packages/OWNd/discovery.py
in the Home Assistant instance
This is the only things that finds:
bash-5.0# python3 /usr/local/lib/python3.8/site-packages/OWNd/discovery.py
Address: X.X.X.139
Port: 20000
Manufacturer: BTicino S.p.A.
Model: MyHomeServer1
Firmware: 2.32
Serial: <serial>
And this is my current workaround in config_flow.py
mh200 = await OWNGateway.build_from_discovery_info({"address": "X.X.X.254",
"port": 20000, "password": <pass>, "serialNumber": "00:00:11",
"deviceType": "mh200", "friendlyName": "mh200", "manufacturer":"bticino"})
self.gateway = mh200
On Thu, May 6, 2021 at 9:41 AM anotherjulien @.***> wrote:
Can you show me what the discovery mechanism sees? You need to run python3.8 /usr/local/lib/python3.8/site-packages/OWNd/discovery.py in the Home Assistant instance
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/anotherjulien/MyHOME/issues/13#issuecomment-833625204, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN5HCIVBIIQYNYWZ4WAFMLTMK2BZANCNFSM44GGSNAQ .
This seems to indicate your MH200 has multicast traffic issues. Would you be able to capture traffic with wireshark or tcpdump while performing the same test to see if the MH200 actually sends something or not?
So I checked and I guess that device does not have any multicast support (was not there in the firmware). I can see some messages from the .139 but nothing from the .254
Other option is it possible to add a config to disable/ignore discovery? That should allow me to just fill up the field manually right?
If the device does not support SSDP, then for all intents and purposes, it's not supported by this integration. At the moment I'm not planning on adding a fully manual setup for the gateway. But in any case, your workaround allowed you to add it, didn't it? Once it's in the device registry, you don't need to worry about the setup method again.
do you know how to see the device registry in home assistant? if not it's ok, feel free to close this
There's no front-end for it as far as I know, but it's in the /config/.storage/core.device_registry
file.
FYI, fully manual/custom setup of a gateway has been added to version 0.7.7 if you wish to give it a go!
oh nice thanks! Trying it right now
worked like a charm! These are the steps that I took: 1) upgrade to the latest version from hacs 2) I deleted the old integration 3) created the new one, selecting custom 4) insert the new password 5) restart home assistant
Tested that was able to turn on/off a light previously configured.
Thanks again for this change, I totally know that I will probably be the only user of it, really appreciated!
Thank you for testing :-) I'm glad it works well! You're not the only one, but not very far from it ;-)
Anyway, this has the likely benefit to also cover another fringe usecase where the gateway and HA are not in the same network!
I have trouble to manually configure the gateway I installed version 0.8.5 trought HACS (OWNd 0.7.39) and the tried to setup integration, but i received "All MyHome gateways are already configured". I can't find the way to manually set the gateway information
thanks
After i commented these lines in in config_flow.py
# return self.async_abort(reason="all_configured")
i finally see the "custom" field, but when i save i get "Unknown error occurred" and in the log:
2021-11-09 13:11:42 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/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 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 138, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 157, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 246, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 320, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/myhome/config_flow.py", line 157, in async_step_custom user_input["serialNumber"] = device_registry.format_mac( File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 121, in format_mac if len(to_test) == 17 and to_test.count(":") == 5: TypeError: object of type 'MACAddress' has no len()
If i comment there lines: try: user_input["serialNumber"] = device_registry.format_mac( MACAddress(user_input["serialNumber"]) ) except ValueError: errors["serialNumber"] = "invalid_mac"
and set : user_input["serialNumber"] = ("b8:27:eb:14:79:b9",)
the gateway is correctly registered and i can see :
2021-11-09 12:37:40 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=3 2021-11-09 12:38:09 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=1 2021-11-09 12:38:10 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=2 2021-11-09 12:38:10 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=3 2021-11-09 12:38:38 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=1 WHERE=37 2021-11-09 12:38:39 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=1 2021-11-09 12:38:40 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=2 2021-11-09 12:38:40 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=3 2021-11-09 12:39:09 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=1 2021-11-09 12:39:10 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=2 2021-11-09 12:39:10 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=3 2021-11-09 12:39:38 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=1 WHERE=37 2021-11-09 12:39:39 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=1
but after restarting HA i got this error and it crash:
2021-11-09 13:00:21 ERROR (MainThread) [root] Uncaught exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/main.py", line 331, in
Any idea? Thanks!!
Hi @Cadorago I've the same issue. "All MyHome gateways are already configured" Did you find a way to solve it? Many thanks
Hi, In the doc is mentioned:
Can you provide an example of the field to put in the configuration.yaml?