Lovelace Fan Control Entity Row

(Browser-) Cache? :wink:

I’ve hard refreshed and also tried incognito. Nothing changes. I also changed toggles name to “offf” and not even that changes.

Do changes to js files like these not take effect with a full HA restart? Do you have to reinitialize something?

Yes, you have to do a full HA restart for the js file to get reloaded. Then you may also have to clear the cache again as well after the restart.

But moving the button order around has been a feature request a couple of times. I put it out on the thread as a question a little while ago and no one stated an opinion one way or the other so I didn’t pursue it any further.

Maybe I will now.

1 Like

Yep, have done multiple restarts and cleared cache/launched incognito/checked mobile. No difference.

Probably unrelated, but I’m also having an issue with the BHA Icons Pack, where the icons just come and go without any rhyme or reason. Sometimes they load, sometimes they don’t. Sometimes they load in my main session, but then don’t load in a new incognito session. This is across multiple machines and the Android app. Again, probably unrelated and I don’t expect to get help on that item in this thread. But just in case there’s something about my HA that would be causing cache-related issues, I thought I’d mention it.

Running HA on a RPi4 B 2019 64-bit

EDIT: okay I just realized that the reason I often don’t see the BHA icons in incognito is because incog sessions always load with the backend-selected theme, and so the icons are white-on-white. :man_facepalming:

There’s still some funkiness with those icons from time to time, but not nearly as much as I thought. Disregard that angle.

It must be a cache issue. The code does work the way you wanted it to, that can be seen in the code. I have no idea, which cache it is, Browser, HA, maybe your OS setup? But I don’t see any other reason, why it shouldn’t work… :wink:

What I do in such cases, just to avoid any browser cache issues, run a portable browser and try again (if necessary, delete and re-unzip again). Do a few restarts of HA, or maybe the whole Pi. Caches are sometimes real b**** :crazy_face: :laughing:

Just got a switch with the Fan and Light all in one. Love it. This entity row works well with what i was looking for. Only issue I am having is that when I click the high medium or low the off stays highlighted. But I can confirm that the settings are getting pushed to the switch.

What does the state of the fan in the developers tools states list show when you switch to the different fan speeds?

Shows the stats as off but shows the change in the speed on the right side under Attributes shows the speed changing.

that’s why it won’t work.

the control row looks for the state to change from “off” to un-highlight the “OFF” button.

As far as I know all fans should change their state to “on” when you change speeds to something other than “off” so that seems like a bug in the integration that you should report.

But I think the only way to fix it if you have no other way to fix the mis-reporting state is to create a “template fan” using the controls of your existing fan to get everything to display properly.

It’s not ideal but unless you can get the integration for your fan fixed it’s the only way I know to make it work.

What brand/protocol fan is it?

Its a Treatlife DS03 fairly new product I converted it to Tasmota. I did determine that if i force the state to ON. It does show properly highlighting the speeds. I think it was a snafu with Home Assistant not refreshing my power states. Learn something new everyday. Thanks for your wonderful Entity / Fan Card!

1 Like

Well, that’s strange. As of the last time I converted my iFan03’s to tasmota everything worked with my card out of the gate.

Hopefully it keeps working. If not come back and we’ll see if we can get it straightened out.

1 Like

Template Fan Im using:

fan.yaml:

- platform: template
  fans:
    groupfan:
      friendly_name: "Group Fan"
      value_template: "{{ states('input_boolean.group_fan_state') }}"
      speed_template: "{{ states('input_select.group_fan_set_speed') }}"
      turn_on:
        service: script.group_fan_on
      turn_off:
        service: script.group_fan_off
      set_speed:
        service: script.group_fan_set_speed
        data_template:
          speed: "{{ speed }}"
      speeds:
        - "low"
        - "medium"
        - "high"

scripts.yaml:

group_fan_off:
  alias: Group Fan Off
  sequence:
    - service: fan.turn_off
      entity_id:
        - fan.kitchen
        - fan.living
    - service: input_boolean.turn_off
      entity_id: input_boolean.group_fan_state

group_fan_on:
  alias: Group Fan On
  sequence:
    - service: fan.turn_on
      entity_id:
        - fan.kitchen
        - fan.living
    - service: input_boolean.turn_on
      entity_id: input_boolean.group_fan_state
group_fan_set_speed:
  alias: Group Fan Set Speed
  sequence:
    - service: fan.turn_on
      entity_id:
        - fan.kitchen
        - fan.living
    - service: input_boolean.turn_on
      entity_id: input_boolean.group_fan_state
    - service: fan.set_speed
      data_template:
        entity_id:
          - fan.kitchen
          - fan.living
        speed: "{{speed}}"
    - service: input_select.select_option
      data_template:
        entity_id: input_select.group_fan_set_speed
        option: "{{speed}}"
input_boolean:
  group_fan_state:
    name: Group Fans

input_select:
  group_fan_set_speed:
    name: Group Fan Speed
    options:
      - 'low'
      - 'medium'
      - 'high'

I’m not really sure why it wouldn’t still work.

I’m on v113.1 and my test set up that I used to test the code I gave you still works for me.

Here is my working code (I use all_fans instead of group_fans):

input_boolean:
  all_fans_state:
    name: All Fans State

input_select:
  all_fans_speed:
    name: All Fans Speed
    options:
      - 'low'
      - 'medium'
      - 'high'

fan:
  - platform: template
    fans:
      all_fans:
        friendly_name: "All Fans"
        value_template: "{{ states('input_boolean.all_fans_state') }}"
        speed_template: "{{ states('input_select.all_fans_speed') }}"
        turn_on:
          service: script.all_fans_on
        turn_off:
          service: script.all_fans_off
        set_speed:
          service: script.all_fans_speed
          data_template:
            speed: "{{ speed }}"
        speeds:
          - 'low'
          - 'medium'
          - 'high'

script:
  all_fans_on:
    sequence:
      - service: fan.turn_on
        entity_id:
          - fan.ifan02_test_fan
          - fan.sunroom_fan
      - service: input_boolean.turn_on
        entity_id: input_boolean.all_fans_state
  all_fans_off:
    sequence:
      - service: fan.turn_off
        entity_id:
          - fan.ifan02_test_fan
          - fan.sunroom_fan
      - service: input_boolean.turn_off
        entity_id: input_boolean.all_fans_state
  all_fans_speed:
    sequence:
      - service: fan.turn_on
        entity_id:
          - fan.ifan02_test_fan
          - fan.sunroom_fan
      - service: input_boolean.turn_on
        entity_id: input_boolean.all_fans_state
      - service: fan.set_speed
        data_template:
          entity_id:
            - fan.ifan02_test_fan
            - fan.sunroom_fan
          speed: '{{speed}}'
      - service: input_select.select_option
        data_template:
          entity_id: input_select.all_fans_speed
          option: '{{speed}}'

Thanks that helped. I had added - ‘off’ to the list of speeds for some reason.

Fixed now.

Updated my post with the corrrect code.

1 Like

Has anyone added a fifth button to the row? I have a fan with a 4 speed regulator. An example list would be:

Off
High
Med
Med-Low
Low

I haven’t tho I’ve had requests for a control row with more buttons.

I guess I should just bite the bullet and make some.

But where does it stop? I’ve been asked for a 4 speed, a 5 speed and a 6 speed. I think I even saw someone mention a 10 speed fan once :grimacing:

The more buttons you have the less real estate on the entity row you have for the entity name and it starts to look not so good.

But I think the biggest hurdle I’ll have is coming up with a standardized set of controls. Does everyone with a 4 speed fan call the speeds as you have above or are they going to be off, hi, med-hi, med, low? or some other combination? And the more buttons you add the more complex that becomes.

I guess I could make the speeds configurable in the options but then the configuration starts to become unwieldy.

But give me a few days and I will try to come up with something and make some more.

1 Like

Also as an FYI for anyone who hasn’t seen the other thread about the new cards just be aware that there are breaking changes in the config options. I wanted to get all of the options for the different plugins at least mostly consistent so sorry for the inconvenience.

please see the readme for the new options.

Thanks! I chose med-low because med-high seemed strange when typing it. haha. Anyway, I have no idea how to actually make a standard. Low-Med, High-med, etc. I am willing to jump in and try my hand at helping you out if you need a hand to make it more dynamic.

If anyone cares or is trying to do the same thing. I’m implementing this with my Hunter ceiling fans that have RF remotes for them.
I’ve written out the code for the fans to run via RF transmitter from a wemos D1 mini, but am having issues getting the HA coding and template solid. Seems like the ‘off’ button doesn’t work for me and I’m continually plagued with “Custom element doesn’t exist: fan-control-entity-row.”

My arduino coding is pretty novice so bare with me.
Before sharing the code though, I will mention, I tried to install HACS, and had to do it manually. I could never get the integration to load from the GUI.
I’m running the latest versions as of right now ( 0.114.3 , HASS OS 4.12 , Supervisor v235, Frontend version: 20200811.0 - latest)

I tried to add some of andrey’s html files and things seemed to take a dip and breaking.
I’ve since reverted most of what I can remember I changed, rebooted HA, restarted HA, and cleared cache, but I’m still getting the custom card not found.

Previously, I couldn’t get the buttons to change colors upon selecting. Monitoring the serial from my Wemos, I could tell that all signals were being sent, with the exception of “off” or rather, the command payload I had set to “4”.

Here’s the wemos D1 mini code, I still have to decode the guest bedroom 1’s ceiling fan’s remote codes to binary:


/*   
 * RF Transmitter
 * a Home-Automation-friendly ESP8266-based MQTT Hunter Fan Ceiling Controller
 * Licensed under the MIT License, Copyright (c) 2020 essaysee
*/

#include <ESP8266WiFi.h>
#include <PubSubClient.h>
//#include "config.h"


boolean recordedSignal_fanlow1[] =     {0, 0};
boolean recordedSignal_fanmed1[] =     {0, 0};
boolean recordedSignal_fanhigh1[] =    {0, 0};
boolean recordedSignal_fanoffon1[] =   {0, 0};
boolean recordedSignal_lightoffon1[] = {0, 0};

boolean recordedSignal_fanlow2[] =     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, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0};

int a;

// Mapping NodeMCU Ports to Arduino GPIO Pins
// THIS IS ALL YOU NEED TO CHANGE IN THIS FILE
#define D0 16
#define D2 15
#define D3 0
#define D4 2
#define D5 14
#define D6 12 
#define D7 13
#define D8 15
#define WIFI_SSID "WIFI_NAME_GOES_HERE"
#define WIFI_PASSWORD "WIFI_PASSWORD_GOES_HERE"
#define MQTT_BROKER "MQTT_BROKER_is_TYPICALLY YOUR HA IP ADDRESS"
#define MQTT_CLIENTID "RF_Transmitter"
#define MQTT_USERNAME "MQTT_USERNAME"
#define MQTT_PASSWORD "MQTT_PASSWORD"
#define BEDROOM1_ALIAS "Guest Bedroom 1"
#define BEDROOM2_ALIAS "Guest Bedroom 2"
#define MQTT_ROOM2_ACTION_TOPIC "bedroom/fan/2/action"
#define MQTT_ROOM2_STATUS_TOPIC "bedroom/fan/2/status"
#define MQTT_ROOM1_ACTION_TOPIC "bedroom/fan/1/action"
#define MQTT_ROOM1_STATUS_TOPIC "bedroom/fan/1/status"
#define TRANSMITTER_PIN D2
#define RECEIVER_PIN D8

//THAT WAS ALL YOU NEEDED TO CHANGE IN THE FILE, with the exception of your payloads

const char* ssid = WIFI_SSID;
const char* password = WIFI_PASSWORD;

//const boolean static_ip = STATIC_IP;
//IPAddress ip(IP);
//IPAddress gateway(GATEWAY);
//IPAddress subnet(SUBNET);

const char* mqtt_broker = MQTT_BROKER;
const char* mqtt_clientId = MQTT_CLIENTID;
const char* mqtt_username = MQTT_USERNAME;
const char* mqtt_password = MQTT_PASSWORD;

const char* bedroom1_alias = BEDROOM1_ALIAS;
const char* bedroom2_alias = BEDROOM2_ALIAS;
const char* mqtt_room2_action_topic = MQTT_ROOM2_ACTION_TOPIC;
const char* mqtt_room2_status_topic = MQTT_ROOM2_STATUS_TOPIC;
const char* mqtt_room1_action_topic = MQTT_ROOM1_ACTION_TOPIC;
const char* mqtt_room1_status_topic = MQTT_ROOM1_STATUS_TOPIC;
const int transmitter_pin = TRANSMITTER_PIN;
const int receiver_pin = RECEIVER_PIN;

String availabilityBase = MQTT_CLIENTID;
String availabilitySuffix = "/availability";
String availabilityTopicStr = availabilityBase + availabilitySuffix;
const char* availabilityTopic = availabilityTopicStr.c_str();
const char* birthMessage = "online";
const char* lwtMessage = "offline";

WiFiClient espClient;
PubSubClient client(espClient);

// Wifi setup function

void setup_wifi() {

  delay(10);
  Serial.println();
  Serial.print("Connecting to ");
  Serial.print(ssid);

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);

//  if (static_ip) {
//    WiFi.config(ip, gateway, subnet);
//  }

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.print(" WiFi connected - IP address: ");
  Serial.println(WiFi.localIP());
}

// Callback when MQTT message is received; calls triggerBedroomAction(), passing topic and payload as parameters

void callback(char* topic, byte* payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  
  for (int i = 0; i < length; i++) {
    Serial.print((char)payload[i]);
  }
  
  Serial.println();

  String topicToProcess = topic;
  payload[length] = '\0';
  String payloadToProcess = (char*)payload;
  triggerBedroomAction(topicToProcess, payloadToProcess);
}

// Function that publishes birthMessage

void publish_birth_message() {
  // Publish the birthMessage
  Serial.print("Publishing birth message \"");
  Serial.print(birthMessage);
  Serial.print("\" to ");
  Serial.print(availabilityTopic);
  Serial.println("...");
  client.publish(availabilityTopic, birthMessage, true);
}

void triggerBedroomAction(String requestedRoom, String requestedAction) {
  if (requestedRoom == mqtt_room1_action_topic && requestedAction == "1") {
    Serial.print("Setting ");
    Serial.print(bedroom1_alias);
    Serial.println("'s fan speed to low!");
{
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_fanlow1) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_fanlow1[i]);
      delayMicroseconds(393.9);
    }
//    digitalWrite(transmitter_pin, recordedSignal_fanlow1);

    delayMicroseconds(9000);
  }
  delay(800);
}

  }
  else if (requestedRoom == mqtt_room1_action_topic && requestedAction == "2") {
    Serial.print("Setting ");
    Serial.print(bedroom1_alias);
    Serial.println("'s fan speed to medium!");
{
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_fanmed1) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_fanmed1[i]);
      delayMicroseconds(393.9);
    }
//    digitalWrite(transmitter_pin, recordedSignal_fanmed1);

    delayMicroseconds(9000);
  }
  delay(800);
}

  }
  else if (requestedRoom == mqtt_room1_action_topic && requestedAction == "3") {
    Serial.print("Setting ");
    Serial.print(bedroom1_alias);
    Serial.println("'s fan speed to high!");
{
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_fanhigh1) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_fanhigh1[i]);
      delayMicroseconds(393.9);
    }
//    digitalWrite(transmitter_pin, recordedSignal_fanhigh1);

    delayMicroseconds(9000);
  }
  delay(800);
}

  }
  else if (requestedRoom == mqtt_room1_action_topic && requestedAction == "4") {
    Serial.print("Setting ");
    Serial.print(bedroom1_alias);
    Serial.println("'s fan off!");
{
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_fanoffon1) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_fanoffon1[i]);
      delayMicroseconds(393.9);
    }
//    digitalWrite(transmitter_pin, recordedSignal_fanoffon1);

    delayMicroseconds(9000);
  }
  delay(800);
}

  }
  else if (requestedRoom == mqtt_room1_action_topic && requestedAction == "OFF") {
    Serial.print("Changing ");
    Serial.print(bedroom1_alias);
    Serial.println("'s light status!");
{
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_lightoffon1) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_lightoffon1[i]);
      delayMicroseconds(393.9);
    }

    delayMicroseconds(9000);
  }
  delay(600);
}
    client.publish(mqtt_room1_status_topic, "OFF");
  }

  else if (requestedRoom == mqtt_room1_action_topic && requestedAction == "ON") {
    Serial.print("Changing ");
    Serial.print(bedroom1_alias);
    Serial.println("'s light status!");
{
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_lightoffon1) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_lightoffon1[i]);
      delayMicroseconds(393.9);
    }

    delayMicroseconds(9000);
  }
  delay(600);
}
    client.publish(mqtt_room1_status_topic, "ON");
  }
  
  
  else if (requestedRoom == mqtt_room2_action_topic && requestedAction == "1") {
    Serial.print("Setting ");
    Serial.print(bedroom2_alias);
    Serial.println("'s fan speed to low!");
{
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_fanlow2) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_fanlow2[i]);
      delayMicroseconds(393.9);
    }
    delayMicroseconds(9000);
  }
  delay(800);
}
    client.publish(mqtt_room2_status_topic, "1");
  }
  else if (requestedRoom == mqtt_room2_action_topic && requestedAction == "2") {
    Serial.print("Setting ");
    Serial.print(bedroom2_alias);
    Serial.println("'s fan speed to medium!");
{
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_fanmed2) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_fanmed2[i]);
      delayMicroseconds(393.9);
    }
    delayMicroseconds(9000);
  }
  delay(800);
}
    client.publish(mqtt_room2_status_topic, "2");
  }
  else if (requestedRoom == mqtt_room2_action_topic && requestedAction == "3") {
    Serial.print("Setting ");
    Serial.print(bedroom2_alias);
    Serial.println("'s fan speed to high!");
{
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_fanhigh2) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_fanhigh2[i]);
      delayMicroseconds(393.9);
    }
    delayMicroseconds(9000);
  }
  delay(800);
}
    client.publish(mqtt_room2_status_topic, "3");
  }
  else if (requestedRoom == mqtt_room2_action_topic && requestedAction == "4") {
    Serial.print("Setting ");
    Serial.print(bedroom2_alias);
    Serial.println("'s fan off!");
{
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_fanoffon2) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_fanoffon2[i]);
      delayMicroseconds(393.9);
    }
    delayMicroseconds(9000);
  }
  delay(800);
}
    client.publish(mqtt_room2_status_topic, "4");
  }
  else if (requestedRoom == mqtt_room2_action_topic && requestedAction == "OFF") {
    Serial.print("Changing ");
    Serial.print(bedroom2_alias);
    Serial.println("'s light status!");
  {
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_lightoffon2) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_lightoffon2[i]);
      delayMicroseconds(393.9);
    }
    delayMicroseconds(9000);
  }
  delay(600);
  }
    client.publish(mqtt_room2_status_topic, "OFF");
  }
  else if (requestedRoom == mqtt_room2_action_topic && requestedAction == "ON") {
    Serial.print("Changing ");
    Serial.print(bedroom2_alias);
    Serial.println("'s light status!");
  {
  for (a = 0; a < 8; a++) {
    for (int i = 0; i < sizeof(recordedSignal_lightoffon2) - 1; i++) {
      digitalWrite(transmitter_pin, recordedSignal_lightoffon2[i]);
      delayMicroseconds(393.9);
    }
    delayMicroseconds(9000);
  }
  delay(600);
  }
    client.publish(mqtt_room2_status_topic, "ON");  
  }  
  else { Serial.println("Unrecognized action payload... taking no action!");
 }
}
//ENDS THE ACTION OF WRITING IN SERIAL WHAT WAS RECEIVED AND WHAT IT WAS TOLD TO DO



// Function that runs in loop() to connect/reconnect to the MQTT broker, and publish the current door statuses on connect

void reconnect() {
  // Loop until we're reconnected
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    // Attempt to connect
    if (client.connect(mqtt_clientId, mqtt_username, mqtt_password, availabilityTopic, 0, true, lwtMessage)) {
      Serial.println("Connected!");

      // Publish the birth message on connect/reconnect
      publish_birth_message();

      // Subscribe to the action topics to listen for action messages
      Serial.print("Subscribing to ");
      Serial.print(mqtt_room2_action_topic);
      Serial.println("...");
      client.subscribe(mqtt_room1_action_topic);
      Serial.print("Subscribing also to ");
      Serial.print(mqtt_room1_action_topic);
      Serial.println("...");
      client.subscribe(mqtt_room2_action_topic);
      Serial.println("I am all subscribed.");


    } 
    else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 5 seconds before retrying
      delay(5000);
    }
  }
}



void setup() {
  // Setup the output and input pins used in the sketch
  // Set the lastStatusValue variables to the state of the status pins at setup time

  // Setup Door 1 pins
  pinMode(transmitter_pin, OUTPUT);

  // Setup serial output, connect to wifi, connect to MQTT broker, set MQTT message callback

  Serial.begin(115200);
  delay(2);
  Serial.println("Starting RF transmitter for Hunter Fans...");
  setup_wifi();
  client.setServer(mqtt_broker, 1883);
  client.setCallback(callback);
}

void loop() {
  // Connect/reconnect to the MQTT broker and listen for messages
  if (!client.connected()) {
    reconnect();
  }
  client.loop();
}


It’'s still a work in progress, but I’ll post the updates and revised version once it is working.
Any questions about it, please ask.

I thought I would contribute something before asking for help.

Edit: this wemos/arduino code does NOT publish on EVERY mqtt payload, the code as of today, does.

I ended up reverting to snapshot and cleanly installing again.
I do, however, still have issues with this card. I know the buttons are sending mqtt payloads, but the buttons never change status.

Is there a newer version or a setting I need to make to the .json file?
When I click on H,M,L the mdi icon doesn’t change, as well as the button state doesn’t change. Also, “OFF” button does nothing for me.

Any ideas?

and the fan.yaml:

  - platform: mqtt  
    name: "Guest Bedroom 1 Fan"  
    state_topic: "bedroom/fan/1/status"
    speed_state_topic: "bedroom/fan/1/status"
    state_value_template: >
        {% if value_json.FanSpeed is defined %}
          {% if value_json.FanSpeed == 0 -%}0{%- elif value_json.FanSpeed > 0 -%}2{%- endif %}
        {% else %}
          {% if states.fan.guest_bedroom_1_fan.state == 'off' -%}0{%- elif states.fan.guest_bedroom_1_fan.state == 'on' -%}2{%- endif %}
        {% endif %}
    speed_value_template: "{{ value_json.FanSpeed }}"
    availability:
      - topic: "RF_Transmitter/availability"
    payload_available: Online
    payload_not_available: Offline
    speed_command_topic: "bedroom/fan/1/action"
    payload_low_speed: "1"
    payload_medium_speed: "2"
    payload_high_speed: "3"
    command_topic: "bedroom/fan/1/action"
    payload_off: "OFF"
    payload_on: "2"
    qos: 0
    retain: false
    speeds:
      - off
      - low
      - medium
      - high