erikwihlborg76 / unofficial-danalock-web-api

9 stars 2 forks source link

unable to use danalock.cfg in hassio #5

Open zu3st-de opened 5 months ago

zu3st-de commented 5 months ago

Is it possible to provide useredata in an other way, cause there is no possibility to provide danalock.cfg to nodered in hassio?

erikwihlborg76 commented 5 months ago

You can set it directly in the Node-RED flow. The flow reads danalock.cfg in this section:

image

Remove the "read danalock.cfg" and "json" nodes, and connect the wire from the "at deploy" node,

In the "Init and reset flow vars" node, you can manually set your username and password to flow variables:

image

Did it work?

BrianMay-pt commented 5 months ago

not working: image

image

The flow gets broken somewhere else

erikwihlborg76 commented 5 months ago

You need to change the type of the value from "msg" to string in the dropdown to the left of the input field.

It should look like this:

image
BrianMay-pt commented 5 months ago

still not working: image

BrianMay-pt commented 4 months ago

Any other tips?

zu3st-de commented 4 months ago

I'v modified the init flow: image image I've exported my json, so you have just to replace username and password danalock.json

zu3st-de commented 4 months ago

there is also a nicer way use error handling with catch: image image image danalock.json

BrianMay-pt commented 4 months ago

did everything, still getting 2 messages at debug and when I try to actuate the door lock I get an error message "an error occurred while requesting the resource"

image

erikwihlborg76 commented 4 months ago

@BrianMay-pt looking at your screenshots I believe you managed to retrieve your lock. Check the "payload" property. Can you provide a screenshot of the error message you get?

Thanks for the suggestion @zu3st-de! You keep introducing new features in Node-red to me, big thanks! I´ll look into the catch node.

BTW, in my local development version, I´m currently playing around with improving the logging. It´s not ready for prime quite yet.

BrianMay-pt commented 4 months ago

payload data: image

image

error message when I try to actuate the lock: image

yaml code for the lock: rest_command: lock_door: url: http://ip:1880/danalock/bridge/main_door/execute/lock method: get timeout: 20 unlock_door: url: http://ip:1880/danalock/bridge/main_door/execute/unlock method: get timeout: 20 status_door: url: http://ip:1880/danalock/bridge/main_door/execute/status method: get timeout: 20 battery_door: url: http://ip:1880/danalock/bridge/main_door/execute/battery-level method: get timeout: 20

lock:

zu3st-de commented 4 months ago

If you are using hassos you have to modify the url to http://IP:1880/endpoint/danalock/...

BrianMay-pt commented 4 months ago

now I don't get the error message, but nothing happens. I'm using homeassistant on KVM, over open media vault...is there anything else I need to change?

zu3st-de commented 4 months ago

Try the url directly in a browser http://ip:1880/endpoint/danalock/bridge/main_door/execute/status. Do you get the state of the door?

BrianMay-pt commented 4 months ago

Nope,

"Cannot GET /endpoint/danalock/bridge/main_door/execute/status"

I get the same kind of error without endpoint

BrianMay-pt commented 4 months ago

can it have anything to do with nodered/lock/danabridge version? I'm running the latest version on all of them

erikwihlborg76 commented 4 months ago

Try this operation: GET http://ip:1880/endpoint/danalock/main_door/get-state

Just open the URL in a browser and see what happens.

BrianMay-pt commented 4 months ago

Nothing happened...a long waiting game and "ERR_ADDRESS_UNREACHABLE"

BrianMay-pt commented 4 months ago

Tried again after a network restart, same thing

BrianMay-pt commented 4 months ago

Any other tips/tricks?

erikwihlborg76 commented 4 months ago

Can you please post the exact URL to the Node-RED web interface?

BrianMay-pt commented 4 months ago

From the side menu? http://192.168.1.69:8123/a0d7b954_nodered

erikwihlborg76 commented 4 months ago

From the Node-RED ha plugin guide:

"Note: In order to use the http_node you will need to expose Node-RED using a network port in addition to ingress. The HTTP nodes will also be presented under /endpoint/ as shown in the UI. If using the node-red-dashboard module this will also be hosted under this path and will use any credentials set here."

https://github.com/hassio-addons/addon-node-red/blob/main/node-red/DOCS.md

More excerpts from the docs that may be relevant:

" If you cannot access HTTP nodes or Node-RED Dashboard, please check if you have enabled direct access mode by setting a port number in "Network" configuration section of the add-on."

" If you cannot access HTTP nodes or Node-RED Dashboard, please check if you URL starts with /endpoint/, or else Home Assistant authentication will kick in."

Did you enable “direct access mode“?

BrianMay-pt commented 4 months ago

So...I went directly to the add-on page and selected "open web interface"

http://192.168.1.69:8123/hassio/ingress/a0d7b954_nodered

If I try my ip with port 1880 I cannot connect with my credentials, changed the por to 1881, cannot connect either

erikwihlborg76 commented 4 months ago

Did you specify a network port in the "Network" section of the add-on?

BrianMay-pt commented 4 months ago

Yes, I did. 1880, changed to 1881 afterwards

Can it have anything to do with the fact I'm running homeassistant under a virtual machine in open media vault?

erikwihlborg76 commented 4 months ago

Sorry @BrianMay-pt , I have no clue.

While I haven´t tried Open Media Vault, I can recommend running Proxmox Virtual Environment, especially running your apps and services in Linux containers (LXC).

You can run virtual machines in Proxmox as well but LXC is more lightweight. Proxmox also has good support for scheduled backups.

BTW, released a new version of the Node-RED flow. Changes described in the changelog.

BrianMay-pt commented 4 months ago

tried it, same issue, "an error occurred while requesting the resource"

however, at the debug window in node-red I no longer see any message, which may be good...maybe there's something wrong with the yaml code?

erikwihlborg76 commented 4 months ago

I tried the Home Assistant Supervised once and I believe it uses its network configuration which may be different from the one set in your virtual machine. I had for example problems getting the REST sensor to work.

If you are willing to give Home Assistant core a go, then I can provide you with step-by-step instructions for installing and handling upgrades.

BrianMay-pt commented 4 months ago

I actually installed homeassistant on a virtual machine because the container option was giving me update issues and there is no other reliable way of installing it on the same machine as open mediavault 🫤

erikwihlborg76 commented 3 months ago

Upgrading HA is easy using pip. It's a bit more tricky to upgrade the python runtime.

Check this thread for steps https://community.home-assistant.io/t/upgrading-homeassistant-core-in-a-python-ve/420027/19