Modern Forms Smart Fans - Integration

Following up on the above.

  • Fan reboot appears to be a very inexpensive operation (it takes only a few seconds; when continuisly running ping, only one or two responses are lost)
  • I ran a packet capture while rebooting the fan from the app, and as I expected, it’s trivial:

I plan to add a periodic reboot to my HA setup via an automation (I’d say even doing this 4 times a day would not be horrible. It’s also a silent operation - no beeps, and safe to do in a bedroom overnight).

This may be a viable workaround for our woes. I have not contacted MF support about any of this, and to be honest, I do not believe they’d be open to feedback and troubleshooting, since their grand scheme of integration seems to be to rely on their cloud.

Worth pointing out is that fans are rather chatty on multicast, so there is space for improvement for discovery and integration, but that may be over my time budget at the moment.

A side note… it is horrifying that this whole API is in plain-text, with no authentication whatsoever. The IoT scares the s. out of me. Then again, I’m glad they’re clueless, since reverse-engineering is beyond trivial.

Another theory:
Assumptions: I think the Fan may only allow a single TCP connection (or some other limited number). This should be easy to test (just open a few connections to it and do nothing). I haven’t been home in ages so I can’t test.

If the above assumption is correct and for some reason HA is leaking connections, we might starve it from our polling, (hence your prober failing too). This means eventually it should recover if we kill HA.

That may be a good theory. I am not sure if it matches my observations though (which doesn’t mean it’s not correct!)

In my case, when a fan becomes unresponsive, it’s not even responding to ping, or the wall remote. It appears to just be completely dead. Hard-reset from the wall switch (essentially a power cycle) brings it back to life, but often I need to re-pair the remote as well.

This sounds like a bad module.

I actually have a bad module too. One of my fans decides to reset out of the blue and it needs re-pairing. I got it replaced by modern forms but I never had the chance to replace it. The fan install was a pain

Possibly, but both of my brand new fans are behaving the same way, and that sounds a little too much to be a bad module. Perhaps.

OK, so here’s my first shot at a workaround for locking fans. Anyone struggling with this, please give this one a try. The following will reboot the fans 3x a day.

Note: The fans I have (Roboto 52) handle this kind of a reboot in an undistruptive way: if they are on, they stay on, if they are off, they stay off.

  • configuration.yaml:
    rest_command:
      reboot_mf_fan_one:
        url: "http://{{ip_address_one}}/mf"
        method: POST
        payload: '{"reboot": true}'
        content_type: "application/json; charset=utf-8"
      reboot_mf_fan_two:
        url: "http://{{ip_address_two}}/mf"
        method: POST
        payload: '{"reboot": true}'
        content_type: "application/json; charset=utf-8"
    
  • automations.yaml:
    - id: reboot_mf_fans
      alias: Reboot MF Fans
      description: ""
      trigger:
        platform: time
        at:
          - "00:00:00"
          - "08:00:00"
          - "16:00:00"
      condition: []
      action:
        - service: rest_command.reboot_mf_fan_one
        - service: rest_command.reboot_mf_fan_two
      mode: single
    
3 Likes

Installed your automation for my 3 MF fans Marko. Will let you know if fans fall off line.
I just installed a nightly reboot (al la jimpastos) to see if this helped, I will deactivate this for now so I can see if fans fall off line (HA reboot hid information in the log files).
Paul

This change to line 64 of init.py
self.poll = async_track_time_interval(hass, update_action, timedelta(seconds=interval))
in combination with an increase in the scan_interval to 30 seconds looks to have solved my ~12 hour lockup problem. I’m up to about 3 days without any issues or failues. Spoke too soon… died after 5 days.

modernforms:
  - host: 192.168.XXX.XXX
    name: Bedroom Fan
    light: true
    scan_interval: 30

I’ve documented this as well in

Trying the reboot automation now…

Update: 2020-10-01
Reboot automation worked perfectly. Not 1 issue in over 2 weeks!!!
Thanks @icemarkom

1 Like

I was having similar issues with the locking up of Lovelace.
These comments helped me. I also patched the leaking exception by fixing the _send_request method in the bottom of __init__.py

  def _send_request(self, data):
    try:
      r = requests.post(self.url, json=data)
      r.raise_for_status()
      self.data = r.json();
      self._notify()
    except requests.exceptions.RequestException as e:
      _LOGGER.error("An error occurred while making a request. {}".format(repr(e)))

I’m having similar issues and I tried your rest command/automation but it returns either an error or a timeout warning. If you ran into this or have any input, I’d appreciate it.

I am seeing the exact same error. I can send curl command and control all attributes of the fan, but a reboot command fails.

I think that’s either expected (WARNING), or too late (ERROR).

Expected, because the reboot command returns nothing, so in theory, reboot request will eventually time-out, and report the warning. You can confirm this by setting up automation to run at a specific time, and run ping to your fan at the same time. If reboot is successful, you will lose 2-3 ping packets.

Too late, means the fan was already stuck when you tried to reboot it, and there is nothing you can do software-wise to recover it. It’s time to power-cycle. You can confirm this by pinging the fan, and confirming that it’s not responding.

That being said, I see the same warning messages in my log, but I’ve learned to live with them.

Thanks, your comments got me thinking to send back to back requests and the fan rebooted. A single request times out.

My firmware upgraded about a month ago. I was wondering if anyone noted this and tried to see if Marko’s reboot automation is still needed. Unless anyone has tested this with firmware 02.00.0017 / 02.05.002 and found the reboots are still needed, I might check this out.

Thank you for bringing this up! I, too, upgraded, but I have not disabled my reboot automation until now. I have disabled it right now, and I will try the fans in a few days to see if they are still alive and well :slight_smile:

Me too. Will report back…
Paul

Locked up in under a day. Reboots are back.

No lockups here ~30 hr.
Paul

I turned off Marko’s ModernForms reboot utility 4 days ago. Still no loss of connections!
I am using firmware 02.00.0017 / 02.05.002 on these fans.
Paul Earley