node-red-contrib-home-assistant-websocket: Module won't load after 0.45.0

Describe the bug

After installing or upgrading node-red-contrib-home-assistant-websocket to 0.45.0 or later, the module fails to load after a reboot of Node-RED.

Logs after reboot:

2 Oct 07:35:41 - [warn] ------------------------------------------------------
2 Oct 07:35:41 - [warn] [node-red-contrib-home-assistant-websocket/all] Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:35:41 - [warn] ------------------------------------------------------
2 Oct 07:35:41 - [info] Settings file  : /data/settings.js
2 Oct 07:35:41 - [info] Context store  : 'default' [module=memory]
2 Oct 07:35:41 - [info] User directory : /data
2 Oct 07:35:41 - [info] Projects directory: /data/projects
2 Oct 07:35:41 - [info] Server now running at http://127.0.0.1:1880/
2 Oct 07:35:41 - [info] Active project : HomeAutomation
2 Oct 07:35:41 - [info] Flows file     : /data/projects/HomeAutomation/flows.json
2 Oct 07:35:41 - [info] Waiting for missing types to be registered:
2 Oct 07:35:41 - [info]  - server
2 Oct 07:35:41 - [info]  - api-call-service
2 Oct 07:35:41 - [info]  - api-current-state
2 Oct 07:35:41 - [info]  - ha-device
2 Oct 07:35:41 - [info]  - server-state-changed
2 Oct 07:35:41 - [info]  - ha-wait-until

Logs from install:

2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-device : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-device-config : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-entity : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-entity-config : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:server-events : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:server-state-changed : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-fire-event : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-get-entities : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:api-get-history : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:poll-state : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:api-render-template : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-sensor : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-switch : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-tag : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-time : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:trigger-state : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-update-config : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-wait-until : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-webhook : Error: Cannot read/write to storage file for Home Assistant nodes
2 Oct 07:40:18 - [info]  - node-red-contrib-home-assistant-websocket:ha-zone : Error: Cannot read/write to storage file for Home Assistant nodes

Node-RED can write to the user dir just fine

bash-5.1$ cd /data
bash-5.1$ ls -alh
total 412K
drwxrwxrwx    1 root     root         576 Oct  2 07:40 .
drwxr-xr-x    1 root     root          28 Oct  2 07:39 ..
-rw-r--r--    1 node-red node-red   26.5K Oct  2 07:40 .config.nodes.json
-rw-r--r--    1 node-red node-red   25.0K Oct  2 07:40 .config.nodes.json.backup
-rw-r--r--    1 node-red node-red     174 Aug  3 14:06 .config.projects.json
-rw-r--r--    1 node-red node-red     135 Aug  3 14:06 .config.projects.json.backup
-rw-r--r--    1 node-red node-red      95 Aug  3 13:44 .config.runtime.json
-rw-r--r--    1 node-red node-red     761 Aug 29 06:59 .config.users.json
-rw-r--r--    1 node-red node-red     760 Aug 29 06:59 .config.users.json.backup
-rw-r--r--    1 node-red node-red   79.3K Aug  3 14:03 .flows.json.backup
-rw-r--r--    1 node-red node-red      79 Aug  3 14:01 .flows_cred.json.backup
drwxr-xr-x    1 node-red node-red      84 Oct  2 00:30 .npm
-rw-r--r--    1 node-red node-red   79.3K Aug  3 14:03 flows.json
-rw-r--r--    1 node-red node-red     391 Aug  3 14:01 flows_cred.json
drwxr-xr-x    1 node-red node-red      10 Aug  3 13:44 lib
drwxr-xr-x    1 node-red node-red    3.4K Oct  2 07:40 node_modules
-rw-r--r--    1 node-red node-red  136.1K Oct  2 07:40 package-lock.json
-rw-r--r--    1 node-red node-red     494 Oct  2 07:40 package.json
drwxr-xr-x    1 node-red node-red      44 Aug  3 14:06 projects
-rw-r--r--    1 node-red node-red   22.1K Aug  3 13:44 settings.js

If I uninstall 0.45.4 and install 0.44.0, The module loads fine, and creates node-red-contrib-home-assistant-websocket.json in the user dir

bash-5.1$ ls -alh /data/node-red-contrib-home-assistant-websocket.json
-rw-r--r--    1 node-red node-red       2 Oct  2 07:44 /data/node-red-contrib-home-assistant-websocket.json
bash-5.1$ cat /data/node-red-contrib-home-assistant-websocket.json
{}

To Reproduce

No response

Expected behavior

No response

Screenshots

No response

Example Flow

No response

This package’s version (not the Home Assistant add-on version)

0.45.4

Is Node-RED running in Docker?

Yes

Node-RED version

3.0.2

Node.js version

16.16.0

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (7 by maintainers)

Most upvoted comments

Ok, I’ll have to look into it further. As my quick tests show that it loads and creates the file in my test docker setup.