Update to DoorBirdPy v2 (again)#14933
Update to DoorBirdPy v2 (again)#14933balloob merged 19 commits intohome-assistant:devfrom Klikini:doorbird-v2
Conversation
|
@oblogic7 I'm moving soon and I don't have a full HA instance set up right now for automation. Could you please test doorbell/motion events to with the new API version changes here? |
|
Sure, no problem. I will try to do it tomorrow. Kids are down for the night and testing the doorbell would not be wise... |
|
@Klikini Could you fix/update the |
|
@Klikini It seems that the registered events override the Doorbird app notifications. Is this expected on the new API? Edit: Also, I do not see the events in the log when monitored conditions are enabled. HA shows the events in the log by default, right? |
|
@oblogic7 That is not expected and not documented! I checked my device settings after the firmware upgraded and the only entries were for Home Assistant, none for the app. I did test the device setup and verified that HA was setting up the device schedules, and the app still notified me this morning, so I can't reproduce this issue. I added a section to the component documentation that describes the HA "removal" process:
Do app notifications work again after following those instructions? And after starting this version of HA? After that if you want to go back to the stable HA version, follow the instructions again. |
|
Tested this a couple of times now and can reliably reproduce the issue. I also found something else relating to registration of events. I verified the behavior using the schedule view in the official Doorbird app on iOS. Here is what my push notifications schedule looks like before HA events are registered. Confirmed that the blue square means active since the app doesn't clarify if it is whitelist or blacklist behavior. After I enable events for this device, the push notifications schedule appears to be cleared. Confirmed that notifications are no longer received to my device. Additionally, my chime no longer sounds in this state either. The other interesting thing is that it appears that doorbell schedule is only applied to the 30 minute slot when HA event registration happens. I would expect all time slots to be enabled. When both event types are registered, the schedule view for motion is not editable and has the same single time slot filled as doorbell events but using a gray box. I'm going to dive into your changes and the API updates to see if I can sort out what is happening. I will let you know if I find anything. |
|
Do you have some code you are using to get the output? No problem if you don't, but would save time from having to build something up to get the output you ask for. |
|
I just go to http://<device ip>/bha-api/info.cgi in my browser and enter the username/password when prompted.
|
|
Ah, didn't know it supported basic auth. Good to know. Here is the output for info.cgi Here is what the schedule looks like when I reset everything. I'm not sure where the motion schedule is from because it doesn't show in the app. I manually removed favorites, so those are clear. Here is what the schedule and favorites look like after registering events via HA. EDIT: I did confirm that I have latest version of iOS app. |
|
Do you see the notify schedules on the schedule.cgi endpoint?
I have restarted the devices today as part of my testing, but that didn’t help. I will shoot them an email.
… On Jun 12, 2018, at 9:46 PM, Andy Castille ***@***.***> wrote:
HA didn't delete the schedule that already existed, but that schedule doesn't look like it came from the app because its output event is http and not notify.
Now that I look at the API docs again, I found this:
<https://user-images.githubusercontent.com/1693960/41327477-441df6c0-6e89-11e8-8f2e-8b714a127468.png>
But that still doesn't explain why mine works without the notify schedules and yours doesn't. Maybe try restarting your device and/or emailing DoorBird support?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#14933 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAbs0JPsYFgrQV3iTCEshJj5Bz-k2_FTks5t8Hz1gaJpZM4UjcFL>.
|
|
If I manually populate and save the push notifications schedule in the iOS app the |
|
Yep, here's the full schedule.cgi output: [
{
"input": "doorbell",
"param": "1",
"output": [
{
"event": "notify",
"param": "",
"schedule": {
"weekdays": [
{
"from": "104400",
"to": "104399"
}
]
}
}
]
},
{
"input": "motion",
"param": "",
"output": [
{
"event": "notify",
"param": "",
"schedule": {
"weekdays": [
{
"from": "104400",
"to": "104399"
}
]
}
}
]
}
]I still get mobile pushes if I delete those, though. |
|
And the http entries are added to the response if you register events from HA? |
|
I think in most cases it will be:
|
|
They were added yesterday, yes. But again, my python setup broke apparently, so I'll have to fix that before I can run HA again. |
|
I'm wondering if Android notifications do not use the schedule for some reason? That would explain why you still receive them with the entries removed. Working on an email to support now. Will run this behavior by them and see what they say. Seems like something is definitely not working as expected. |
|
I wonder if there's a difference with the app communicating directly with the device vs over the internet when changing schedules. I know from packet sniffing that all push notifications go through their doorbird.net tunnel, but I'm not sure about settings changes. |
|
I'm not sure about that either. I've fired off an email to support. Maybe they will respond soon. I linked them to this discussion in case it provides some details they need. Maybe they have a developer that can drop in and assist. |
| message = 'Clearing schedule for {}'.format(slug) | ||
| return web.Response(status=200, text=message) | ||
|
|
||
|
|
| return None | ||
|
|
||
| class ConfiguredDoorbird(): | ||
| class ConfiguredDoorBird(object): |
|
|
||
| _LOGGER.info("You may use the following event name for automations" | ||
| ": %s_%s", DOMAIN, slug) | ||
| def get_doorstation_by_slug(hass, slug): |
| {'slug': slug}) | ||
|
|
||
| message = 'Clearing schedule for {}'.format(slug) | ||
| return web.Response(status=200, text=message) No newline at end of file |
|
This should be good to go assuming no further changes are requested. Changes from #6245 are included here now since they would have conflicted with the changes on this PR. Both this PR and $6245 include breaking changes for the Doorbird component, so better to group them anyway. |
| name = '{} {}'.format(self.name, SENSOR_TYPES[sensor_type]['name']) | ||
| slug = slugify(name) | ||
|
|
||
| url = '{}{}/{}?token={}'.format(hass_url, API_URL, slug, |
There was a problem hiding this comment.
I know that this is an old PR but this doesn't make sense anymore. We now have a webhook component that does exactly this.
There was a problem hiding this comment.
Do you have a link to some documentation or maybe some other components that have implemented via webhook component?
|
It's fine. It's not perfect, would be better using the webhook component, but it's ok to merge I guess. |
|
@oblogic7 When testing it I get the following error: Do you have any documentation about how/where to fetch the token? It's not in the documentation that was just merged. |
|
There were two documentation PRs. Second probably hasn’t been merged yet.
The token is just a value that is added to the DoorBird config.
token: random_string
…On Thu, Nov 1, 2018 at 4:59 PM Rick van Hattem ***@***.***> wrote:
@oblogic7 <https://github.com/oblogic7> When testing it I get the
following error:
Invalid config for [doorbird]: required key not provided @ data['doorbird']['token']. Got None.
Do you have any documentation about how/where to fetch the token? It's not
in the documentation that was just merged.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14933 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbs0LAFi0Y0o7x5psHT6eFNXH4RQLWZks5uq27egaJpZM4UjcFL>
.
|
|
Hi, Doorbird config is OK: doorbird:
token: ABCDEFGHIJK
devices:
- host: 192.168.x.x
username: xx
password: xx
name: frontdoor
monitored_conditions:
- doorbell
- motionAny hint on the JSONDecodeError? |
|
Make sure your DoorBird user has API Operator permission.
…On Fri, Nov 30, 2018 at 1:17 PM o0linus0o ***@***.***> wrote:
Hi,
facing issues to load component after 0.82 (doorbird api v2). Debug error
log gives me:
2018-11-30 19:59:19 ERROR (MainThread) [homeassistant.setup] Error during
setup of component doorbird Traceback (most recent call last): File
"/usr/src/app/homeassistant/setup.py", line 148, in _async_setup_component
component.setup, hass, processed_config) # type: ignore File
"/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs) File
"/usr/src/app/homeassistant/components/doorbird.py", line 108, in setup
doorstation.update_schedule(hass) File
"/usr/src/app/homeassistant/components/doorbird.py", line 199, in
update_schedule self._register_event(url, sensor_type, schedule) File
"/usr/src/app/homeassistant/components/doorbird.py", line 220, in
_register_event if not self.webhook_is_registered(hass_url): File
"/usr/src/app/homeassistant/components/doorbird.py", line 278, in
webhook_is_registered favs = favs if favs else self.device.favorites() File
"/usr/local/lib/python3.6/site-packages/doorbirdpy/__init__.py", line 206,
in favorites return self.__request(self.__url("favorites.cgi", auth=False))
File "/usr/local/lib/python3.6/site-packages/doorbirdpy/__init__.py", line
297, in __request body_data = json.loads(body_json) File
"/usr/local/lib/python3.6/json/__init__.py", line 354, in loads return
_default_decoder.decode(s) File "/usr/local/lib/python3.6/json/decoder.py",
line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File
"/usr/local/lib/python3.6/json/decoder.py", line 357, in raw_decode raise
JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Doorbird config is OK:
`
doorbird:
token: ABCDEFGHIJK
devices:
- host: 192.168.x.x
username: xx
password: xx
name: frontdoor
monitored_conditions:
- doorbell
- motion
`
Any hint on the JSONDecodeError?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14933 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbs0CfPZu7lGVnd08oLw5d1Pu6qny50ks5u0YQ0gaJpZM4UjcFL>
.
|
That's it - problem solved. Thanks a lot! |







Description:
Update to DoorBirdBy 2.0.2, which uses the new version (0.21) of the DoorBird LAN API.
Pull request in home-assistant.github.io with documentation: home-assistant/home-assistant.io#5529
Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py.