Skip to content

Subscriptions to triggers do not work anymore after reconnect #555

@FlorianLoch

Description

@FlorianLoch

I have some code that connects to my local HA instance via (which actually results in an odd error when the instance is not reachable, but that's another issue):

  const connection = await createConnection({
    auth: createLongLivedTokenAuth(cfg.homeAssistantURL, cfg.longLivedToken),
  });

Then, I register to some triggers:

connection.subscribeMessage(
          (_) => {
            ...
          },
          {
            type: "subscribe_trigger",
            trigger: {
              ...button.on.trigger,
            },
          },
          { resubscribe: true },
        ),
      );

This works fine until I, for whatever reason, restart my HA instance. I added some logging to the disconnected and ready callbacks and it appears to me, that the reconnect is working. But I do not get any further messages for my subscriptions.

So I am wondering, whether they do not get re-subscribed after the reconnect? Or that HA isn't ready to handle these subscribe_trigger messages correctly while still starting up?

I would appreciate some ideas on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions