Skip to content

Property 'getUrl' is required when using MQTT #21

@ronald8192

Description

@ronald8192

Describe the bug
My understanding is getUrl is only used for the 'pull' way. But when I config MQTT, it still ask for getUrl:

[1/4/2022, 11:30:05 PM] [BedRoom] Initializing HTTP-TEMPERATURE accessory...
[1/4/2022, 11:30:05 PM] [BedRoom] Property 'getUrl' is required!
[1/4/2022, 11:30:05 PM] [BedRoom] Aborting...
[1/4/2022, 11:30:05 PM] [BedRoom] Accessory HTTP-TEMPERATURE returned empty set of services; not adding it to the bridge.

If I give it a getUrl, it can connect to the broker but it still getting the value from getUrl instead of MQTT

[1/4/2022, 11:32:18 PM] [BedRoom] Initializing HTTP-TEMPERATURE accessory...
[1/4/2022, 11:32:18 PM] [BedRoom] MQTT connecting to broker...
[1/4/2022, 11:32:18 PM] [BedRoom] MQTT Connected!
[1/4/2022, 11:32:18 PM] [BedRoom] Subscribing to existing topic: BedRoom/temperature
[1/4/2022, 11:32:18 PM] [BedRoom] MQTT successfully subscribed to topic 'BedRoom/temperature. Granted [{"topic":"BedRoom/temperature","qos":1}]'

Expected behavior
Expected the getUrl property is optional or will be ignored if mqtt config is present.

To Reproduce

  1. Setup mqtt server
  2. Connect to it using below config

Version (output of npm list -g homebridge homebridge-http-temperature-sensor)

  • homebridge: v1.3.9
  • homebridge-http-temperature-sensor: v1.0.10

Configuration

{
    "accessory": "HTTP-TEMPERATURE",
    "name": "BedRoom",
    "unit": "celsius",
    "statusCache": "5000",
    "mqtt": {
        "host": "127.0.0.1",
        "port": 1883,
        "subscriptions": [
            {
                "topic": "BedRoom/temperature",
                "characteristic": "CurrentTemperature",
                "messagePattern": "(-?[0-9]{1,3}(.[0-9]{1,3}))"
            }
        ]
    }
}

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