Closed fsalum closed 1 year ago
Interesting, I disabled the battery checkbox in the plugin config and the issue stopped, but it has been enabled for a long time.
Hello, You need to rewrite the index.js This lines from 210: that.battery .getCharacteristic(Characteristic.BatteryLevel) .updateValue(chargeLevel) .getCharacteristic(Characteristic.ChargingState) .updateValue(chargingState) .getCharacteristic(Characteristic.StatusLowBattery) .updateValue(lowBattery)
Change it to:
that.battery
.getCharacteristic(Characteristic.BatteryLevel)
.updateValue(chargeLevel);
that.battery
.getCharacteristic(Characteristic.ChargingState)
.updateValue(chargingState);
that.battery
.getCharacteristic(Characteristic.StatusLowBattery)
.updateValue(lowBattery)
Then it should be working after reboot homebridge
I'm running the fork from https://github.com/Dzebcuks/homebridge-solaredge-inverter-fixed-battery and it has the revised code, but still suffers from crashes when updating the battery charging state. This appears to be due to the Charging state being 'Discharging' and that not being a valid HomeKit mapping https://developers.homebridge.io/#/characteristic/ChargingState.
Will do some more digging to confirm and look to submit a pull request to update
Seems I wasn't quite right - from the latest digging and logs it the second time the the service updates that crashes. runs fine the first time and then for some reasons always seems to used the cached Power Flow data and the battery charging state characteristic throws an error.
Appreciate this is from the forked version, but that's not got issues enabled. Code on lines 332-338 needs the same fix as mentioned above - missing semi colons.
[08/10/2022, 16:44:29] [SolarEdge Inverter] Restarting Process... [08/10/2022, 16:44:31] [SolarEdge Inverter] Launched child bridge with PID 26482 [08/10/2022, 16:44:31] Plugin 'homebridge-solaredge-inverter-fixed-battery' tried to register with an incorrect plugin identifier: 'homebridge-solaredge-inverter'. Please report this to the developer! [08/10/2022, 16:44:31] Registering accessory 'homebridge-solaredge-inverter-fixed-battery.SolarEdge Inverter' [08/10/2022, 16:44:31] [SolarEdge Inverter] Loaded homebridge-solaredge-inverter-fixed-battery v0.2.7 child bridge successfully [08/10/2022, 16:44:31] Loaded 0 cached accessories from cachedAccessories.0EF912CE5B11. [08/10/2022, 16:44:31] [SolarEdge Inverter] Calling API [08/10/2022, 16:44:31] Homebridge v1.5.0 (HAP v0.10.2) (SolarEdge Inverter) is running on port 56049. [08/10/2022, 16:44:31] [SolarEdge Inverter] Data from API { lastUpdateTime: '2022-10-08 16:38:19', lifeTimeData: { energy: 43220, revenue: 6.6694503 }, lastYearData: { energy: 41363 }, lastMonthData: { energy: 41363 }, lastDayData: { energy: 26356 }, currentPower: { power: 1848.846 }, measuredBy: 'INVERTER' } [08/10/2022, 16:44:31] [SolarEdge Inverter] Calling Flow API [08/10/2022, 16:44:31] [SolarEdge Inverter] Data from Power Flow API { updateRefreshRate: 3, unit: 'kW', connections: [ { from: 'LOAD', to: 'Grid' }, { from: 'PV', to: 'Load' } ], GRID: { status: 'Active', currentPower: 0.73 }, LOAD: { status: 'Active', currentPower: 0.44 }, PV: { status: 'Active', currentPower: 1.17 }, STORAGE: { status: 'Idle', currentPower: 0, chargeLevel: 100, critical: false } } [08/10/2022, 16:59:31] [SolarEdge Inverter] Calling API [08/10/2022, 16:59:31] [SolarEdge Inverter] Data from cache { lastUpdateTime: '2022-10-08 16:38:19', lifeTimeData: { energy: 43220, revenue: 6.6694503 }, lastYearData: { energy: 41363 }, lastMonthData: { energy: 41363 }, lastDayData: { energy: 26356 }, currentPower: { power: 1848.846 }, measuredBy: 'INVERTER' } [08/10/2022, 16:59:31] [SolarEdge Inverter] Calling Flow API [08/10/2022, 16:59:31] [SolarEdge Inverter] Data from Power Flow cache { updateRefreshRate: 3, unit: 'kW', connections: [ { from: 'LOAD', to: 'Grid' }, { from: 'PV', to: 'Load' } ], GRID: { status: 'Active', currentPower: 0.73 }, LOAD: { status: 'Active', currentPower: 0.44 }, PV: { status: 'Active', currentPower: 1.17 }, STORAGE: { status: 'Idle', currentPower: 0, chargeLevel: 100, critical: false } }
/usr/local/lib/node_modules/homebridge-solaredge-inverter-fixed-battery/index.js:335 .getCharacteristic(Characteristic.ChargingState) ^ TypeError: this.battery.getCharacteristic(...).updateValue(...).getCharacteristic is not a function at Timeout._onTimeout (/usr/local/lib/node_modules/homebridge-solaredge-inverter-fixed-battery/index.js:335:8) at processTicksAndRejections (node:internal/process/task_queues:96:5) [08/10/2022, 16:59:31] [SolarEdge Inverter] Child bridge process ended [08/10/2022, 16:59:31] [SolarEdge Inverter] Process Ended. Code: 1, Signal: null [
Pull request #33 created and ready for review
Nothing changed recently but the plugin started to cause errors and force homebridge to shutdown. I'm on latest homebridge and latest plugin.
Any ideas what could be ?