Making a dumb device smart

Hi guys, this is a strange one. I brought a tower fan which isn’t smart, I can control it use the RM4, the problem I’m having is HA knowing if it’s on or off, I’ve tried a aeotec smart plug with no joy and a vibration sensor with some results but not reliable enough, any help much appreciated.

Why is the smart plug no joy? As long as it has a power usage sensor, and always stays powered on, you should be able to see if the fan is on or off. I do it that way, I even get a reasonable guess of the fan speed from it.

I have a tower fan. I believe that the only way to make this device smart is to tear it apart and see if there is some possibility to add esp board to it. If it is than how to write firmware that will control it. A lot of work. Everything else is more or less but it will not make it smart.

This is in my fan.yaml. It uses a smart plug and a RM4 mini, and does pretty much what I want. It knows if it on or off, I can turn in on and off too. Speed and oscillation is guessed mostly right based on power consumption. Not perfect, but that is ok. Even if the remote controls of the tower fan are horrible (only cycling speed up, no down or fixed settings on the remote. But the real buttons are equally bad, so an esp would not fix that either. Nor would it be easy to know the current speed.

- platform: template
  fans:
    dakkapel:
      friendly_name: "Ventilator dakkapel"
      unique_id: fan.dakkapel
      value_template: "{{ is_state('switch.fan_dakkapel', 'on') and states('sensor.fan_dakkapel_power') | float(0) > 5 }}"
      direction_template: "{{ iif(this.attributes.direction == 'reverse','reverse','forward','forward') }}"
      percentage_template: >-
        {% set p = states('sensor.fan_dakkapel_power') | float(0) %}
        {% if p <= 5 %}0
        {% elif p <= 19 %}40
        {% elif p <= 21 %}20
        {% elif p <= 22.2 %}40
        {% elif p <= 23.5 %}20
        {% elif p <= 25.1 %}60
        {% elif p <= 25.6 %}80
        {% elif p <= 26.5 %}100
        {% elif p <= 27.5 %}60
        {% elif p <= 27.6 %}80
        {% else %}100
        {% endif %}
      oscillating_template: >-
        {% set p = states('sensor.fan_dakkapel_power') | float(0) %}
        {{ p > 22.2 and p <= 23.5 or p >= 26.5 }}
      turn_on:
        service: remote.send_command
        data:
          num_repeats: 1
          command: power
          device: Fan dakkapel
        target:
          entity_id: remote.remote_dakkapel
      turn_off:
        service: remote.send_command
        data:
          num_repeats: 1
          delay_secs: 0.4
          command: power
          device: Fan dakkapel
        target:
          entity_id: remote.remote_dakkapel
      set_percentage:
        service: remote.send_command
        data:
          num_repeats: >-
            {% set n = (100 + percentage - (this.attributes.percentage | int(0))) / 20 % 5 %}
            {{ iif(n < 1, 1, n, 1) }}
          delay_secs: 0.4
          command: speed
          device: Fan dakkapel
        target:
          entity_id: remote.remote_dakkapel
      set_oscillating:
        service: remote.send_command
        data:
          num_repeats: 0
          delay_secs: 0.4
          command: rotate
          device: Fan dakkapel
        target:
          entity_id: remote.remote_dakkapel
      set_direction:
        service: remote.send_command
        data:
          num_repeats: 1
          delay_secs: 0.4
          command: rotate
          device: Fan dakkapel
        target:
          entity_id: remote.remote_dakkapel
      speed_count: 5
2 Likes

I think you done a great job. If and when I go with rm4 for controlling fan I will probably reuse it. :smiley:

1 Like

This is one of the correct ways to handle this as you can use the current sensor for the power reading to tell what its doing, I have this done with my 2in1 washing machine to tell when its idle, or in the washing/drying cycle then back to idle for when its done.

Hi Guys, thanks for the replies, the smart plug doesn’t work as I cant get a power read as the voltage is so low. if you know of a plug that can read power that low please advise.

What voltage you have?

230v, current drawn is very low, so no readings from amps or watts, from aeotec smart 6, unless there is a setting I can change

230 doesn’t sound particularly low, if you get it barefooted through your body it might feel quite high :wink:

Anyway, I don’t know how low your low is, but for example Shelly Pm is reliable an can sense quite low currents.