Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to use danalock.cfg in hassio #5

Open
zu3st-de opened this issue Jan 20, 2024 · 30 comments
Open

unable to use danalock.cfg in hassio #5

zu3st-de opened this issue Jan 20, 2024 · 30 comments

Comments

@zu3st-de
Copy link

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

@erikwihlborg76
Copy link
Owner

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
Copy link

not working:
image

image

The flow gets broken somewhere else

@erikwihlborg76
Copy link
Owner

erikwihlborg76 commented Jan 31, 2024

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
Copy link

still not working:
image

@BrianMay-pt
Copy link

Any other tips?

@zu3st-de
Copy link
Author

zu3st-de commented Feb 9, 2024

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
Copy link
Author

zu3st-de commented Feb 9, 2024

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

@BrianMay-pt
Copy link

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
Copy link
Owner

@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
Copy link

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:

  • platform: template
    name: Danalock
    value_template: "{{ is_state('sensor.dorstatus', 'Locked') }}"
    lock:
    service: rest_command.lock_door
    target:
    entity_id: switch.door
    unlock:
    service: rest_command.unlock_door
    target:
    entity_id: switch.door

@zu3st-de
Copy link
Author

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

@BrianMay-pt
Copy link

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
Copy link
Author

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
Copy link

Nope,

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

I get the same kind of error without endpoint

@BrianMay-pt
Copy link

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

@erikwihlborg76
Copy link
Owner

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
Copy link

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

@BrianMay-pt
Copy link

Tried again after a network restart, same thing

@BrianMay-pt
Copy link

Any other tips/tricks?

@erikwihlborg76
Copy link
Owner

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

@BrianMay-pt
Copy link

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

@erikwihlborg76
Copy link
Owner

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
Copy link

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
Copy link
Owner

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

@BrianMay-pt
Copy link

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
Copy link
Owner

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
Copy link

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
Copy link
Owner

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
Copy link

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants