Open GentleHoneyLover opened 9 months ago
I have the same issue. Just installed it today.
Hi, it gave me a generic error when entering the email address, I tried with the numeric ID and it worked. Have you also checked that you have selected the correct server? Here is the list:
I hope it helps
Seems I have a similar issue
I get the same error for the "automatic" and "manual" method. But in my case, the Airfryer is in my IOT VLAN and my Home Assistant (running in docker) is in my Internal VLAN. I have MDNS reflector running (was already in-place for Google Cast), and I have (temporarily) openend all TCP and UDP ports between the Home Assistant host and the Airfryer (bi-directional).
Any suggestions/help?
Devices found for server "de" @ home "<redacted>":
---------
NAME: Airfryer
ID: <redacted>
MAC: <redacted>
IP: <redacted>>
TOKEN: <redacted>>
MODEL: careli.fryer.maf10a
---------
homeassistant | 2024-04-29 15:12:55.862 ERROR (MainThread) [aiohttp.server] Error handling request
homeassistant | Traceback (most recent call last):
homeassistant | File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/device.py", line 54, in async_connect_device
homeassistant | self._device_info = await self._hass.async_add_executor_job(
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
homeassistant | result = self.fn(*self.args, **self.kwargs)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/local/lib/python3.12/site-packages/miio/click_common.py", line 183, in _wrap
homeassistant | self._fetch_info()
homeassistant | File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 153, in _fetch_info
homeassistant | devinfo = DeviceInfo(self.send("miIO.info"))
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 107, in send
homeassistant | return self._protocol.send(
homeassistant | ^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 161, in send
homeassistant | self.send_handshake()
homeassistant | File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 74, in send_handshake
homeassistant | raise DeviceException("Unable to discover the device %s" % self.ip)
homeassistant | miio.exceptions.DeviceException: Unable to discover the device <redacted>
homeassistant |
homeassistant | The above exception was the direct cause of the following exception:
homeassistant |
homeassistant | Traceback (most recent call last):
homeassistant | File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
homeassistant | resp = await request_handler(request)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
homeassistant | resp = await handler(request)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
homeassistant | return await handler(request)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
homeassistant | return await handler(request)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
homeassistant | return await handler(request)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
homeassistant | return await handler(request)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 88, in ban_middleware
homeassistant | return await handler(request)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
homeassistant | return await handler(request)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
homeassistant | response = await handler(request)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
homeassistant | result = await handler(request, **request.match_info)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 71, in with_admin
homeassistant | return await func(self, request, *args, **kwargs)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
homeassistant | return await super().post(request, flow_id)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
homeassistant | result = await method(view, request, data, *args, **kwargs)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
homeassistant | result = await self._flow_mgr.async_configure(flow_id, data)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 356, in async_configure
homeassistant | result = await self._async_configure(flow_id, user_input)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 402, in _async_configure
homeassistant | result = await self._async_handle_step(
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 506, in _async_handle_step
homeassistant | result: _FlowResultT = await getattr(flow, method)(user_input)
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/config/custom_components/xiaomi_airfryer/config_flow.py", line 280, in async_step_cloud
homeassistant | return await self.async_step_connect()
homeassistant | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant | File "/config/custom_components/xiaomi_airfryer/config_flow.py", line 333, in async_step_connect
homeassistant | await connect_device_class.async_connect_device(self.host, self.token)
homeassistant | File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/device.py", line 61, in async_connect_device
homeassistant | raise SetupException(
homeassistant | homeassistant.components.xiaomi_miio.const.SetupException: DeviceException during setup of xiaomi device with host <redacted>
I found a solution. Turns out Xiaomi devices ignore requests coming from other subnets. Here are some details and solution.
In short, you need to setup NAT masquerading on your router like so:
iptables -t nat -A POSTROUTING -s YOUR_HOMEASSISTANT_IP/32 -d YOUR_DEVICE_IP/32 -j MASQUERADE
After that, the device will be responding to requests coming from home assistant in another subnet. Of course, the firewall should not be preventing that and there should be functioning inter-VLAN routing in place.
Great! That got it connected.
But it looks like the Air Fryer requires Internet Access for all sensors to work. Is that correct?
This integration does not show a "cloud" symbol, so I was kind of expecting it to work fully local without any Internet connectivity.
Not a big deal to let it connect to the Internet, but if it's not required then I'd rather not. :-)
I blocked access for the fryer to internet and dns in my firewall. And it still happily works and shows all sensors. So, maybe the initial configuration requires xiami cloud but after that it works locally.
Hmmm, OK. I had it internet connected to register it with the Xiaomi cloud. Then I blocked internet traffic. Now all my sensors are "Unknown" until I grant the AirFryer Internet access... I'll investigate further and I needed, I'll open a separate issue for that. Thanks for the help!
For those with Ubiquiti devices: it seems that is now possible to masquerade NAT with the new version of Network Application. Works like a charm with my Xiaomi Smart Air Fryer 6.5L.
@gmcinalli, cool — thanks for sharing! I didn't notice it in the changeling. No need to be messing with CLI anymore :)
Would mind sharing a screenshot of how your NAT setting for XIaomi looks like in the UI?
@GentleHoneyLover Sure! Here it is. Source is HA, destination is the AirFryer, interface is the VLAN where the fryer is located.
Same problem. Regards
Quick note: if you're using a UniFi gateway and NAT rules weren't making any difference, I figured out the issue in their iptables implementation and reported the bug to Ubiquiti. I am happy to announce that version v8.5.1 of the UniFi Network Controller fixes this. It's currently in Early Access and should become GA in a few weeks from now.
@ruimarinho Really strange, I was with an older version of UniFi Network until yesterday and everything worked fine.
Same here. NAT settings via web ui work fine for me on v8.4.62
It depends on your equipment upgrade path (for example, if coming from a USG to UXG, UDM from scratch, etc).
Hello,
Trying to configure the integration but it fails. Tried both methods (login + password and IP + token). The Fryer is on and connected to wi-fi. I can control it via the Mi app.
Can you please help! Thanks a ton!
NAME: Mi Smart Air Fryer 3.5L MODEL: careli.fryer.maf07 HASS: 2024.2.2 (running in Docker) Integration installed via HACS.