Modern Forms Smart Fans - Integration

Just released a custom component that integrates Modern Forms Smart fans (and their light) into HA

Just got one of these fans recently and thought I’d write my first custom_component for it.

Anyone else who has a fan by this manufacturer, enjoy!

1 Like

This hasn’t been working for me; I get a “Error doing job: Future exception was never retrieved”. Have you needed to make changes as Hass got updated?

I only saw that error when there was a connection issue. Did you setup your fan IP correctly? Did you make it static?

IP is static. Configuration.yaml:

modernforms:
  - host: 192.168.1.159
    name: "Gazebo"
    light: true

your files are in the modernforms subfolder of custom_components.

Did I miss something?

That should work. Does the modern forms app work? I’ve had some issues recently but there was a firmware update and it started working again.
You can also see if the fan is reachable by hitting http:///mf

Im still on HA 0.91, I’ll prob update later and see if anything broke

Also a post with log/trace would be helpful

The app works. I’ll provide a log from home. Thanks for jumping in.

No need to wait; here it is:


Log Details (ERROR)
Wed Jul 10 2019 14:09:18 GMT-0400 (Eastern Daylight Time)
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 355, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 183, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f69ea4de0b8>: Failed to establish a new connection: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.159', port=80): Max retries exceeded with url: /mf (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f69ea4de0b8>: Failed to establish a new connection: [Errno 113] No route to host'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/modernforms/__init__.py", line 61, in update_action
    self.update_status()
  File "/config/custom_components/modernforms/__init__.py", line 121, in update_status
    self._send_request({"queryDynamicShadowData":1})
  File "/config/custom_components/modernforms/__init__.py", line 124, in _send_request
    r = requests.post(self.url, json=data)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.159', port=80): Max retries exceeded with url: /mf (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f69ea4de0b8>: Failed to establish a new connection: [Errno 113] No route to host'))

Hmm, seems it can’t connect.
Can you open up a shell on the same machine as your HomeAssistant and run:

curl -XPOST -d ‘{“queryDynamicShadowData” : 1}’ ‘http://192.168.1.159/mf

FYI, updated to latest HA and everything still works

My homeassistant is running in docker and I suspect that makes a difference. But running your commands on the machine gives me:
curl: (3) Bad URL, colon is first character curl: (3) [globbing] unmatched close brace/bracket in column 2 curl: (1) Protocol "‘http" not supported or disabled in libcurl

that might be a copy/past error. Remove the single ’ before and after the URL.
Otherwise your outgoing http traffic might be blocked

Nope. Removing sets of quotations and running with and without sudo just changed the error to this:
sudo curl -XPOST -d {queryDynamicShadowData : 1} http://192.168.1.159/mf curl: (3) Bad URL, colon is first character curl: (3) [globbing] unmatched close brace/bracket in column 2 curl: (7) Failed to connect to 192.168.1.159 port 80: No route to host

and removing spaces around the colon {queryDynamicShadowData:1} reduced it to a single error:

curl: (7) Failed to connect to 192.168.1.159 port 80: No route to host

could it be the password the modern forms app requires?

This is a connection issue. Which fan do you have? Maybe apis are different? Are you 100% sure thats your fan’s ip?
You fan find it in the app Settings->Devices->select fan

My fan is the Mykonos. The IP field in my app has never populated. Just shows local IP address as “–.--” but the mac address field populates and I’ve used that to assign a static ip at the router.

Hmm, I wonder if you only have Cloud access. The fan’s are supposed to have local access as well as cloud.

56%20PM

When you are on the same wifi network, don’t you see the local (second) icon?

Has the fan ever been firmware updated?

Yes, firmware was updated upon installation (about a month ago). I’m on a different network, and both icons have slashes through them although I appear to be connected to the fan (where did you find the meaning of those icons…I had searched quite a bit without success?). I’ll report back when I’m on the same network.