It seems there is a maximum length for the state field of a sensor. When tried to consolidate all the different dark sky sensors into one, I get the following error:
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity id: sensor.dark_sky. State max length is 255 characters.
Can anyone think of another way around this?
For reference, here is my sensor.yaml entry for the consolidated sensor:
- platform: template
sensors:
dark_sky:
value_template: >
{ "apparent_temperature": {{states('sensor.dark_sky_apparent_temperature') | round(0)}},
"apparent_temperature_0h": {{states('sensor.dark_sky_apparent_temperature_0h') | round(0)}},
"apparent_temperature_1h": {{states('sensor.dark_sky_apparent_temperature_1h') | round(0)}},
"apparent_temperature_2h": {{states('sensor.dark_sky_apparent_temperature_2h') | round(0)}},
"apparent_temperature_3h": {{states('sensor.dark_sky_apparent_temperature_3h') | round(0)}},
"apparent_temperature_4h": {{states('sensor.dark_sky_apparent_temperature_4h') | round(0)}},
"apparent_temperature_5h": {{states('sensor.dark_sky_apparent_temperature_5h') | round(0)}},
"apparent_temperature_6h": {{states('sensor.dark_sky_apparent_temperature_6h') | round(0)}},
"apparent_temperature_7h": {{states('sensor.dark_sky_apparent_temperature_7h') | round(0)}},
"apparent_temperature_8h": {{states('sensor.dark_sky_apparent_temperature_8h') | round(0)}},
"apparent_temperature_9h": {{states('sensor.dark_sky_apparent_temperature_9h') | round(0)}},
"apparent_temperature_10h": {{states('sensor.dark_sky_apparent_temperature_10h') | round(0)}},
"apparent_temperature_11h": {{states('sensor.dark_sky_apparent_temperature_11h') | round(0)}},
"apparent_temperature_12h": {{states('sensor.dark_sky_apparent_temperature_12h') | round(0)}},
"daytime_high_temperature_0d": {{states('sensor.dark_sky_daytime_high_temperature_0d') | round(0)}},
"daytime_high_temperature_1d": {{states('sensor.dark_sky_daytime_high_temperature_1d') | round(0)}},
"daytime_high_temperature_2d": {{states('sensor.dark_sky_daytime_high_temperature_2d') | round(0)}},
"daytime_high_temperature_3d": {{states('sensor.dark_sky_daytime_high_temperature_3d') | round(0)}},
"daytime_high_temperature_4d": {{states('sensor.dark_sky_daytime_high_temperature_4d') | round(0)}},
"icon": "{{states('sensor.dark_sky_icon')}}",
"icon_0d": "{{states('sensor.dark_sky_icon_0d')}}",
"icon_1d": "{{states('sensor.dark_sky_icon_1d')}}",
"icon_2d": "{{states('sensor.dark_sky_icon_2d')}}",
"icon_3d": "{{states('sensor.dark_sky_icon_3d')}}",
"icon_4d": "{{states('sensor.dark_sky_icon_4d')}}",
"icon_0h": "{{states('sensor.dark_sky_icon_0h')}}",
"icon_1h": "{{states('sensor.dark_sky_icon_1h')}}",
"icon_2h": "{{states('sensor.dark_sky_icon_2h')}}",
"icon_3h": "{{states('sensor.dark_sky_icon_3h')}}",
"icon_4h": "{{states('sensor.dark_sky_icon_4h')}}",
"icon_5h": "{{states('sensor.dark_sky_icon_5h')}}",
"icon_6h": "{{states('sensor.dark_sky_icon_6h')}}",
"icon_7h": "{{states('sensor.dark_sky_icon_7h')}}",
"icon_8h": "{{states('sensor.dark_sky_icon_8h')}}",
"icon_9h": "{{states('sensor.dark_sky_icon_9h')}}",
"icon_10h": "{{states('sensor.dark_sky_icon_10h')}}",
"icon_11h": "{{states('sensor.dark_sky_icon_11h')}}",
"icon_12h": "{{states('sensor.dark_sky_icon_12h')}}",
"overnight_low_temperature_0d": {{states('sensor.dark_sky_overnight_low_temperature_0d') | round(0)}},
"overnight_low_temperature_1d": {{states('sensor.dark_sky_overnight_low_temperature_1d') | round(0)}},
"overnight_low_temperature_2d": {{states('sensor.dark_sky_overnight_low_temperature_2d') | round(0)}},
"overnight_low_temperature_3d": {{states('sensor.dark_sky_overnight_low_temperature_3d') | round(0)}},
"overnight_low_temperature_4d": {{states('sensor.dark_sky_overnight_low_temperature_4d') | round(0)}},
"precip_probability": {{states('sensor.dark_sky_precip_probability') | round(0)}},
"precip_probability_0d": {{states('sensor.dark_sky_precip_probability_0d') | round(0)}},
"precip_probability_1d": {{states('sensor.dark_sky_precip_probability_1d') | round(0)}},
"precip_probability_2d": {{states('sensor.dark_sky_precip_probability_2d') | round(0)}},
"precip_probability_3d": {{states('sensor.dark_sky_precip_probability_3d') | round(0)}},
"precip_probability_4d": {{states('sensor.dark_sky_precip_probability_4d') | round(0)}},
"precip_probability_0h": {{states('sensor.dark_sky_precip_probability_0h') | round(0)}},
"precip_probability_1h": {{states('sensor.dark_sky_precip_probability_1h') | round(0)}},
"precip_probability_2h": {{states('sensor.dark_sky_precip_probability_2h') | round(0)}},
"precip_probability_3h": {{states('sensor.dark_sky_precip_probability_3h') | round(0)}},
"precip_probability_4h": {{states('sensor.dark_sky_precip_probability_4h') | round(0)}},
"precip_probability_5h": {{states('sensor.dark_sky_precip_probability_5h') | round(0)}},
"precip_probability_6h": {{states('sensor.dark_sky_precip_probability_6h') | round(0)}},
"precip_probability_7h": {{states('sensor.dark_sky_precip_probability_7h') | round(0)}},
"precip_probability_8h": {{states('sensor.dark_sky_precip_probability_8h') | round(0)}},
"precip_probability_9h": {{states('sensor.dark_sky_precip_probability_9h') | round(0)}},
"precip_probability_10h": {{states('sensor.dark_sky_precip_probability_10h') | round(0)}},
"precip_probability_11h": {{states('sensor.dark_sky_precip_probability_11h') | round(0)}},
"precip_probability_12h": {{states('sensor.dark_sky_precip_probability_12h') | round(0)}},
"summary": "{{states('sensor.dark_sky_summary')}}",
"summary_0d": "{{states('sensor.dark_sky_summary_0d')}}",
"summary_1d": "{{states('sensor.dark_sky_summary_1d')}}",
"summary_2d": "{{states('sensor.dark_sky_summary_2d')}}",
"summary_3d": "{{states('sensor.dark_sky_summary_3d')}}",
"summary_4d": "{{states('sensor.dark_sky_summary_4d')}}",
"summary_0h": "{{states('sensor.dark_sky_summary_0h')}}",
"summary_1h": "{{states('sensor.dark_sky_summary_1h')}}",
"summary_2h": "{{states('sensor.dark_sky_summary_2h')}}",
"summary_3h": "{{states('sensor.dark_sky_summary_3h')}}",
"summary_4h": "{{states('sensor.dark_sky_summary_4h')}}",
"summary_5h": "{{states('sensor.dark_sky_summary_5h')}}",
"summary_6h": "{{states('sensor.dark_sky_summary_6h')}}",
"summary_7h": "{{states('sensor.dark_sky_summary_7h')}}",
"summary_8h": "{{states('sensor.dark_sky_summary_8h')}}",
"summary_9h": "{{states('sensor.dark_sky_summary_9h')}}",
"summary_10h": "{{states('sensor.dark_sky_summary_10h')}}",
"summary_11h": "{{states('sensor.dark_sky_summary_11h')}}",
"summary_12h": "{{states('sensor.dark_sky_summary_12h')}}",
"temperature": {{states('sensor.dark_sky_temperature') | round(0)}},
"temperature_0h": {{states('sensor.dark_sky_temperature_0h') | round(0)}},
"temperature_1h": {{states('sensor.dark_sky_temperature_1h') | round(0)}},
"temperature_2h": {{states('sensor.dark_sky_temperature_2h') | round(0)}},
"temperature_3h": {{states('sensor.dark_sky_temperature_3h') | round(0)}},
"temperature_4h": {{states('sensor.dark_sky_temperature_4h') | round(0)}},
"temperature_5h": {{states('sensor.dark_sky_temperature_5h') | round(0)}},
"temperature_6h": {{states('sensor.dark_sky_temperature_6h') | round(0)}},
"temperature_7h": {{states('sensor.dark_sky_temperature_7h') | round(0)}},
"temperature_8h": {{states('sensor.dark_sky_temperature_8h') | round(0)}},
"temperature_9h": {{states('sensor.dark_sky_temperature_9h') | round(0)}},
"temperature_10h": {{states('sensor.dark_sky_temperature_10h') | round(0)}},
"temperature_11h": {{states('sensor.dark_sky_temperature_11h') | round(0)}},
"temperature_12h": {{states('sensor.dark_sky_temperature_12h') | round(0)}},
"uv_index": {{states('sensor.dark_sky_uv_index') | round(0)}},
"uv_index_0d": {{states('sensor.dark_sky_uv_index_0d') | round(0)}},
"uv_index_1d": {{states('sensor.dark_sky_uv_index_1d') | round(0)}},
"uv_index_2d": {{states('sensor.dark_sky_uv_index_2d') | round(0)}},
"uv_index_3d": {{states('sensor.dark_sky_uv_index_3d') | round(0)}},
"uv_index_4d": {{states('sensor.dark_sky_uv_index_4d') | round(0)}},
"uv_index_0h": {{states('sensor.dark_sky_uv_index_0h') | round(0)}},
"uv_index_1h": {{states('sensor.dark_sky_uv_index_1h') | round(0)}},
"uv_index_2h": {{states('sensor.dark_sky_uv_index_2h') | round(0)}},
"uv_index_3h": {{states('sensor.dark_sky_uv_index_3h') | round(0)}},
"uv_index_4h": {{states('sensor.dark_sky_uv_index_4h') | round(0)}},
"uv_index_5h": {{states('sensor.dark_sky_uv_index_5h') | round(0)}},
"uv_index_6h": {{states('sensor.dark_sky_uv_index_6h') | round(0)}},
"uv_index_7h": {{states('sensor.dark_sky_uv_index_7h') | round(0)}},
"uv_index_8h": {{states('sensor.dark_sky_uv_index_8h') | round(0)}},
"uv_index_9h": {{states('sensor.dark_sky_uv_index_9h') | round(0)}},
"uv_index_10h": {{states('sensor.dark_sky_uv_index_10h') | round(0)}},
"uv_index_11h": {{states('sensor.dark_sky_uv_index_11h') | round(0)}},
"uv_index_12h": {{states('sensor.dark_sky_uv_index_12h') | round(0)}},
"visibility": {{states('sensor.dark_sky_visibility') | round(0)}},
"visibility_0d": {{states('sensor.dark_sky_visibility_0d') | round(0)}},
"visibility_1d": {{states('sensor.dark_sky_visibility_1d') | round(0)}},
"visibility_2d": {{states('sensor.dark_sky_visibility_2d') | round(0)}},
"visibility_3d": {{states('sensor.dark_sky_visibility_3d') | round(0)}},
"visibility_4d": {{states('sensor.dark_sky_visibility_4d') | round(0)}},
"visibility_0h": {{states('sensor.dark_sky_visibility_0h') | round(0)}},
"visibility_1h": {{states('sensor.dark_sky_visibility_1h') | round(0)}},
"visibility_2h": {{states('sensor.dark_sky_visibility_2h') | round(0)}},
"visibility_3h": {{states('sensor.dark_sky_visibility_3h') | round(0)}},
"visibility_4h": {{states('sensor.dark_sky_visibility_4h') | round(0)}},
"visibility_5h": {{states('sensor.dark_sky_visibility_5h') | round(0)}},
"visibility_6h": {{states('sensor.dark_sky_visibility_6h') | round(0)}},
"visibility_7h": {{states('sensor.dark_sky_visibility_7h') | round(0)}},
"visibility_8h": {{states('sensor.dark_sky_visibility_8h') | round(0)}},
"visibility_9h": {{states('sensor.dark_sky_visibility_9h') | round(0)}},
"visibility_10h": {{states('sensor.dark_sky_visibility_10h') | round(0)}},
"visibility_11h": {{states('sensor.dark_sky_visibility_11h') | round(0)}},
"visibility_12h": {{states('sensor.dark_sky_visibility_12h') | round(0)}} }