Problems with Customized (derived) MQTT Component

Tags: #<Tag:0x00007f7395324e10>

Hello:
I am relatively new to HA and learning a lot.
I am now trying to add a 4 speed fan, controlled by MQTT, using a customized version of the fan component from the core python code. I have modified the standard fan component to add an additional speed, and modified the MQTT fan file to reference my new fan component. I have added my renamed fan component (now named fan4) and placed it into custom_components.

I have modified the fan-mqtt specifier file as well. When I place the fan mqtt file into custom_components, the configuration check configuration states:

Platform error fan4.mqtt - No module named 'homeassistant.components.mqtt.fan4

I have tried multiple folders and file names and I cannot get the configuration checker to recognize the mqtt file that works with my modified fan4 component.

Where should the MQTT specification file for the fan4 custom component go? I think I have named it properly (fan4.py) and placed it in a folder named mqtt inside custom_components. Thanks in advance.

Paul

I moved the entire set of mqtt components folder into the custom_components folder and added my custom component’s mqtt platform helper file (called fan4.py) to that folder. Now the messages are clearer but I am no closer to resolution. The current error seems to indicate that Home Assistant is looking for the mqtt helper file in the main home assistant folder, not the custom_components folder. Take a look at this error message when I run the check configuration function:

Configuration invalid
Platform error fan4.mqtt - cannot import name 'SPEED_SLOW' from
homeassistant.components.fan' (/usr/src/homeassistant/homeassistant/components/fan/__init__.py)

Any clue how to create a modified mqtt platform file that works with a modified component?