core icon indicating copy to clipboard operation
core copied to clipboard

Issue says that my automation uses an unknown service (knx.send), but it is an available service

Open lodesmets opened this issue 2 years ago • 3 comments

The problem

So as the title explains. I have an automation that uses knx.send. But since i upgraded to 2023.12.3 i got the warning that the service knx.send does not exist.

But it exists (the automation works) + here is the source code https://github.com/home-assistant/core/blob/dev/homeassistant/components/knx/services.yaml

I also didn't see it in the breaking changes that that one would be removed

What version of Home Assistant Core has the issue?

2023.12.3

What was the last working version of Home Assistant Core?

2023.11.3

What type of installation are you running?

Home Assistant Container

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

This is my automation code (made with visual editor):
alias: Stuur dag/nacht knx
description: ""
trigger:
  - platform: sun
    event: sunrise
    offset: 0
  - platform: sun
    event: sunset
    offset: 0
  - platform: homeassistant
    event: start
condition: []
action:
  - if:
      - condition: sun
        after: sunset
        before: sunrise
    then:
      - service: knx.send
        data:
          address: 3/1/1
          response: false
          payload: 0
    else:
      - service: knx.send
        data:
          response: false
          address: 3/1/1
          payload: 1
mode: single

Anything in the logs that might be useful for us?

No response

Additional information

No response

lodesmets avatar Dec 26 '23 13:12 lodesmets

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 Renames 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.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


knx documentation knx source (message by IssueLinks)

home-assistant[bot] avatar Dec 26 '23 13:12 home-assistant[bot]

This is the warning I get. If i press submit, the error just comes back

image

lodesmets avatar Dec 26 '23 14:12 lodesmets

Hi 👋! There was no change to knx.send in a long time (a year probably). So it might just be the homeassistant.start trigger that fires before the KNX Integration is loaded? But this is just a guess, I don't really know when homeassistant.start fires / is supposed to fire. Maybe you can debug it with a simple system_log.write added to your automation.

farmio avatar Dec 26 '23 16:12 farmio

Hey,

Indeed this is the problem I guess. because I made the automation to run at startup, and I guess not everything is loaded yet.

Because without the homeassistant.start I don't get the error

It still seems like a bug (automations run before everything is started) But that is not a bug for you, but for the HA team

lodesmets avatar Dec 27 '23 20:12 lodesmets

trigger:
  - platform: event
    event_type: service_registered
    event_data:
      domain: knx
      service: send

This might work. At least it does for reloading the Knx integration. But I'm not sure if it fires on start too. (I did use this and homeassistant.start in a blueprint once, but don't exactly remember details on why).

farmio avatar Dec 28 '23 07:12 farmio

This may actually be caused by wrong service registering in the KNX Integration. https://discord.com/channels/330944238910963714/330990195199442944/1190079838292291704 Although I'm not sure if it will just raise a different error when the service is registered correctly, but integration setup takes some time.

farmio avatar Dec 29 '23 07:12 farmio

I checked the messages in discord. It indeed had to do with errors.

I was doing some reworking in my network rack, and the knx system had a different IP address. So the gateway was offline (but I expected this. This was no worries)

but when my HA started it showed the error, and I didn't put 1 and 1 together.

lodesmets avatar Dec 29 '23 08:12 lodesmets