iobroker-community-adapters / ioBroker.doorbird

Doorbird Adapter for ioBroker
MIT License
17 stars 13 forks source link

Issue with js-controller 5 Alpha #27

Closed todde99 closed 1 year ago

todde99 commented 1 year ago

After upgrading to js-controller: 5.0.1-alpha this adapter is crashing:

2023-05-16 07:24:37.299 - debug: doorbird.0 (177011) Redis Objects: Use Redis connection: 0.0.0.0:9001 2023-05-16 07:24:37.369 - debug: doorbird.0 (177011) Objects client ready ... initialize now 2023-05-16 07:24:37.372 - debug: doorbird.0 (177011) Objects create System PubSub Client 2023-05-16 07:24:37.373 - debug: doorbird.0 (177011) Objects create User PubSub Client 2023-05-16 07:24:37.529 - debug: doorbird.0 (177011) Objects client initialize lua scripts 2023-05-16 07:24:37.561 - debug: doorbird.0 (177011) Objects connected to redis: 0.0.0.0:9001 2023-05-16 07:24:37.564 - silly: doorbird.0 (177011) redis psubscribe cfg.o.system.user. 2023-05-16 07:24:37.616 - silly: doorbird.0 (177011) redis psubscribe cfg.o.enum. 2023-05-16 07:24:37.619 - silly: doorbird.0 (177011) objectDB connected 2023-05-16 07:24:37.622 - debug: doorbird.0 (177011) Redis States: Use Redis connection: 0.0.0.0:9000 2023-05-16 07:24:37.738 - debug: doorbird.0 (177011) States create System PubSub Client 2023-05-16 07:24:37.739 - debug: doorbird.0 (177011) States create User PubSub Client 2023-05-16 07:24:37.877 - debug: doorbird.0 (177011) States connected to redis: 0.0.0.0:9000 2023-05-16 07:24:37.878 - silly: doorbird.0 (177011) statesDB connected 2023-05-16 07:24:38.406 - info: doorbird.0 (177011) starting. Version 0.1.5 in /opt/iobroker/node_modules/iobroker.doorbird, node: v18.16.0, js-controller: 5.0.1-alpha.0-20230418-efa3e809 2023-05-16 07:24:38.458 - silly: doorbird.0 (177011) States system redis pmessage system.adapter.doorbird.0.logLevel/system.adapter.doorbird.0.logLevel:{"val":"silly","ack":true,"ts":1684214678440,"q":0,"from":"system.adapter.doorbird.0","lc":1684214678440} 2023-05-16 07:24:38.508 - silly: doorbird.0 (177011) States user redis pmessage doorbird.0./doorbird.0.info.connection:{"val":false,"ack":true,"ts":1684214678501,"q":0,"from":"system.adapter.doorbird.0","user":"system.user.admin","lc":1684214678501} 2023-05-16 07:24:38.532 - debug: doorbird.0 (177011) Authorization with User gheicj0001 successfull! 2023-05-16 07:24:38.559 - debug: doorbird.0 (177011) Checking favorites on DoorBird Device.. 2023-05-16 07:24:38.569 - silly: doorbird.0 (177011) States user redis pmessage doorbird.0./doorbird.0.info.connection:{"val":true,"ack":true,"ts":1684214678565,"q":0,"from":"system.adapter.doorbird.0","user":"system.user.admin","lc":1684214678565} 2023-05-16 07:24:38.587 - debug: doorbird.0 (177011) Found a Favorite that belongs to me.. 2023-05-16 07:24:38.588 - debug: doorbird.0 (177011) (ID: 0) (ioBroker doorbird.0 1 Ring: http://192.168.6.54:8100/ring?1) 2023-05-16 07:24:38.588 - debug: doorbird.0 (177011) Found a Favorite that belongs to me.. 2023-05-16 07:24:38.589 - debug: doorbird.0 (177011) (ID: 1) (ioBroker doorbird.0 Motion: http://192.168.6.54:8100/motion) 2023-05-16 07:24:38.589 - debug: doorbird.0 (177011) Result of Favorites: {"1":{"ID":"0","URL":"http://192.168.6.54:8100/ring?1"},"Motion":{"ID":"1","URL":"http://192.168.6.54:8100/motion"}} 2023-05-16 07:24:38.600 - silly: doorbird.0 (177011) States user redis pmessage doorbird.0./doorbird.0.info.firmware:{"val":"000139","ack":true,"ts":1684214678595,"q":0,"from":"system.adapter.doorbird.0","user":"system.user.admin","lc":1683609657823} 2023-05-16 07:24:38.618 - silly: doorbird.0 (177011) States user redis pmessage doorbird.0./doorbird.0.info.build:{"val":"16824274","ack":true,"ts":1684214678615,"q":0,"from":"system.adapter.doorbird.0","user":"system.user.admin","lc":1683609657823} 2023-05-16 07:24:38.620 - silly: doorbird.0 (177011) States user redis pmessage doorbird.0./doorbird.0.info.type:{"val":"DoorBird D2101V","ack":true,"ts":1684214678615,"q":0,"from":"system.adapter.doorbird.0","user":"system.user.admin","lc":1558199246009} 2023-05-16 07:24:38.625 - debug: doorbird.0 (177011) Looping trough the Schedules.. 2023-05-16 07:24:38.626 - debug: doorbird.0 (177011) Detected a Doorbell Schedule! 2023-05-16 07:24:38.626 - debug: doorbird.0 (177011) The Param of the actual Schedule is: 1 2023-05-16 07:24:38.627 - debug: doorbird.0 (177011) The Output contains 3 entries! 2023-05-16 07:24:38.627 - debug: doorbird.0 (177011) Entry "0" is: {"event":"notify","param":"","schedule":{"weekdays":[{"to":"75599","from":"75600"}]}} 2023-05-16 07:24:38.627 - debug: doorbird.0 (177011) Entry "1" is: {"event":"sip","param":"1","schedule":{"weekdays":[{"to":"75599","from":"75600"}]}} 2023-05-16 07:24:38.628 - debug: doorbird.0 (177011) Entry "2" is: {"event":"http","param":"0","enabled":"1","schedule":{"weekdays":[{"from":"75600","to":"75599"}]}} 2023-05-16 07:24:38.628 - debug: doorbird.0 (177011) Counted 1 Doorbells. 2023-05-16 07:24:38.628 - debug: doorbird.0 (177011) Detected Motion Schedule! 2023-05-16 07:24:38.629 - debug: doorbird.0 (177011) The Output contains 2 entries! 2023-05-16 07:24:38.629 - debug: doorbird.0 (177011) Entry "0" is: {"event":"notify","param":"","schedule":{"weekdays":[{"to":"75599","from":"75600"}]}} 2023-05-16 07:24:38.630 - debug: doorbird.0 (177011) Entry "1" is: {"event":"http","param":"1","enabled":"1","schedule":{"weekdays":[{"from":"75600","to":"75599"}]}} 2023-05-16 07:24:38.630 - debug: doorbird.0 (177011) Checking if we need to create any favorites.. 2023-05-16 07:24:38.631 - debug: doorbird.0 (177011) Cheking if Favorite for Doorbell ID 1 exists. 2023-05-16 07:24:38.631 - debug: doorbird.0 (177011) Favorite for Doorbell ID 1 exists! 2023-05-16 07:24:38.632 - debug: doorbird.0 (177011) Checking if we need to create any favorites.. 2023-05-16 07:24:38.632 - debug: doorbird.0 (177011) Favorites checked successfully. No actions needed! 2023-05-16 07:24:38.633 - debug: doorbird.0 (177011) Checking if we need to create Schedules on DoorBird Device.. 2023-05-16 07:24:38.633 - debug: doorbird.0 (177011) Okay we dont need to create any Doorbell-Schedules.. 2023-05-16 07:25:09.094 - debug: doorbird.0 (177011) Received Motion-alert from Doorbird! 2023-05-16 07:25:09.138 - silly: doorbird.0 (177011) States user redis pmessage doorbird.0./doorbird.0.Motion.trigger:{"val":true,"ack":true,"ts":1684214709133,"q":0,"from":"system.adapter.doorbird.0","user":"system.user.admin","lc":1683122919533} 2023-05-16 07:25:09.174 - error: doorbird.0 (177011) uncaught exception: ENOENT: no such file or directory, open '/opt/iobroker/node_modules/iobroker-data/doorbird.0.snap.jpg' 2023-05-16 07:25:09.175 - error: doorbird.0 (177011) Error: ENOENT: no such file or directory, open '/opt/iobroker/node_modules/iobroker-data/doorbird.0.snap.jpg' 2023-05-16 07:25:09.175 - error: doorbird.0 (177011) Exception-Code: ENOENT: ENOENT: no such file or directory, open '/opt/iobroker/node_modules/iobroker-data/doorbird.0.snap.jpg' 2023-05-16 07:25:09.180 - info: doorbird.0 (177011) terminating 2023-05-16 07:25:09.181 - warn: doorbird.0 (177011) Terminated (UNCAUGHT_EXCEPTION): Without reason 2023-05-16 07:25:09.683 - info: doorbird.0 (177011) terminating 2023-05-16 07:25:09.842 - error: host.iobroker instance system.adapter.doorbird.0 terminated with code 6 (UNCAUGHT_EXCEPTION) 2023-05-16 07:25:09.842 - info: host.iobroker Restart adapter system.adapter.doorbird.0 because enabled

Apollon77 commented 1 year ago

@BuZZy1337 This is the wrong way to do that

https://github.com/BuZZy1337/ioBroker.doorbird/blob/master/main.js#L25

You should never write directly in iobroker-data/files. Ideally use adapter.writeFile and such

todde99 commented 1 year ago

Fixed with version 0.1.7.