datMaffin / homebridge-tesla-powerwall

Homebridge Plugin for the Tesla Powerwall
ISC License
21 stars 11 forks source link

Crashes when used with homebridge-alexa #12

Closed fighterzg6 closed 4 years ago

fighterzg6 commented 4 years ago

Hello, if I install the adapter and set up the config, he finds the powerwall and displays everything! then the homebridge crashes! this plugin is incompatible with the alexa plugin! if I remove the config everything goes back!

datMaffin commented 4 years ago

I may be able to help if you post the following:

I think it is really weird that the plugin seems works for a short while and then it randomly (?) crashes. It should either work or not.

fighterzg6 commented 4 years ago

hi,

the link : https://github.com/NorthernMan54/homebridge-alexa

the error : Okt 19 17:44:03 raspberrypi homebridge[12380]: [2019-10-19 17:44:03] TypeError: Cannot read property 'getCharacteristic' of undefined Okt 19 17:44:03 raspberrypi homebridge[12380]: at Service.toAlexa (/usr/local/lib/node_modules/homebridge-alexa/lib/parse/Service.js:187:60) Okt 19 17:44:03 raspberrypi homebridge[12380]: at Accessory.toAlexa (/usr/local/lib/node_modules/homebridge-alexa/lib/parse/Accessory.js:142:27) Okt 19 17:44:03 raspberrypi homebridge[12380]: at Homebridge.toAlexa (/usr/local/lib/node_modules/homebridge-alexa/lib/parse/Homebridge.js:161:27) Okt 19 17:44:03 raspberrypi homebridge[12380]: at Homebridges.toAlexa (/usr/local/lib/node_modules/homebridge-alexa/lib/parse/Homebridges.js:47:35) Okt 19 17:44:03 raspberrypi homebridge[12380]: at Object. (/usr/local/lib/node_modules/homebridge-alexa/lib/alexaActions.js:100:28) Okt 19 17:44:03 raspberrypi homebridge[12380]: at HAPNodeJSClient.HAPaccessories (/usr/local/lib/node_modules/homebridge-alexa/node_modules/hap-node-client/HAPNodeJSClient.js:163:3) Okt 19 17:44:03 raspberrypi homebridge[12380]: at Object.alexaDiscovery (/usr/local/lib/node_modules/homebridge-alexa/lib/alexaActions.js:93:14) Okt 19 17:44:03 raspberrypi homebridge[12380]: at HAPNodeJSClient. (/usr/local/lib/node_modules/homebridge-alexa/lib/alexaActions.js:33:20) Okt 19 17:44:03 raspberrypi homebridge[12380]: at HAPNodeJSClient.emit (events.js:180:13) Okt 19 17:44:03 raspberrypi homebridge[12380]: at HAPNodeJSClient._discoveryEnd (/usr/local/lib/node_modules/homebridge-alexa/node_modules/hap-node-client/HAPNodeJSClient.js:149:8) Okt 19 17:44:03 raspberrypi homebridge[12380]: at ontimeout (timers.js:466:11) Okt 19 17:44:03 raspberrypi homebridge[12380]: at tryOnTimeout (timers.js:304:5) Okt 19 17:44:03 raspberrypi homebridge[12380]: at Timer.listOnTimeout (timers.js:267:5) Okt 19 17:44:03 raspberrypi homebridge[12380]: [2019-10-19 17:44:03] Got SIGTERM, shutting down Homebridge... Okt 19 17:44:03 raspberrypi homebridge[12380]: [2019-10-19 17:44:03] [HomeMatic] Removing Event Server for Interface BidCos-RF. Okt 19 17:44:03 raspberrypi homebridge[12380]: [2019-10-19 17:44:03] [HomeMatic] Removing Event Server for Interface HmIP-RF.

and the config:
{ "accessories": [], "bridge": { "username": "0E:AA:F6:A3:82:45", "name": "Homebridge", "pin": "**", "port": 51826 }, "platforms": [ { "password": "**", "username": "", "interval": 60, "name": "FritzBox", "url": "http://192.168.0.20", "platform": "Fritz!Box" }, { "platform": "TeslaPowerwall", "name": "Powerwall Ingo", "ip": "192.168.0.112", "auth": { "username": "**", "password": "*" } },
{ "platform": "SamsungTizen", "refresh": true, "uuid": "A3", "devices": [ { "name": "Fernseher Wohnzimmer", "ip": "192.168.0.113", "mac": "9C:8C:6E:2D:3C:1D", "uuid": "A3", "switches": [ { "name": "Prime Video", "app": "3201512006785" }, { "name": "YouTube", "app": "111299001912" }, { "name": "Mute", "mute": true }, { "name": "Timer", "sleep": 60 }, { "name": "KiKa", "channel": 25 }, { "name": "Pro7", "channel": 9 }, { "name": "RTL", "channel": 3 }, { "name": "DMax", "channel": 13 }, { "name": "Sat1", "channel": 8 }, { "name": "N24", "channel": 14 }, { "name": "ARD", "channel": 1 }, { "name": "ZDF", "channel": 2 }, { "name": "Programm", "command": "KEY_GUIDE" }, { "name": "Lauter", "command": "KEY_VOLUP" }, { "name": "Leiser", "command": "KEY_VOLDOWN" }, { "name": "Live TV", "command": [ "KEY_EXIT", "KEY_EXIT" ] } ] } ] }, { "name": "Alexa", "username": "**", "password": "***", "pin": "
", "routines": true, "debug": false, "refresh": 500, "platform": "Alexa" }, { "name": "HomeMatic", "enable_hmip": "true", "programs": [], "doors": [ "BidCos-RF.KEQ0368018:1", "BidCos-RF.KEQ0368956:1", "BidCos-RF.MEQ0813289:1", "BidCos-RF.MEQ0367815:1", "BidCos-RF.MEQ0367816:1", "BidCos-RF.KEQ0957398:1", "BidCos-RF.KEQ0367048:1", "BidCos-RF.LEQ0918789:1" ], "special": [ { "name": "Garagentor", "type": "HM-THKL-GARAGEDOOR", "parameter": { "message_actor_open": { "off": false, "on": true }, "state_sensor_close": 0, "address_actor_open": "BidCos-RF.OEQ0182237:1.STATE", "address_sensor_close": "BidCos-RF.OEQ2139339:1.STATE" } }, { "name": "Einfahrt", "type": "HM-THKL-GARAGEDOOR", "parameter": { "message_actor_open": { "off": false, "on": true }, "state_sensor_close": 0, "address_actor_open": "BidCos-RF.NEQ1631511:1.STATE", "address_sensor_close": "BidCos-RF.MEQ0813289:1.STATE" } } ], "filter_device": [], "ios10": true, "platform": "HomeMatic", "subsection": "Siri", "filter_channel": [], "outlets": [ "BidCos-RF.LEQ0179017:2", "BidCos-RF.KEQ0965027:1", "BidCos-RF.KEQ0964830:1", "BidCos-RF.OEQ0216911:1", "BidCos-RF.OEQ0216911:2", "BidCos-RF.OEQ0216911:3", "BidCos-RF.KEQ0254217:1", "CUxD.CUX2801004:9" ], "services": [ { "type": "HM-THKL-GARAGEDOOR", "service": "HomeMaticHomeKitGarageDoorService" } ], "variables": [ "Alarmanlage", "TrocknerDrach8", "WaschmaschineDrach8", "Weihnachtsbel." ], "local_ip": "192.168.0.26", "windows": [ "BidCos-RF.KEQ0368672:1", "BidCos-RF.LEQ0919582:1" ], "ccu_ip": "192.168.0.23" }, { "name": "Config", "port": 8089, "auth": "form", "theme": "auto", "restart": "sudo -n systemctl restart homebridge", "temp": "/sys/class/thermal/thermal_zone0/temp", "tempUnits": "c", "sudo": true, "log": { "method": "systemd", "service": "homebridge" }, "platform": "config" } ] }

datMaffin commented 4 years ago

Ok.. I'm pretty sure that i did find the problem. The easy/fast/short solution should be to disable "additionalServices"."battery"."homekitVisual" in the config. (By default it is set to true and it results in a coloured light (in the HomeKit App) which represents the charging/battery state (how full is the battery))

change

{
  "platform": "TeslaPowerwall",
  "name": "Powerwall Ingo",
  "ip": "192.168.0.112",
  "auth": {
    "username": "",
    "password": ""
  }
}

to

{
  "platform": "TeslaPowerwall",
  "name": "Powerwall Ingo",
  "ip": "192.168.0.112",
  "auth": {
    "username": "",
    "password": ""
  },
  "additionalServices": {
    "powerwall": {
      "homekitVisual": false
    }
  }
}

The reason why this fix (should) work: There is no longer a lightbulb declared where the saturation is null/undefined which causes an error in the alexa service (see stack trace or https://github.com/NorthernMan54/homebridge-alexa/blob/master/lib/parse/Service.js#L187).


Alternative solution: Add a saturation to the lightbulb in powerwall.js https://github.com/datMaffin/homebridge-tesla-powerwall/blob/master/src/accessories/powerwall.js#L83

datMaffin commented 4 years ago

@fighterzg6 Please report back if the solution (changing the config) did work.

fighterzg6 commented 4 years ago

hey thanks.. it works