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
72.67k stars 30.42k forks source link

knx.event_register dosen't work anymore with Update to 2023.1.2 #85503

Closed MarcW22 closed 1 year ago

MarcW22 commented 1 year ago

The problem

Hi,

Unfortunately the knx.event_register doesn’t work anymore after i made the core update to 2023.1.2. I use this for the relative dimming with an automation with this Blueprint

I also tried to solve the issue by adding the following lines to my knx.yaml

# Begin of Event
event:
  - address:
      - "0/1/40"
  - address:
      - "0/2/40"
# End of Event

And this is the automation:

alias: "Wohnzimmer Decke "
description: ""
use_blueprint:
  path: farmio/knx-relative-dimming-for-lights.yaml
  input:
    switch_address: 0/1/40
    dimm_address: 0/2/40
    dimm_time: 3
    target_lights:
      device_id:
        - 5b36f47bf5ee53e33bf8912e0dff5833
        - f559829d512a0319d3c587959901a4fb
        - ee4a782acaf7c1e8e12e42a60adc03fc
        - dc6fe14f11bff61e96f2e7dcec6256e4
        - 21a28f9cb8e990a1df156e32b264256e
        - 0e87dc7ce5d26514033df22fb17f3ae0
        - 9cc090fe3572bb23fdd029e7bdcde570
        - b1c79ad98b63846c292e9d5d18e30553
        - df327e95719d6dc885aa4dcc69d488f3
        - 719048010817cae0fc379aaa9a14d308
    initial_color:
      - 255
      - 206
      - 120
    dimm_steps: 10

I am not 100% sure if this is a Bug but after I went back to 2023.1.1 it worked fine again.

image

What version of Home Assistant Core has the issue?

2023.1.2

What was the last working version of Home Assistant Core?

2023.1.1

What type of installation are you running?

Home Assistant OS

Integration causing the issue

KNX

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

# Begin of Event
event:
  - address:
      - "0/1/40"
  - address:
      - "0/2/40"
# End of Event

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @julius2342, @farmio, @marvin-w, mind taking a look at this issue as it has been labeled with an integration (knx) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `knx` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign knx` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


knx documentation knx source (message by IssueLinks)

farmio commented 1 year ago

Hi 👋!

This seems awkward - there were no changes in KNX from 2023.1.0 until now. Nevertheless I have had an occasion where the event_register service did not work too in one of the last 2022.12 releases, but didn't see any error message like yours, or any log output 🤔 nor could I reproduce it.

How do you get to show that message screen? Was the KNX integration loaded properly when the service was used?

Trying the service on current 2021.1.2 seems to work fine.

MarcW22 commented 1 year ago

Hi farmio,

i checked the release notes and didn't find any changes. I got the error direct after restart from HA after the update. It showed me a notification that 4 of my automations have an issue under the repair section in HA.

I went back to 2023.1.1 and now it works again. I Try to make the update on my test environment later this day and try to upload the diagnostics etc.

Cheers, Marc

MarcW22 commented 1 year ago

Ah by the way i added some extra lines to your blue print as i use philips Hue + ambilight and needed to give Color and brightness as well to the blueprint

blueprint:
  name: KNX - relative dimming for lights
  description:
    Controll Home Assistant Light entities from KNX switching and relative
    dimming (DPT 3.007) telegrams.
  domain: automation
  input:
    target_lights:
      name: Light
      description: The lights that shall be controled.
      selector:
        target:
          entity:
            domain: light
    switch_address:
      name: Switch group address
      description:
        "Group address for switching the lights on and off. DPT 1 Example:
        '1/2/3'

        "
    dimm_address:
      name: Relative dimming address
      description:
        "Group address for dimming the lights. DPT 3.007 Example: '1/2/4'

        "
    dimm_time:
      name: Dimm time
      description: Time dimming from 0 to 100% shall take.
      selector:
        number:
          min: 1.0
          max: 20.0
          step: 0.1
          unit_of_measurement: seconds
          mode: slider
      default: 3
    dimm_steps:
      name: Dimm steps
      description: Steps used to dimm from 0 to 100%.
      selector:
        number:
          min: 2.0
          max: 100.0
          step: 1.0
          unit_of_measurement: steps
          mode: slider
      default: 10
    # NEW MARC BEGIN
    initial_value:
      name: Initial value
      description: Initial value for light on, from 20% to 100%.
      selector:
        number:
          min: 20
          max: 100
          step: 10
          unit_of_measurement: "%"
          mode: slider
      default: 100

    initial_color:
      name: Initial value
      description: Initial color for light on.
      selector:
        color_rgb:
      default:
        - 255
        - 206
        - 120

  # NEW MARC END

  source_url: https://community.home-assistant.io/t/knx-relative-dimming-for-lights/273473
mode: restart
max_exceeded: silent
variables:
  # NEW MARC BEGIN
  _initial_value: !input initial_value
  _initial_color: !input initial_color
  # NEW MARC END
  _dimm_time: !input dimm_time
  _dimm_steps: !input dimm_steps
  dimm_time: "{{ _dimm_time|float }}"
  dimm_steps: "{{ _dimm_steps|int }}"
  dimm_step: "{{ (255 / dimm_steps) | round(0, 'ceil') }}"
  dimm_delay: "{{ dimm_time * 1000 / dimm_steps }}"
trigger:
  - platform: homeassistant
    event: start
    id: initialize
  - platform: event
    event_type: automation_reloaded
    id: initialize
  - platform: event
    event_type: service_registered
    event_data:
      domain: knx
      service: event_register
    id: initialize
  - platform: event
    event_type: knx_event
    event_data:
      destination: !input switch_address
      telegramtype: GroupValueWrite
    id: switch
  - platform: event
    event_type: knx_event
    event_data:
      destination: !input dimm_address
      telegramtype: GroupValueWrite
    id: dimm
action:
  - choose:
      - conditions:
          condition: and
          conditions:
            - condition: trigger
              id: switch
            - "{{ trigger.event.data.data == 1 }}"
        sequence:
          - service: light.turn_on
            target: !input target_lights
            # NEW MARC BEGIN
            data:
              brightness_pct: "{{ _initial_value }}"
              rgb_color: "{{ _initial_color }}"
            # NEW MARC BEGIN
      - conditions:
          condition: and
          conditions:
            - condition: trigger
              id: switch
            - "{{ trigger.event.data.data == 0 }}"
        sequence:
          - service: light.turn_off
            target: !input target_lights
      - conditions:
          condition: and
          conditions:
            - condition: trigger
              id: dimm
            - "{{ 9 <= trigger.event.data.data <= 15 }}"
        sequence:
          - repeat:
              count: "{{ dimm_steps }}"
              sequence:
                - service: light.turn_on
                  target: !input target_lights
                  data:
                    brightness_step: "{{ dimm_step }}"
                - delay:
                    milliseconds: "{{ dimm_delay }}"
      - conditions:
          condition: and
          conditions:
            - condition: trigger
              id: dimm
            - "{{ 1 <= trigger.event.data.data <= 7 }}"
        sequence:
          - repeat:
              count: "{{ dimm_steps }}"
              sequence:
                - service: light.turn_on
                  target: !input target_lights
                  data:
                    brightness_step: "{{ -dimm_step }}"
                - delay:
                    milliseconds: "{{ dimm_delay }}"
      - conditions:
          condition: trigger
          id: initialize
        sequence:
          - service: knx.event_register
            data:
              address: !input switch_address
          - service: knx.event_register
            data:
              address: !input dimm_address
issue-triage-workflows[bot] commented 1 year 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.