MacWyznawca / homebridge-mqtt-switch-tasmota

Plugin to HomeBridge optimized to work with firmware Sonoff-Tasmota, MQTT.
MIT License
57 stars 18 forks source link

TypeError: Cannot read property 'replace' of null #16

Closed jeylites closed 6 years ago

jeylites commented 6 years ago

I'm trying to test this out but I'm getting the following error. What could it be?

j-MBP:~ j$ homebridge
[10/11/2017, 12:01:14 AM] Loaded plugin: homebridge-http-garagedoorcontroller
[10/11/2017, 12:01:14 AM] Registering accessory 'homebridge-http-garagedoorcontroller.HttpGarageDoorController'
[10/11/2017, 12:01:14 AM] ---
[10/11/2017, 12:01:14 AM] Loaded plugin: homebridge-mqtt-switch-tasmota
[10/11/2017, 12:01:14 AM] Registering accessory 'homebridge-mqtt-switch-tasmota.mqtt-switch-tasmota'
[10/11/2017, 12:01:14 AM] ---
[10/11/2017, 12:01:15 AM] Loaded plugin: homebridge-people
[10/11/2017, 12:01:15 AM] Registering platform 'homebridge-people.People'
[10/11/2017, 12:01:15 AM] Registering accessory 'homebridge-people.PeopleAccessory'
[10/11/2017, 12:01:15 AM] Registering accessory 'homebridge-people.PeopleAllAccessory'
[10/11/2017, 12:01:15 AM] ---
[10/11/2017, 12:01:15 AM] Loaded config.json with 1 accessories and 0 platforms.
[10/11/2017, 12:01:15 AM] ---
[10/11/2017, 12:01:15 AM] Loading 0 platforms...
[10/11/2017, 12:01:15 AM] Loading 1 accessories...
[10/11/2017, 12:01:15 AM] [sonoff] Initializing mqtt-switch-tasmota accessory...
[10/11/2017, 12:01:15 AM] [sonoff] Nazwa do RESULT  POWER
/usr/local/lib/node_modules/homebridge-mqtt-switch-tasmota/node_modules/mqtt/lib/connect/index.js:62
    opts.protocol = opts.protocol.replace(/\:$/, '');
                                 ^

TypeError: Cannot read property 'replace' of null
    at Object.connect (/usr/local/lib/node_modules/homebridge-mqtt-switch-tasmota/node_modules/mqtt/lib/connect/index.js:62:34)
    at new MqttSwitchTasmotaAccessory (/usr/local/lib/node_modules/homebridge-mqtt-switch-tasmota/index.js:94:21)
    at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:265:29)
    at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:81:38)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)

Config File

{
   "bridge":{
      "name":"Homebridge",
      "username":"83:45:35:66:EE:9A",
      "port":51829,
      "pin":"031-45-407"
    },

    "description": "This is an example configuration file. You can use this as a template for creating your own configuration file.",

    "platforms": [],

    "accessories": [
        {
            "accessory": "mqtt-switch-tasmota",

            "name": "sonoff",

            "url": "192.168.1.10",

            "topics": {
                "statusGet": "stat/sonoff/POWER",
                "statusSet": "cmnd/sonoff/POWER"
            }
        }
    ]
    }
jeylites commented 6 years ago

Never mind the mistake was the url... it needs to be the following formate eg: mqtt://192.168.1.10