Closed Buster14 closed 2 years ago
This is the integration for Home Assistant, if you familiar with this system you can even configure it to open garage door by voice in Google Assistant or by GPS coordinates when you close to home.
If you are not familiar, you can use flowing link to open door: https://username:password@ip/cgi-bin/accessControl.cgi?action=openDoor&UserID=101&Type=Remote&channel=1
Where put your VTO parameters instead username:password@ip and change channel=1 to channel=2 if you use second lock channel at VTO.
Sorry it took me a while to figure out the widget is in android itself. I tried running the command from wifi (therefore local connnection), checkmark shows up but nothing happens. Then it says "A custom component is preventing service data from loading" Any idea why?
I simply open the widget from my android phone (where HA app is installed) and put in the link you gave me. Just double checked and the parameters should be correct. this one is similar with my issue, except my widget actually shows green checkmark after pressed. I haven't tested running the command from developer tools, not quite sure how to do it. I checked it and there seems to be 3 services related to dahua vto. Dahua VTO open door, send command send instance command. Which one should i use?
But you can't simple call url from Home Assistant, first try this url from browser and see if it's working, if no - check url parameters.
You can call url from Home Assistant using curl and shell command, in Home Assistant yaml configure:
shell_command:
curl: "/usr/bin/curl {{ command }}"
When you can run serviceshell_command.curl
from Devepoper Tools -> Services or widget:
service: shell_command.curl
data_template:
command: "--insecure --digest --get https://username:password@ip/cgi-bin/accessControl.cgi?action=openDoor&UserID=101&Type=Remote&channel=1
Before run widget check if you get it working in Devepoper Tools -> Services when configure same service with parameters in widget.
I checked it and there seems to be 3 services related to dahua vto. Dahua VTO open door, send command send instance command. Which one should i use?
This commands related to integration which should be installed and configured, url which I give you doesn't required this integration and will work without it.
I haven't tested running the command from developer tools, not quite sure how to do it.
You can read about Developer Tools here
Thanks for explaining it. So basically all i need is to get it running from Devepoper Tools -> Services correct? Odd, the "call service" button is greyed out. Is that all the command needed?
-
Button grayed out because you don't have shell_command.curl
command in Home Assistant configuration, you should add it as I write before:
shell_command:
curl: "/usr/bin/curl {{ command }}"
If you are new to Home Assistant, watch the video on YouTube how to edit configuration files or read it in the Home Assistant manual
Like this right? Odd, i rebooted HA and the call service button is still greyed out.
Like this right? Odd, i rebooted HA and the call service button is still greyed out.
Right, it's should work if you edit right configuration.yaml. Before restarting HA, press Check Configuration button and make sure that you don't have errors.
As I see in your configuration file you configure dahua_vto integration, so you should have sensor.dahua_vto
, check it's state in Developer Tools -> States and if state is OK you can use integration command dahua_vto.open_door
instead curl and url.
service: dahua_vto.open_door
data_template:
entity_id: sensor.dahua_vto
channel: 1
short_number: HA
You can also try this integration it's support VTO's and has configuration GUI so it's much easy to configure for newbies.
Like this right? Odd, i rebooted HA and the call service button is still greyed out.
Right, it's should work if you edit right configuration.yaml. Before restarting HA, press Check Configuration button and make sure that you don't have errors. As I see in your configuration file you configure dahua_vto integration, so you should have
sensor.dahua_vto
, check it's state in Developer Tools -> States and if state is OK you can use integration commanddahua_vto.open_door
instead curl and url.service: dahua_vto.open_door data_template: entity_id: sensor.dahua_vto channel: 1 short_number: HA
Yep i ran the configuration check and there was no error. But it's still greyed out.
But the good news, the dahua Vto open door service works when i call them ! Here's the yaml code :
service: dahua_vto.open_door data_template: entity_id: sensor.dahua_vto channel: 1 short_number: HA data: channel: 1 entity_id: sensor.dahua_vto
So how would i translate this into the android widget?
Okay i will check out that integration if your integration could not work
Great!
So how would i translate this into the android widget?
Call same service with same parameters from a widget.
Great!
So how would i translate this into the android widget?
Call same service with same parameters from a widget.
Awesome! it finally works, opening gate is alot simpler now. Thanks a bunch myhomeiot!
Enjoy and Good Luck! 😊
@myhomeiot Hi, i'm getting this error when trying to open gate from android widget.
Logger: homeassistant.components.webhook
Source: components/mobile_app/webhook.py:263
Integration: Webhook ([documentation](https://www.home-assistant.io/integrations/webhook), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+webhook%22))
First occurred: April 7, 2022, 6:20:22 PM (6 occurrences)
Last logged: April 7, 2022, 10:52:52 PM
Error processing webhook d9b6f28e0b02d0bbedc0e63071fe5ea65364c2f888c8e854d6d3203398681a62
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mobile_app/webhook.py", line 249, in webhook_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1588, in async_call
processed_data: dict[str, Any] = handler.schema(service_data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.9/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: required key not provided @ data['channel']
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/webhook/__init__.py", line 121, in async_handle_webhook
response = await webhook["handler"](hass, webhook_id, request)
File "/usr/src/homeassistant/homeassistant/components/mobile_app/webhook.py", line 233, in handle_webhook
return await asyncio.shield(
File "/usr/src/homeassistant/homeassistant/components/mobile_app/webhook.py", line 148, in validate_and_run
return await func(hass, config_entry, data)
File "/usr/src/homeassistant/homeassistant/components/mobile_app/webhook.py", line 263, in webhook_call_service
raise HTTPBadRequest() from ex
aiohttp.web_exceptions.HTTPBadRequest: Bad Request
This is my widget :
Seems to be related to channel, but all the examples on your page also uses 1. Any idea?
required key not provided @ data['channel']
means that no channel provided at all. It's works before? It's stops working after Home Assistant updates? Try to update mobile application, read release notes for last HA update which break this functionality, try to rollback to version of HA where it's working, etc.
If unlock service call works from Home Assistant -> Developer Tools -> Services
you should look into problem with HA Web Hook, HA Android application, etc maybe they change something in latest versions.
Hmm here's the thing, it was just yesterday i finished setting up nginx + duckdns so i only tested it once (it worked once-twice) but then it wont work again. And i'm pretty sure it was the same version.
No updates for android app, there's an update for HA core today but it doesn't seem to fix it.
I just tried calling the service and it works, so problem is the webhook / android then? How do i debug it ?
Looks like the problem with webhook.
Try to test it inside network (connected to your home network with WiFi) and outside (using 3G, etc). I'm not familiar with HA webhook, but maybe your problem with external https url or https certificates. Try to look into webhook documentation in order to debug it.
Would it be possible to make command to unlock the garage by a single press on android home page? The dahua vto app needs 3 clicks,
Too much button press compared to IR remote, kinda risky doing it while driving.