Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems serializing datetimes? #239

Open
andreala opened this issue Dec 19, 2024 · 0 comments
Open

Problems serializing datetimes? #239

andreala opened this issue Dec 19, 2024 · 0 comments

Comments

@andreala
Copy link

Just installed ltss, having some problems with certain events that fail serialization?
Can't find identical errors, but seems to be related to the component Adaptive Lighting (which allows for dimming lights according to time/outside light etc).

`Dec 19 15:36:42 hub homeassistant[98365]: File "/usr/local/lib/python3.13/json/encoder.py", line 180, in default
Dec 19 15:36:42 hub homeassistant[98365]: raise TypeError(f'Object of type {o.class.name} '
Dec 19 15:36:42 hub homeassistant[98365]: f'is not JSON serializable')
Dec 19 15:36:42 hub homeassistant[98365]: sqlalchemy.exc.StatementError: (builtins.TypeError) Object of type time is not JSON serializable

Dec 19 15:36:42 hub homeassistant[98365]: [SQL: INSERT INTO ltss (time, entity_id, state, attributes, location) VALUES (%(time)s, %(entity_id)s, %(state)s, %(attributes)s::JSONB, ST_GeomFromEWKT(%(location)s))]
Dec 19 15:36:42 hub homeassistant[98365]: [parameters: [{'attributes': {'configuration': {'lights': ['light.glassgangen'], 'interval': 90.0, 'transition': 45.0, 'initial_transition': 1.0, 'min_brightness': ... (1436 characters truncated) ... (2024, 12, 19, 14, 31, 24, 402459, tzinfo=datetime.timezone.utc), 'state': 'on', 'entity_id': 'switch.adaptive_lighting_adaptlight', 'location': None}]]
Dec 19 15:36:43 hub homeassistant[98365]: 2024-12-19 14:36:43.938 ERROR (LTSS) [custom_components.ltss] Error saving event: <Event state_changed[L]: entity_id=switch.adaptive_lighting_adaptlight, old_state=<state switch.adaptive_lighting_adaptlight=on; configuration=lights=['light.glassgangen'], interval=90.0, transition=45.0, initial_transition=1.0, min_brightness=5, max_brightness=85, min_color_temp=2000, max_color_temp=5500, prefer_rgb_color=False, sleep_brightness=1, sleep_rgb_or_color_temp=color_temp, sleep_color_temp=1000, sleep_rgb_color=[255, 56, 0], sleep_transition=1.0, transition_until_sleep=True, sunrise_time=None, min_sunrise_time=06:30:00, max_sunrise_time=07:30:00, sunrise_offset=0.0, sunset_time=None, min_sunset_time=22:00:00, max_sunset_time=23:30:00, sunset_offset=0.0, brightness_mode=tanh, brightness_mode_time_dark=900.0, brightness_mode_time_light=3600.0, take_over_control=True, detect_non_ha_changes=True, autoreset_control_seconds=0, only_once=False, adapt_only_on_bare_turn_on=True, separate_turn_on_commands=False, send_split_delay=0, adapt_delay=0.0, skip_redundant_commands=False, intercept=True, multi_light_intercept=True, include_config_in_attributes=True, name=AdaptLight, manual_control=[], brightness_pct=84.99999999997215, color_temp_kelvin=5460, color_temp_mired=183, rgb_color=(255, 236.7670125227218, 221.00868521073232), xy_color=(0.355, 0.344), hs_color=(27.429, 13.725), sun_position=0.9882480975290532, force_rgb_color=False, autoreset_time_remaining=, icon=mdi:theme-light-dark, friendly_name=Adaptive Lighting: AdaptLight @ 2024-12-19T15:25:28.066744+01:00>, new_state=<state switch.adaptive_lighting_adaptlight=on; configuration=lights=['light.glassgangen'], interval=90.0, transition=45.0, initial_transition=1.0, min_brightness=5, max_brightness=85, min_color_temp=2000, max_color_temp=5500, prefer_rgb_color=False, sleep_brightness=1, sleep_rgb_or_color_temp=color_temp, sleep_color_temp=1000, sleep_rgb_color=[255, 56, 0], sleep_transition=1.0, transition_until_sleep=True, sunrise_time=None, min_sunrise_time=06:30:00, max_sunrise_time=07:30:00, sunrise_offset=0.0, sunset_time=None, min_sunset_time=22:00:00, max_sunset_time=23:30:00, sunset_offset=0.0, brightness_mode=tanh, brightness_mode_time_dark=900.0, brightness_mode_time_light=3600.0, take_over_control=True, detect_non_ha_changes=True, autoreset_control_seconds=0, only_once=False, adapt_only_on_bare_turn_on=True, separate_turn_on_commands=False, send_split_delay=0, adapt_delay=0.0, skip_redundant_commands=False, intercept=True, multi_light_intercept=True, include_config_in_attributes=True, name=AdaptLight, manual_control=[], brightness_pct=84.99999999997215, color_temp_kelvin=5460, color_temp_mired=183, rgb_color=(255, 236.7670125227218, 221.00868521073232), xy_color=(0.355, 0.344), hs_color=(27.429, 13.725), sun_position=0.9882480760144345, force_rgb_color=False, autoreset_time_remaining=, icon=mdi:theme-light-dark, friendly_name=Adaptive Lighting: AdaptLight @ 2024-12-19T15:25:28.066744+01:00>>`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant