Samfox2 / homebridge-domotiga

Supports domotiga devices on HomeBridge Platform
Apache License 2.0
6 stars 3 forks source link

Cannot read property 'toLowerCase' of undefined #31

Open leeroyc01 opened 5 years ago

leeroyc01 commented 5 years ago

Hi

Been using this plugin for a few weeks now, which is great by the way. Yesterday I added a couple of contact sensors to domotiga which are actually home easy contact sensors interfaced to domotiga through an rfxcom device. I can see them updating in domotiga but when I include them in my config.json I get the following error in homebridge.err Any thoughts gratefully received. Thanks

/usr/lib/node_modules/homebridge-domotiga/index.js:1463 var value = (result.toLowerCase() == "on") ? Characteristic.ContactSensorState.CONTACT_DET$ ^

TypeError: Cannot read property 'toLowerCase' of undefined at /usr/lib/node_modules/homebridge-domotiga/index.js:1463:33 at /usr/lib/node_modules/homebridge-domotiga/index.js:2518:25 at maybeCallback (/usr/lib/node_modules/homebridge-domotiga/node_modules/jsonrequest/lib/index.js:$ at Function. (/usr/lib/node_modules/homebridge-domotiga/node_modules/tinyreq/lib/index.$ at res (/usr/lib/node_modules/homebridge-domotiga/node_modules/assured/lib/index.js:27:12) at IncomingMessage. (/usr/lib/node_modules/homebridge-domotiga/node_modules/tinyreq/lib$ at IncomingMessage.emit (events.js:193:15) at endReadableNT (_stream_readable.js:1129:12) at process.internalTickCallback (internal/process/next_tick.js:72:19)

Samfox2 commented 5 years ago

Strange, itˋs working for me. Could you please post your config.json?

leeroyc01 commented 5 years ago

yes here you go. (it's quite long!)

{ "bridge": { "name": "Homebridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "031-45-154" },

 "accessories": [
{    "accessory": "Http",
         "name": "Projector",
         "on_url": "xxxxxxxxxxx/gpio/1",
         "off_url": "xxxxxxxxxxx/gpio/0",
     "http_method": "GET"
},
{
     "accessory": "homebridge-better-filesensor.FileSensor",
         "name": "Porch Sensor",
         "path": "/mnt/seccam/porch",
         "window_seconds": 40,
         "inverse": false,
     "usePolling": true,
         "sensor_type": "m"
},

{ "accessory": "homebridge-better-filesensor.FileSensor", "name": "Garden Sensor", "path": "/mnt/seccam/garden", "window_seconds": 40, "inverse": false, "usePolling": true, "sensor_type": "m" }, { "accessory": "mqtt-temperature", "name": "Family Room Temperature", "url": "mqtt://localhost", "topic": "temp/in" }, { "accessory": "mqtt-humidity", "name": "Family Room Humidity", "url": "mqtt://localhost", "topic": "temp/out" }, { "accessory": "mqtt-temperature", "name": "Main Bedroom Temperature", "url": "mqtt://localhost", "topic": "temperature/in" }, { "accessory": "mqtt-humidity", "name": "Main Bedroom Humidity", "url": "mqtt://localhost", "topic": "humidity/out" }, { "accessory": "Http", "name": "Family Room LEDs", "on_url": "xxxxxxxxxxx/gpio/1", "off_url": "xxxxxxxxxxx/gpio/0", "http_method": "GET" }, { "accessory": "BlindsHTTP", "name": "Curtains", "up_url": "xxxxxxxxxxx/gpio/4", "down_url": "xxxxxxxxxxx/gpio/3", "stop_url": "xxxxxxxxxxx/gpio/2", "http_method": "PUT" }, { "accessory": "WeMo", "name": "Christmas Lights", "description": "The Lamp in the Family Room", "wemo_name": "Christmas Lights" }, { "accessory": "WeMo", "name": "Cinema Room Tree", "description": "The Tree in the Cinema Room", "wemo_name": "Cinema Room Tree" }, { "accessory": "WeMo", "name": "Lounge Lamp", "description": "The Lamp in the Lounge", "wemo_name": "Lounge Lamp" }, { "accessory": "WeMo", "name": "xx Lights", "description": "The fairy in xx room", "wemo_name": "xx Lights" }, { "accessory": "NetworkDevice", "name": "MacBook", "mac": "xxxxxxxxxxx", "ip": "xxxxxxxxxxx" }, { "accessory": "NetworkDevice", "name": "Router", "mac": "xxxxxxxxxxx", "ip": "xxxxxxxxxxx" },

 {
       "accessory": "NetworkDevice",
       "name": "Hive Hub",
       "mac": "xxxxxxxxxxx",
       "ip": "xxxxxxxxxxx"
   },
{
    "accessory": "tivo",
    "name": "Living Room TiVo",
    "ip": "xxxxxxxxxxx",
    "port": 31339
},
 {
       "accessory": "NetworkDevice",
       "name": "Xbox",
       "mac": "xxxxxxxxxxx",
       "ip": "xxxxxxxxxxx"
   },
 {
       "accessory": "NetworkDevice",
       "name": "Bathroom Pi",
       "mac": "xxxxxxxxxxx",
       "ip": "xxxxxxxxxxx"
   },
{
       "accessory": "NetworkDevice",
       "name": "Fire Alarm",
       "mac": "xxxxxxxxxxx",
       "ip": "xxxxxxxxxxx"
   },
{
       "accessory": "NetworkDevice",
       "name": "Lounge Airport",
       "mac": "xxxxxxxxxxx",
       "ip": "xxxxxxxxxxx"
   },
 {
   "accessory": "HiveThermostat",
   "name": "Hive Thermostat",
   "username": "xxxxxxxxxxx",
   "password": "xxxxxxxxxxx"
   }
],

"platforms": [
{
    "platform": "People",
    "threshold" : 15,
    "anyoneSensor" : true,
    "nooneSensor" : false,
    "webhookPort": 51828,
    "cacheDirectory": "./.node-persist/storage",
    "pingInterval": 10000,
    "ignoreReEnterExitSeconds": 0,
    "people" : [
        {
            "name" : "xxx",
            "target" : "xxxxxxxxxxx",
            "threshold" : 15,
            "pingInterval": 10000,
            "ignoreReEnterExitSeconds": 0
        },
        {
            "name" : "xxx",
            "target" : "xxxxxxxxxxx",
            "threshold" : 15,
            "pingInterval": 10000,
            "ignoreReEnterExitSeconds": 0
        },
        {
            "name" : "xxx",
            "target" : "xxxxxxxxxxx",
            "threshold" : 15,
            "pingInterval": 10000,
            "ignoreReEnterExitSeconds": 0
        },
        {
            "name" : "xxx",
            "target" : "xxxxxxxxxxx",
            "threshold" : 15,
            "pingInterval": 10000,
            "ignoreReEnterExitSeconds": 0

        }

] }, { "platform": "Hue", "name": "homebridge-hue", "host": "xxxxxxxxxxx", "users": { "001788FFFExxxxxxxxxxx": "xxxxxxxxxxx", "001788FFFEyyyyyy": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" }, "lights": true }, { "platform": "Camera-ffmpeg", "cameras": [ { "name": "Front Door Camera", "videoConfig": { "source": "-rtsp_transport tcp -re -i rtsp://xxxxxxxxxxx/12", "stillImageSource": "-i http://xxxxxxxxxxx:xxxxxxxxxxx@xxxxxxxxxxx/tmpfs/auto.jpg", "maxStreams": 2, "maxWidth": 640, "maxHeight": 480, "maxFPS": 20 } }, { "name": "Garden Cam", "videoConfig": { "source": "-rtsp_transport tcp -re -i rtsp://xxxxxxxxxxx/12", "stillImageSource": "-i http://xxxxxxxxxxx:xxxxxxxxxxx@xxxxxxxxxxx/tmpfs/auto.jpg", "maxStreams": 2, "maxWidth": 640, "maxHeight": 480, "maxFPS": 20 } } ] }, { "platform":"DomotiGa", "name":"Domotiga", "host":"localhost", "port":"9090", "devices": [ { "name": "Family Room Sensor", "service": "MotionSensor", "device": "3", "valueMotionSensor": "1" }, { "name": "Side Garage Door", "service": "Contact", "device": "4", "valueContact": "1" },
{ "name": "Front Garage Door", "service": "Contact", "device": "5", "valueContact": "1" }, { "name": "Upstairs Sensor", "service": "MotionSensor", "device": "2", "valueMotionSensor": "1" }, { "name": "Lounge Sensor", "service": "MotionSensor", "device": "1", "valueMotionSensor": "1" } ] }, { "platform":"MiLight", "name":"Mi-Light", "bridges": [ { "ip_address": "xxxxxxxxxxx", "port": "5987", "version": "v6", "lights": {"fullColor": ["Cinema Room LED",null, null, null]}, "repeat": 3, "delay": 80 } ] } ] }