Input Datetime error

I’ve been getting this error for a few months now:

Logger: homeassistant.components.input_datetime
Source: helpers/entity_platform.py:592
Integration: Input datetime (documentation, issues)
First occurred: 3:54:13 PM (1 occurrences)
Last logged: 3:54:13 PM

Platform input_datetime does not generate unique IDs. ID hvac_runtime_last_updated already exists - ignoring input_datetime.hvac_runtime_last_updated

I’m running in Docker, version 2021.12. Here is the yaml for this input:

input_datetime:
  hvac_runtime_last_updated:
    name: HVAC Runtime Last Updated
    has_date: true
    has_time: true

It is only set up in one location in my YAML files.

Any ideas?

Yes and it’s the same idea as the reported message: you have another entity whose unique_id contains the value is hvac_runtime_last_updated. Home Assistant refuses to create two entities with the same value of unique_id so it ignores this one.

Either change hvac_runtime_last_updated to something else (like hvac_run_time_last_updated) or find the other entity having the same unique_id value and change it. Either way, one of them has to change to allow both entities to exist.

But there is no other input_datetime (or any other entity) with the name hvac_runtime_last_updated, which is why I’m confused and posting here.

You may believe that but Home Assistant clearly disagrees.

If this was happening on my system, I would start by inspecting the core.entity_registry file (located in the hidden .storage directory). It contains a record of every entity known to Home Assistant (that has a unique_id). I don’t advise you to change anything in it (one mistake and you risk breaking your system). It’s purely to determine if indeed there is an entity with the same unique_id and what is it.

Here’s the record:

            {
                "area_id": null,
                "capabilities": {
                    "has_date": true,
                    "has_time": true
                },
                "config_entry_id": null,
                "device_class": null,
                "device_id": null,
                "disabled_by": null,
                "entity_category": null,
                "entity_id": "input_datetime.hvac_runtime_last_updated",
                "icon": null,
                "id": "b4b167f720f7e81795b5ed2dc25e2235",
                "name": null,
                "original_device_class": null,
                "original_icon": null,
                "original_name": "hvac_runtime_last_updated",
                "platform": "input_datetime",
                "supported_features": 0,
                "unique_id": "hvac_runtime_last_updated",
                "unit_of_measurement": null
            },

This doesn’t really tell me anything though… yes, the entity is there, but it’s also there (only once) in my config files.

So the question is: if the entity is in my config files only once, why would Home Assistant think there is a duplicate entity?

Go look at the list of Helpers and find the input_datetime with that name. At the far right, does it have a pencil icon with a diagonal line through it?

Screenshot_20211213-233133~2

Yes, it does (as do all of my helpers).

Are you using any packages that might have input_datetimes defined?

The only packages I have are ones that I wrote myself. I’ve done a text search on every .yaml file in my home assistant config directory, and hvac_runtime_last_updated only exists once.

Have you tried commenting out the input_datetime’s configuration then restarting Home Assistant? The error message should not reappear and the entity should disappear from view in Developer Tools > States.

I overlooked to mention that if there is another entity with the same unique_id value, it doesn’t have to be an input_datetime.

I commented out the relevant input_datetime and restarted home assistant. The error did not occur, but the entity is still there. Also, if I look at the Helpers tab, that helper no longer has the uneditable icon.

Seems like the helper somehow got set up in the UI, rendering my yaml redundant. Can I delete it from the UI and then reintroduce it with the yaml?

Yes, that is why I suggested you remove the one in configuration.yaml to see if the input_datetime entity disappears from the list. It didn’t so it means it’s still defined, just not via configuration.yaml but via the Helpers menu. That one is now the sole instance and removal of the one in configuration.yaml has eliminated the (attempted) duplicate.

Yes, you can delete the one created via the Helpers menu and reintroduce it via configuration.yaml.

The final step was deleting the UI helper, and then re-intrudcing the YAML helper.

Thanks for your help!

1 Like

To be clear, there was no functional need to delete the one created via the UI other than a preference to have them all defined in configuration.yaml.

Now that the problem has been resolved, please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. It will also place a link below your first post that leads to the solution post. All of this helps users find answers to similar questions. For more information refer to guideline 21 in the FAQ.

I don’t mean to be argumentative, but I do think it’s necessary to be clear that there IS a functional reason to have the configuration in the YAML. If it’s commented out of the YAML, then the package will not function correctly if somebody else tries to implement it.

I understand your point, and agree with it, but that’s a hypothetical because in this case you indicated it was in the configuration.yaml file. Is that not correct?

Ah… I didn’t mean to give that impression. It is indeed in a package I created to keep track of when to replace my HVAC filters. Sorry for the confusion!

No worries; I was under the mistaken impression it wasn’t in a package. You are right, it needs to be defined in YAML.

1 Like