Personal Custom Component using 'slugs' causes configuration error

I’m trying to get a custom component I’m writing for myself to accept ‘slugs’ via the configuration.yaml like what input_boolean would accept:

input_boolean:
  bool1:
    name: Foo
    initial: off

Mine is simply called reminder and my first test is stuck on something I cannot figure out. I’ve followed the code for input_boolean, and an older custom component that did something similar, but I am getting the following error when I check my configuration:

Invalid config for [reminder]: [air_filter] is an invalid option for [reminder]. Check: reminder->air_filter. (See ?, line ?). 

The configuration.yaml entry:

reminder:
  air_filter:
    friendly_name: 'Replace Air Filter'
    reset_interval: 2

And my config schema in init.py (custom_components/reminder/):

CONFIG_SCHEMA = vol.Schema(
    {
        DOMAIN: cv.schema_with_slug_keys(
            vol.Any(
                {
                    vol.Required(CONF_FRIENDLY_NAME): cv.string,
                    vol.Required(CONF_RESET_INTERVAL): vol.Coerce(int),
                    vol.Optional(CONF_UNIT, default=CONF_UNIT_VALUE): cv.string,
                }, None
            )
        )
    },
    extra=vol.ALLOW_EXTRA)

I can’t find what the difference is between my code and the examples I have. I can’t find any real official documentation explaining any of this, it seems to gloss over the schema stuff.

Any help would be greatly appreciated, this has been causing me a lot of sleepless nights recently and I know it’s something dumb I’m doing, I just can’t see it.

An update of sorts. If I manually stop/start my HA docker container, my component works perfectly. If I validate the configuration through the HA UI in order to do a server restart, it fails with that error and I cannot do the HA restart through the UI.

Maybe it is my lack of understanding voluptuous, but I can never make heads or tails of the error messages on cases like these. Are you sure it isn’t being caused by something inside the individual schema?

Try getting rid if your coerce for example

Thank you so much for your reply, I did figure out the answer. After dissecting my code over and over after seeing your reply I started to chew over how it worked if I manually started/stopped HA and what that meant. If I took out the required fields in the configuration.yaml, I’d get a normal “you forgot this required field” error code. I finally assumed that something else in my code was causing HA to validate something that I didn’t mean to have it validate

With that thread I found that when I was playing around with just doing a platform, I had imported the PLATFORM_SCHEMA to extend it. When I moved on from that idea, I didn’t take the import statement out, so I was importing a PLATFORM_SCHEMA without ‘seeing’ it in my code. That was causing the issue. HA was parsing the PLATFORM_SCHEMA second I assume and finding issue when applying it over my CONFIG_SCHEMA formatted entry.

Thanks to your comment I was able to force myself to look elsewhere and it worked. Can’t thank you enough!!

You are welcome. Thank you for coming back and confirming that I’m not the only one who thinks the error messages from ha’s use of voluptuous are impossible to understand.

Lol no problem. While it was a mistake I made, the error message did not point anywhere useful. If it had blamed a PLATFORM_SCHEMA mismatch, I’d have figured it out sooner. As it stood, I was trying to figure out why it was parsing the same configuration block twice and finding an error the second time over it. Was really confusing. Glad I know what to look for now