home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.03k stars 29.7k forks source link

Flux TypeError: '<=' not supported between instances of 'NoneType' and 'datetime.datetime' #51342

Closed gislis2 closed 2 years ago

gislis2 commented 3 years ago

The problem

Flux doesn't initiate. I believe it worked on 2021.3.x and stopped working on 2021.4.x Moved to a fresh installation and receive the same error

When I split up the configuration.yaml into a seperate file the Flux integration loads but gives the error when toggled

switch: !include switch.yaml

and switch.yaml:

- platform: flux
  name: Flux
  lights:
    - light.livingroom_tv_backlight
    - light.livingroom_reading
    - light.livingroom_desklamp
    - light.livingroom_cerberus_top
    - light.livingroom_cerberus_middle
    - light.livingroom_cerberus_bottom
    - light.livingroom_ceiling
    - light.kitchen_lightstrip
    - light.kitchen_hallway_ceiling_south
    - light.kitchen_dinnertable
    - light.nanoleaf

    - light.bedroom_nightstand
    - light.bedroom_ceiling_south
    - light.bedroom_ceiling_north

What is version of Home Assistant Core has the issue?

core-2021.5.5

What was the last working version of Home Assistant Core?

core-2021.3.x

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Flux

Link to integration documentation on our website

https://www.home-assistant.io/integrations/flux/

Example YAML snippet

switch:
  - platform: flux
    name: Flux
    lights:
      - light.livingroom_tv_backlight
      - light.livingroom_reading
      - light.livingroom_desklamp
      - light.livingroom_cerberus_top
      - light.livingroom_cerberus_middle
      - light.livingroom_cerberus_bottom
      - light.livingroom_ceiling
      - light.kitchen_lightstrip
      - light.kitchen_hallway_ceiling_south
      - light.kitchen_dinnertable
      - light.nanoleaf
      - light.bedroom_nightstand
      - light.bedroom_ceiling_south
      - light.bedroom_ceiling_north

Anything in the logs that might be useful for us?

Logger: homeassistant
Source: components/flux/switch.py:256
First occurred: 4:37:22 PM (1 occurrences)
Last logged: 4:37:22 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/flux/switch.py", line 256, in async_flux_update
    if stop_time <= start_time:
TypeError: '<=' not supported between instances of 'NoneType' and 'datetime.datetime'

Additional information

No response

gislis2 commented 3 years ago

Probably related to https://github.com/home-assistant/core/issues/36573

probot-home-assistant[bot] commented 3 years ago

flux documentation flux source (message by IssueLinks)

gislis2 commented 3 years ago

Solved it by declaring the start_time and stop_time in yaml Seems like the defaults are broken (NoneType)

ajan1 commented 3 years ago

Same problem here.

gislis2 commented 3 years ago

Same problem here.

Did you try stating the 'optional' values ? (start_time and stop_time)

- platform: flux
  name: Flux
  start_time: "07:00"
  stop_time: "23:00"
  lights:
    - light.livingroom_tv_backlight
    - light.livingroom_reading
  ...
github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.