ebaauw / homebridge-p1

Homebridge plugin for DSMR end-consumer (P1) interface
Apache License 2.0
54 stars 11 forks source link

Dynamic changing log level on ‘electricity delivered’ throws error #48

Closed thomas-svrts closed 3 years ago

thomas-svrts commented 3 years ago

Changing the log level on ‘electricity’ works fine (and the changes are also applied for ‘gas’ and ‘electricity delivered’ logs)

But if you change it on ‘electricity delivered’ it causes a crash.

imo it shouldn’t be exposed on ‘electricity delivered’ (like it is for gas)



[21/3/2021 15:40:52] [P1] Electricity Delivered: error: TypeError: Cannot set property logLevel of #<Electricity> which has only a getter
    at CharacteristicDelegate.<anonymous> (/usr/lib/node_modules/homebridge-p1/lib/P1Service.js:72:28)
    at CharacteristicDelegate.emit (events.js:315:20)
    at CharacteristicDelegate.emit (/usr/lib/node_modules/homebridge-p1/node_modules/homebridge-lib/lib/Delegate.js:172:13)
    at CharacteristicDelegate._onSet (/usr/lib/node_modules/homebridge-p1/node_modules/homebridge-lib/lib/CharacteristicDelegate.js:391:10)
    at Characteristic.emit (events.js:315:20)
    at /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1632:16
    at new Promise (<anonymous>)
    at Characteristic.<anonymous> (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1630:14)
    at step (/usr/lib/node_modules/homebridge/node_modules/tslib/tslib.js:143:27)
    at Object.next (/usr/lib/node_modules/homebridge/node_modules/tslib/tslib.js:124:57)
ebaauw commented 3 years ago

Hm, there shouldn't be a Log Level in the Electricity Delivered accessory; it should copy the log level from Electricity, as does the Gas accessory.

ebaauw commented 3 years ago

Fix will be in next version, but is already in beta v1.2.1-1.

thomas-svrts commented 3 years ago

Tested and okay.

ebaauw commented 3 years ago

Released v1.2.1.