Skip to content

Handle MQTT payloads according to restrictSwitchValues to prevent homebridge warnings/errors #711

@turbidWaters

Description

@turbidWaters

Feature Request

Currently, when the plugin receives MQTT payloads mapped to event indexes (eventIndex) using switchValues, it attempts to set the HomeKit characteristic for any event index received. If restrictSwitchValues is configured, some event indexes may not be exposed to HomeKit. When a payload corresponds to an event index not in restrictSwitchValues, the plugin currently tries to set the characteristic, resulting in warnings and log clutter about invalid characteristic values.

Proposal

  • Before setting the HomeKit characteristic in response to an MQTT payload, check whether the event index from the payload is present in restrictSwitchValues.
  • If the event index is NOT allowed by restrictSwitchValues, skip setting the characteristic entirely, and log a message indicating the event was ignored as it is not exposed to HomeKit.
  • This will:
    • Silently ignore disallowed events
    • Prevent errant warnings and errors from HomeKit
    • Keep logs clean and improve user experience

Benefits

  • Avoid HomeKit warnings about invalid values
  • Improve reliability and clarity of logs
  • Reduce confusion for users configuring restrictSwitchValues

Thank you for considering this improvement!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions