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

Broken since Hass 2023.12 beta #316

Closed
Paul-Vdp opened this issue Dec 6, 2023 · 34 comments
Closed

Broken since Hass 2023.12 beta #316

Paul-Vdp opened this issue Dec 6, 2023 · 34 comments

Comments

@Paul-Vdp
Copy link

Paul-Vdp commented Dec 6, 2023

Description

Ever since I installed a Hass 2023.12 beta version, EC stopped working. It complains about non-existing states (they DO exist), and about 'not enough values to unpack (expected 2, got 1)' upon override state changes - and ends up doing nothing.

Configuration

mtn_living:
  friendly_name: Motion Living
  sensor: binary_sensor.motion_living_occupancy
  sensor_type: duration
  entity: light.living_wandlichten
#  block_timeout: 1
  service_data:
    brightness_pct: 50
  night_mode:
    start_time: '00:00:00'
    end_time: sunrise
    service_data:
      brightness_pct: 1
  override_states_off: ["off", "unavailable"]
  overrides:
    - binary_sensor.day
    - light.living_luster
    - media_player.tv_living

Steps to reproduce

Steps to reproduce the behavior:

  1. Nothing special - just install a 2023.12 beta

Expected behavior

This is how the component should work:

  1. Control the entities and act on state changes (what else ?)

Actual Behaviour

This is what actually happened:

  1. Does nothing, just generates nonsensical errors

Logs

This error originated from a custom integration.

Logger: custom_components.entity_controller.mtn_living
Source: custom_components/entity_controller/__init__.py:800
Integration: Entity Controller (documentation)
First occurred: 17:15:22 (3 occurrences)
Last logged: 17:26:12

Potential configuration error: State Entity (l) does not exist (yet). Please check for spelling and typos. 'NoneType' object has no attribute 'state'

AND

Logger: homeassistant.helpers.event
Source: helpers/event.py:296
First occurred: 17:15:22 (5 occurrences)
Last logged: 17:26:12

Error while dispatching event for binary_sensor.day to <Job track state_changed event ['binary_sensor.day', 'light.living_luster', 'media_player.tv_living'] HassJobType.Callback <function async_track_state_change.<locals>.state_change_listener at 0x7f381a8516c0>>
Error while dispatching event for binary_sensor.day to <Job track state_changed event ['binary_sensor.day', 'light.keuken_lichten'] HassJobType.Callback <function async_track_state_change.<locals>.state_change_listener at 0x7f381a851e40>>
Error while dispatching event for binary_sensor.day to <Job track state_changed event ['binary_sensor.day', 'media_player.tv_eetkamer'] HassJobType.Callback <function async_track_state_change.<locals>.state_change_listener at 0x7f381a852480>>
Error while dispatching event for light.living_luster to <Job track state_changed event ['binary_sensor.day', 'light.living_luster', 'media_player.tv_living'] HassJobType.Callback <function async_track_state_change.<locals>.state_change_listener at 0x7f381a8516c0>>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 296, in _async_dispatch_entity_id_event
    hass.async_run_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 671, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 240, in state_change_listener
    state_change_dispatcher(event)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 227, in state_change_dispatcher
    hass.async_run_hass_job(
  File "/usr/src/homeassistant/homeassistant/core.py", line 671, in async_run_hass_job
    hassjob.target(*args)
  File "/config/custom_components/entity_controller/__init__.py", line 631, in override_state_change
    self.enable()
  File "/usr/local/lib/python3.11/site-packages/transitions/extensions/nesting.py", line 816, in trigger_event
    res = self._trigger_event(_model, _trigger, None, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/transitions/extensions/nesting.py", line 1016, in _trigger_event
    tmp = self.events[_trigger].trigger(_model, self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/transitions/extensions/nesting.py", line 112, in trigger
    return _machine._process(func)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/transitions/core.py", line 1172, in _process
    return trigger()
           ^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/transitions/extensions/nesting.py", line 127, in _trigger
    res = self._process(event_data)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/transitions/extensions/nesting.py", line 143, in _process
    if trans.execute(event_data):
       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/transitions/core.py", line 272, in execute
    self._change_state(event_data)
  File "/usr/local/lib/python3.11/site-packages/transitions/extensions/nesting.py", line 276, in _change_state
    func()
  File "/usr/local/lib/python3.11/site-packages/transitions/extensions/nesting.py", line 205, in scoped_enter
    self.enter(event_data)
  File "/usr/local/lib/python3.11/site-packages/transitions/core.py", line 124, in enter
    event_data.machine.callbacks(self.on_enter, event_data)
  File "/usr/local/lib/python3.11/site-packages/transitions/core.py", line 1107, in callbacks
    self.callback(func, event_data)
  File "/usr/local/lib/python3.11/site-packages/transitions/core.py", line 1128, in callback
    func(*event_data.args, **event_data.kwargs)
  File "/config/custom_components/entity_controller/__init__.py", line 855, in on_enter_idle
    self.do_transition_behaviour(CONF_ON_ENTER_IDLE)
  File "/config/custom_components/entity_controller/__init__.py", line 1751, in do_transition_behaviour
    self.turn_off_control_entities()
  File "/config/custom_components/entity_controller/__init__.py", line 1302, in turn_off_control_entities
    self.call_service(e, "turn_off")
  File "/config/custom_components/entity_controller/__init__.py", line 1537, in call_service
    domain, e = entity.split(".")
    ^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)

Version

Hass 2023.12.0b5
EC v9.6.1
@ajguerre1
Copy link

Same issue here for official 2023.12. Please help fixing this! Thanks!

@sebfar9172
Copy link

I confirm, i'm going back to 2023.11.3 version

@Pabsilon
Copy link

Pabsilon commented Dec 7, 2023

I had issues in 2023.12, rolling back to 2023.11.3 solved them.

One of my entity controllers would stay stuck forever in an 'active' state - I coulnd't figure out why. Others would work fine. Here's the config of the one messing around:

# Motion Activated Stair Lights
stairs_motion_light:
 # Sensor Config
  sensor:
    - binary_sensor.stairs_occupancy
  sensor_type: duration
  delay: 1
  block_timeout: 360

  # Observable Entity
  entity: light.stairs_led
  state_attributes_ignore:
    - brightness
    - color_temp

  # Extra Actions
  trigger_on_activate: script.toggle_the_stairs
  trigger_on_deactivate: script.turn_off_stairs_smoothly

I'm using scripts because depending on external sensorsI like my lights to behave one way or another

@jeeftor
Copy link

jeeftor commented Dec 8, 2023

I dont know if its related I found an issue in one my blueprints where json wasn't being handled correctly post update - any chance this is related?

@HemiBob
Copy link

HemiBob commented Dec 8, 2023

Yes, same here. I have quite a few rooms using EC, some still work perfectly but others just don't turn the lights on even though the controlling motion detectors show motion.
Very strange, this is day two so I guess I'll roll back a version and see.

Yes, returned to 11.3 and working again.

@m90att
Copy link

m90att commented Dec 8, 2023

Same here

@egelinotte
Copy link

Same issue. EC stopped working. This is painful, I relied a lot of this good component. I am not so sure that this component is still maintained.

@Paul-Vdp
Copy link
Author

Paul-Vdp commented Dec 9, 2023

@danobot Hi Daniel,
Any chance of a solution (soon ...), or must we all say goodbye to our beloved EC, and frantically start searching for an alternative ?
Hoping for the best, but preparing for the worst ?

@jeeftor
Copy link

jeeftor commented Dec 10, 2023

There is always a chance for a solution ... just depends how long you want to wait ... I dont really think .12 added much over .11

12.1 fixed an issue I had with one of my blueprints so keep your fingers crossed

@m90att
Copy link

m90att commented Dec 10, 2023 via email

@jddayley
Copy link

jddayley commented Dec 10, 2023

To fix the issue, I updated the configuration.yaml file by using a list format for specifying sensors and entities. Instead of directly assigning a single sensor or entity. See example below:
sensor:
- binary_sensor.storage_motion
entity:
- switch.storage

VS (Doesn't Work):
sensor: binary_sensor.storage_motion
entity: switch.storage

@m90att
Copy link

m90att commented Dec 10, 2023 via email

@dan-s-github
Copy link

@jddayley thank you very much for figuring this out, updated all my configs to use list style and updated core to 2023.12.1 everything works as expected.

wondering if this actually a bug or a feature?

@Pabsilon
Copy link

@jddayley I did some quick tests and it does indeed seem to solve it. I'll do further testing this afternoon.

If I remember correctly, they recently introduced config processing and error handling to the HA Core - this might've had a side effect on EC...

@egelinotte
Copy link

What about the other features ?
I have now the following setting:

automation_motion_garage:
sensor: binary_sensor.groupe_capteurs_mvt_garage
entity: light.lumiere_garage_switch
delay: 60
sensor_type: duration
# sensor_resets_timer: True
block_timeout: 30

What should be the way to write the whole paragraph ?

@Pabsilon
Copy link

automation_motion_garage:
sensor: binary_sensor.groupe_capteurs_mvt_garage
entity: light.lumiere_garage_switch
delay: 60
sensor_type: duration

sensor_resets_timer: True

block_timeout: 30

Sensor and entities as lists, so:

automation_motion_garage:
sensor: 
  - binary_sensor.groupe_capteurs_mvt_garage
entity: 
  - light.lumiere_garage_switch
delay: 60
sensor_type: duration
# sensor_resets_timer: True
block_timeout: 30

@littlease
Copy link

To fix the issue, I updated the configuration.yaml file by using a list format for specifying sensors and entities. Instead of directly assigning a single sensor or entity. See example below: sensor: - binary_sensor.storage_motion entity: - switch.storage

VS (Doesn't Work): sensor: binary_sensor.storage_motion entity: switch.storage

Confirmed as a workaround. Many thanks!

Something broked at config processing, entities became list of characters instead of strings.

Here debug entry from 2023.12:

2023-12-11 11:53:25.789 DEBUG (MainThread) [custom_components.entity_controller.bathroom_motion_light] Sensor Entities         ['b', 'i', 'n', 'a', 'r', 'y', '_', 's', 'e', 'n', 's', 'o', 'r', '.', 'm', 'o', 't', 'i', 'o', 'n', '_', 'd', 'e', 't', 'e', 'c', 't', 'o', 'r', '_', 'z', 'h', 'a', '_', 'i', 'a', 's', 'z', 'o', 'n', 'e']
2023-12-11 11:53:25.789 DEBUG (MainThread) [custom_components.entity_controller.bathroom_motion_light] Control Entities:       ['l', 'i', 'g', 'h', 't', '.', 'b', 'a', 't', 'h', 'r', 'o', 'o', 'm', '_', 'l', 'i', 'g', 'h', 't', 's']
2023-12-11 11:53:25.789 DEBUG (MainThread) [custom_components.entity_controller.bathroom_motion_light] State Entities:         ['l', 'i', 'g', 'h', 't', '.', 'b', 'a', 't', 'h', 'r', 'o', 'o', 'm', '_', 'l', 'i', 'g', 'h', 't', 's']

and from 2023.10

2023-12-11 14:47:24.133 DEBUG (MainThread) [custom_components.entity_controller.bathroom_motion_light] Sensor Entities         ['binary_sensor.motion_detector_zha_iaszone']
2023-12-11 14:47:24.133 DEBUG (MainThread) [custom_components.entity_controller.bathroom_motion_light] Control Entities:       ['light.bathroom_lights']
2023-12-11 14:47:24.133 DEBUG (MainThread) [custom_components.entity_controller.bathroom_motion_light] State Entities:         ['light.bathroom_lights']

@Pabsilon
Copy link

Hello!

I wanted to add something to the fix following my own tests at home.

To fix the issue, I updated the configuration.yaml file by using a list format for specifying sensors and entities. Instead of directly assigning a single sensor or entity. See example below: sensor: - binary_sensor.storage_motion entity: - switch.storage

VS (Doesn't Work): sensor: binary_sensor.storage_motion entity: switch.storage

If your setup uses 'trigger_on_activate' and 'trigger_on_deactivate', both have to be set as lists too.

@jeeftor
Copy link

jeeftor commented Dec 11, 2023

Core moved to orjson from strict json - probably a yaml parsing error with the new lib

@jeeftor
Copy link

jeeftor commented Dec 11, 2023

home-assistant/core#105309
home-assistant/core#105323

I'm guessing something here is related. If you can figure iut out they can get it fixed fast

@hvddrift
Copy link

hvddrift commented Dec 14, 2023

To fix the issue, I updated the configuration.yaml file by using a list format for specifying sensors and entities. Instead of directly assigning a single sensor or entity. See example below: sensor: - binary_sensor.storage_motion entity: - switch.storage

VS (Doesn't Work): sensor: binary_sensor.storage_motion entity: switch.storage

Just for interest, Mine is in a list format:
Always has been, but only - binary_sensor.philips_hallway_motion_occupancy triggers the lights, the others are ignored.

  motion_light: # serves as a name
    sensor:
      - binary_sensor.philips_hallway_motion_occupancy # required, [sensors]
      - binary_sensor.konnected_7e1888_zone_2
      - binary_sensor.konnected_7e1888_zone_3
      - binary_sensor.pad_door_contact
    entity:
      - light.first_hallway_lamp```
      
      

@jddayley
Copy link

I would turn on debugging and share the output.

@dominicusmento
Copy link

To fix the issue, I updated the configuration.yaml file by using a list format for specifying sensors and entities. Instead of directly assigning a single sensor or entity. See example below: sensor: - binary_sensor.storage_motion entity: - switch.storage
VS (Doesn't Work): sensor: binary_sensor.storage_motion entity: switch.storage

Just for interest, Mine is in a list format: Always has been, but only - binary_sensor.philips_hallway_motion_occupancy triggers the lights, the others are ignored.

  motion_light: # serves as a name
    sensor:
      - binary_sensor.philips_hallway_motion_occupancy # required, [sensors]
      - binary_sensor.konnected_7e1888_zone_2
      - binary_sensor.konnected_7e1888_zone_3
      - binary_sensor.pad_door_contact
    entity:
      - light.first_hallway_lamp```
      
      

the problem reflects on the parsing completely, attribute doesn't matter.. so use list for entities too.. it will work..
You also have to use the plural -> sensors

@dominicusmento
Copy link

To fix the issue, I updated the configuration.yaml file by using a list format for specifying sensors and entities. Instead of directly assigning a single sensor or entity. See example below: sensor: - binary_sensor.storage_motion entity: - switch.storage

VS (Doesn't Work): sensor: binary_sensor.storage_motion entity: switch.storage

this should definitely be defined in plural ->

sensors:
  - binary_sensor.storage_motion
entities:
  - switch.storage

@VimalO
Copy link

VimalO commented Jan 3, 2024

To fix the issue, I updated the configuration.yaml file by using a list format for specifying sensors and entities. Instead of directly assigning a single sensor or entity. See example below: sensor: - binary_sensor.storage_motion entity: - switch.storage

VS (Doesn't Work): sensor: binary_sensor.storage_motion entity: switch.storage

That worked for me too!
Thanks a lot @dominicusmento !

@dan-s-github
Copy link

Just for the records.
If there is only one sensor/entity I use singular notation (with a -)

storage_motion:
  sensor: 
    - binary_sensor.storage_motion
  sensor_type: duration
  sensor_resets_timer: true
  entity: 
    - light.storage_downlights

and plural notation if there are multiple values

attic_motion:
  sensors:
    - binary_sensor.attic_motion
    - binary_sensor.everything_presence_one_pir
    - binary_sensor.attic_presence_enhancer
  sensor_type: duration
  sensor_resets_timer: true
  entity: 
    - light.attic_battons

sorry don't currently use multiple entites

@dominicusmento
Copy link

Technically, you are wrong.. by defining an array (list) in yaml, you should always use plural; doesn't matter how many records are there in it.. and you did it by changing this:

entity: light.attic_battons

to this:

entity: 
    - light.attic_battons

https://www.baeldung.com/spring-boot-yaml-list#quick-recap-about-lists-in-yaml

If it accidentally works is another thing but better get rid of singularity here..

@dan-s-github
Copy link

I work with spring-boot on a daily basis and it doesn't actually care if the key is singular or plural.
It will just instantiate a list when you use list notation instead of a single object.

But for clarity it would be recommended to use plural keys when using list values.

Unfortunately all the config examples on this component use singular naming but code shows that it handles both options and that's why both are valid.

CONF_CONTROL_ENTITIES = "entities"
CONF_CONTROL_ENTITY = "entity"

@jeeftor
Copy link

jeeftor commented Jan 4, 2024

Does this work with 2024.1?

I'm still on 2023.11

@jeeftor
Copy link

jeeftor commented Jan 5, 2024

I just tried ton 24.1 and it still doesn't work for me ... I could prob fix it if I wasn't so busy right now

@ryanwinter
Copy link

To fix the issue, I updated the configuration.yaml file by using a list format for specifying sensors and entities. Instead of directly assigning a single sensor or entity. See example below: sensor: - binary_sensor.storage_motion entity: - switch.storage

VS (Doesn't Work): sensor: binary_sensor.storage_motion entity: switch.storage

Genius, this fixed it for my running 2024.1!

@jeeftor
Copy link

jeeftor commented Jan 6, 2024

I got mine working :)

danobot added a commit that referenced this issue Jan 13, 2024
@danobot danobot mentioned this issue Jan 13, 2024
8 tasks
danobot added a commit that referenced this issue Jan 13, 2024
* fix: resolve defect #316
@danobot
Copy link
Owner

danobot commented Jan 13, 2024

Hi all, please update to 9.7.1 which contains a fix for configuration loading (string values vs list values). @Paul-Vdp please close issue once fix has been verified.

@dan-s-github
Copy link

After updating to 9.71 and reverting the configuration changes I can confirm that issue has been resolved.

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