Unoffical danalock web API

You get a HTTP status 415 response because the request payload your oauth-node creates is not what the server expects.

I’m still working on my complete rewrite of the nodered flow. I target better logging, no need for 3rd party nodes e.g. the oauth-node, and more robust operation. Need a couple of weeks more to get it in releasable shape.

Hi, any news on this update? thank you

Hi! Yes! Or almost :slight_smile:

I have been running a complete rewrite ot the solution at home for a couple weeks. Will soon make it available for everyone :+1::blush:

Please, do so!! Christmas gift?

any news on an ETA?

Hi @BrianMay, I´ve just released the new major version to Github! :gift:

Please do a complete reinstall since the URLs have probably changed, and the way the flow needs to be set up differs a bit compared to the previous version.

See gechu/unofficial-danalock-web-api (github.com) for more info.

Enjoy!

1 Like

Only today did I find the time to test this…

since node-red file is now somwhere else (addon-configs folder) I changed the file danalock.cfg (which I created using nano) location in the “read danalock.cfg” to /config/danalock.cfg

I now get all of this in the debug area:

05/01/2024, 14:58:36msg : string[567]

“↵↵---------------------------------------------------------------------↵Your flow credentials file is encrypted using a system-generated key.↵↵If the system-generated key is lost for any reason, your credentials↵file will not be recoverable, you will have to delete it and re-enter↵your credentials.↵↵You should set your own key using the ‘credentialSecret’ option in↵your settings file. Node-RED will then re-encrypt your credentials↵file using your chosen key the next time you deploy a change.↵---------------------------------------------------------------------↵”

05/01/2024, 14:58:37node: A1msg : Object

{ _msgid: “b148854fd26b5187”, filename: “/config/danalock.cfg”, payload: "{↵ “username”: “******” }

05/01/2024, 14:58:37node: A2msg : Object

{ _msgid: “b148854fd26b5187”, filename: “/config/danalock.cfg”, payload: object }

05/01/2024, 14:58:38node: B2msg : Object

{ _msgid: “b148854fd26b5187”, filename: “/config/danalock.cfg”, payload: object, source: “auth in”, _linkSource: array[1] … }

05/01/2024, 14:58:38node: C1msg : Object

{ _msgid: “b148854fd26b5187”, filename: “/config/danalock.cfg”, payload: array[1], source: “locks in”, headers: object … }

twitter outD3Init flow variables, auth + retrieve list of locks

This will update all Home Assistant nodes to the current schema. This is not required for the nodes to function.

Nodes with yellow labels need to be updated before they can be edited. This can be done by either opening each node individually in the Node-RED editor or running this command.

Attention: It is recommended to back up your flows before doing an update of all Home Assistant nodes.

Does any of the endpoints exposed from Node-RED work?

If not, ensure you have the right location for danalock.cfg

I think that’s the issue…currently the file is located at the node-red folder in addons-config…is it the expected location? Formerly the node-red folder was in configs…where is your folder located?

at the node-red add-on it states my server name as: “a0d7b954-nodered” not sure if this as anything to do with it…

so…I removed node-red, reinstalled it and didn’t change a thing. I get this error when running the flow:

09/01/2024, 12:26:45[node: read danalock.cfg]msg : error

“Error: ENOENT: no such file or directory, open ‘danalock.cfg’”

this leads me to believe it has something to do with the fact the the node-red installation was moved from the config folder to the addon-configs folder

from my search ( After update to 16.0.0 all flows and notes are gone - Third party integrations / Node-RED - Home Assistant Community (home-assistant.io)), one should now replace any path to start with the older location, and homeassistant will the redirect it, but if I change the path to config/danalock.cfg I get the above messages…any one has any idea?

Try to set up a “context storage” in Node-RED. See last post in this thread for instructions: Node-red working directory? - Third party integrations / Node-RED - Home Assistant Community (home-assistant.io)

did that, there is no context folder in configs (as there is no nodered folder either), and no context folder inside the nodered folder (currentlly in addon_configs)

Am I the only one having this issue? I’m running latest HA and Nodered versions

You can set the username and password directly in the Node-RED flow. Here are instructions unable to use danalock.cfg in hassio · Issue #5 · gechu/unofficial-danalock-web-api (github.com)

Anyone who knows if this runs fine on Node-RED 18?

It works with node-red 3.x.

Noticed that the latest version of node-red is 4x. I haven’t tested it using that version.

Yeah, sorry, node-red 4x, was HA addon that was 18, that is now node-red 4x. I will test to upgrade and see if it works :slight_smile:

It works without changes in node-red 4.x also!

1 Like

I just started up NodeRed as add-on to HA, disabled SSL, imported the flow and managed to get some endpoints up. However, I’m getting no response back from them - e.g., curl http://homeassistant.local:1880/endpoint/danalock/main/battery never returns

and " 21/07/2024, 13:39:16node: prepare “action” reqfunction : (error)

“TypeError: Cannot read properties of undefined (reading ‘afi’)”" as debug errors in the debug console in NodeRed. It appears as if the API to Danalock is working though, as I can see my lock name there when the flow starts up.

Any ideas what could be wrong?

Hi! Are you sure “main” should be part of the URL?