State_trigger float/int conversion of entity_ids that start with a number_number
Glances integration adds generated entity_ids based on the host, provided as a Glances Server.
For example, adding a Glances integration using my Unraid server hostname
generates entity_ids like
sensor.server_hostname_package_id_0_temperature.
But if I add the Glances server by the IP address
Such entity becomes
sensor.192_168_1_3_package_id_0_temperature, and Pyscript cannot parse state_trigger condition float conversions based on this entity_id with SyntaxError: invalid decimal literal
This can be proven by creating a Number Helper input_number.123_465_number
that will fail any
state_trigger that tries to convert its value to float or int
2023-12-01 14:05:41.156 ERROR (MainThread) [custom_components.pyscript.file.tryouts.tryouts] Exception in <file.tryouts.tryouts @state_trigger()> line 1:
float(input_number.123_465_number)
^
SyntaxError: invalid decimal literal (file.tryouts.tryouts @state_trigger(), line 1)
In Python, identifiers starting with a digit are prohibited. You should use state.get("sensor.192_168_1_3_package_id_0_temperature")