Invalid decimal literal warning

I have this warning in my log, but I have no idea where to potentially find the problem because of how vague it is:

Logger: py.warnings
Source: helpers/template.py:333
First occurred: 10:00:33 AM (2 occurrences)
Last logged: 10:00:42 AM

<unknown>:1: SyntaxWarning: invalid decimal literal

One of your entity object_ids starts with a number.

# domain.object_id 

# e.g.

light.1234_lifx

# domain == "light"

# object_id == "1234_lifx"

And you or HA is trying to use that object_id without using square bracket notation. See: https://www.home-assistant.io/docs/configuration/templating/#entity_id-that-begins-with-a-number

So you may be trying to access the last_updated or last_changed property of an entity like this:

{{ states.light.1234_lifx.last_updated }}

When you (or HA) should be doing:

{{ states.light['1234_lifx'].last_updated }}

# or

{{ states.light['1234_lifx']['last_updated'] }}

Is there another error near the one you showed above that may reveal more info on where this is occurring?

1 Like

I don’t see any errors nearby that would be causing it. Is it possible to export my entities into a csv or something? I’m just trying to figure out where this might be referenced.

Try changing the logging level to debug. That may reveal more information. Don’t leave the level at debug for longer than necessary as it is very chatty and will create a huge log file.

# Example configuration.yaml entry
logger:
  default: debug

It isn’t happening consistently. I looked in the logbook and nothing happened during the time that it happened. I restarted my server yesterday morning and it happened today at 12:25:57PM and 12:26:01PM.

I don’t think I can realistically keep debugging on for 12+ hours hoping that something will happen.