Open IrealiTY opened 2 years ago
only if there's an (open) API for that
Seems like there is one: https://api.nuki.io/#/Smartlock/SmartlockOpenerAdvancedConfigResource_post_post
/smartlock /{smartlockId} /advanced/openerconfig
{
"doorbellSuppression": 0,
"doorbellSuppressionDuration": 0,
}
thanks for sharing the info. what's your use case for home automation? do you change those settings regularly?
yeah, we would like to mute the ringer overnight / based on other conditions because the ringer is extremely loud
I really like this option too. Maybe in the same line, with the lock service for the opener we can control de "ring to open" state but there is no option for the "continous mode". If I can have that option integrated in HA then I don't need the Nuki App anymore :)
One method for continuous mode in HA is to setup a automation as Trigger: Intercom ring and Action: Open Intercom.
Would love the ringer control. Muting and adjusting volume would be great e.g., decrease ringer sound if intercom gets pressed 5 times within 10s.
Hi, I wanted to make a helper in HA to turn the Ring suppression on and off, too.
@IrealiTY did it work out for you? If yes, how did you do it? I`m not quite sure how to use the API "doorbellSuppression": 0.
Can you maybe help me here?
Hi, I wanted to make a helper in HA to turn the Ring suppression on and off, too.
@IrealiTY did it work out for you? If yes, how did you do it? I`m not quite sure how to use the API "doorbellSuppression": 0.
Can you maybe help me here?
I did not play around with direct calls to the API myself yet
Does this work at the moment? I am looking for a solution to suppress the ring when the baby is at sleep. I can trigger the baby sleep with an automation, but I don't know a solution to suppress the ring.
The Nuki could be a solution if this function will work. My wife would be very happy :) and I am also, because I got the Legitimation to buy a Nuki.
Not with this integration, but it is possible.
https://developer.nuki.io/t/opener-set-ring-suppression-automatically-on-a-given-schedule/13534
Thanks for the link! Where you able to make it work? I must say I´m not sure what to do, to get this to work.
At the moment I do not own a nuki nor a opener. I am just looking if the system would be able to fulfill my needs.
hi folks,
I can help with that, but:
I'll gladly help to test it :)
Do you think in the future it will be possible to have it local? Or some API endpoints web api only?
for those who would like to test, please install the 0.3.6 version, it adds Auto lock and Ring suppression switches. Web API token is required for that
I updated to version 0.3.6 rebooted but can't see any new switches in Web API or in the opener. Am I looking at the right spot? Anything else I need to do, or need to try?
New switches isn't part of Web API, but a part of Lock/Opener device
Can't find them. Maybe someone else can confirm if it works. Maybe I'm just to dumb. :)
Well, I don't have the opener to actually test it.
Can you execute the following command from console and post the output (redacted):
curl -H "Authorization: Bearer: <your web API token>" "https://api.nuki.io/smartlock"
please hold on. there's a bug
@IrealiTY please upgrade to 0.3.7 and re-test. The bug should be fixed now
I also don’t see the ring suppression in homeassistant. Just updated to 0.3.7
@Se7enair then I will need your Web API response to debug it, as mentioned above
Just updated, no Ring Suppression in the settings, decided to test it by removing the integration and re-doing the setup. But that didn't add the option either.
Here is the curl result:
[
{
"smartlockId": xxxxx,
"accountId": xxxxxx,
"type": 2,
"authId": xxxxx,
"name": "House Opener",
"favorite": false,
"config": {
"name": "House Opener",
"latitude": xxxxx,
"longitude": xxxxx,
"capabilities": 1,
"pairingEnabled": false,
"buttonEnabled": true,
"ledEnabled": true,
"timezoneOffset": 0,
"daylightSavingMode": 0,
"fobPaired": false,
"fobAction1": 7,
"fobAction2": 0,
"fobAction3": 0,
"operatingMode": 6,
"advertisingMode": 0,
"keypadPaired": false,
"homekitState": 0,
"timezoneId": 37
},
"openerAdvancedConfig": {
"intercomId": 0,
"busModeSwitch": 0,
"shortCircuitDuration": 0,
"electricStrikeDelay": 0,
"randomElectricStrikeDelay": false,
"electricStrikeDuration": 10000,
"disableRtoAfterRing": false,
"rtoTimeout": 20,
"doorbellSuppression": 0,
"doorbellSuppressionDuration": 500,
"soundRing": 3,
"soundOpen": 0,
"soundRto": 0,
"soundCm": 0,
"soundConfirmation": 1,
"soundLevel": 255,
"singleButtonPressAction": 1,
"doubleButtonPressAction": 4,
"batteryType": 1,
"automaticBatteryTypeDetection": false,
"autoUpdateEnabled": true
},
"state": {
"mode": 2,
"state": 1,
"trigger": 0,
"lastAction": 3,
"batteryCritical": false,
"keypadBatteryCritical": false,
"doorsensorBatteryCritical": false,
"doorState": 0,
"ringToOpenTimer": 0,
"nightMode": false
},
"firmwareVersion": 67585,
"hardwareVersion": 1041,
"serverState": 0,
"adminPinState": 0,
"virtualDevice": false,
"creationDate": "2021-07-13T17:27:33.255Z",
"updateDate": "2022-08-25T08:24:35.364Z",
"subscriptions": []
}
]
Updated to 0.3.7 Auto lock is available now. Ring Suppression not.
[{"smartlockId":xxx,"accountId":xxx,"type":2,"authId":xxx,"name":"xxx","favorite":false,"config":{"name":"opener","latitude":xxx,"longitude":x,"capabilities":1,"pairingEnabled":true,"buttonEnabled":true,"ledEnabled":true,"timezoneOffset":0,"daylightSavingMode":1,"fobPaired":false,"fobAction1":7,"fobAction2":0,"fobAction3":0,"operatingMode":1,"advertisingMode":0,"keypadPaired":false,"homekitState":0,"timezoneId":37},"openerAdvancedConfig":{"intercomId":0,"busModeSwitch":0,"shortCircuitDuration":0,"electricStrikeDelay":0,"randomElectricStrikeDelay":false,"electricStrikeDuration":3000,"disableRtoAfterRing":true,"rtoTimeout":20,"doorbellSuppression":2,"doorbellSuppressionDuration":500,"soundRing":1,"soundOpen":0,"soundRto":0,"soundCm":0,"soundConfirmation":1,"soundLevel":150,"singleButtonPressAction":7,"doubleButtonPressAction":1,"batteryType":0,"automaticBatteryTypeDetection":true,"autoUpdateEnabled":true},"state":{"mode":2,"state":1,"trigger":1,"lastAction":2,"batteryCritical":false,"keypadBatteryCritical":false,"doorsensorBatteryCritical":false,"doorState":0,"ringToOpenTimer":0,"nightMode":false},"firmwareVersion":67585,"hardwareVersion":1041,"serverState":0,"adminPinState":0,"virtualDevice":false,"creationDate":"2022-08-25T04:37:17.299Z","updateDate":"2022-08-26T16:46:16.003Z","subscriptions":[{"type":"B2C","creationDate":"2022-08-25T04:37:17.791Z"}]}]
Please try version 0.3.10
There it is. And also a complete new entity (Nuki web api)
But it does not work. Will send you details as soon as I get on my pc
Source: custom_components/nuki_ng/sensor.py:94
Integration: Nuki Lock (documentation, issues)
First occurred: 09:03:24 (167 occurrences)
Last logged: 10:29:24
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
if (state := self.state) is None:
File "/config/custom_components/nuki_ng/sensor.py", line 98, in state
return self.native_value
File "/config/custom_components/nuki_ng/sensor.py", line 94, in native_value
return self.data.get("bridge_info", {}).get("rssi")
AttributeError: 'NoneType' object has no attribute 'get' ```
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/nuki_ng/nuki.py:39
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 21:33:12 (1 occurrences)
Last logged: 21:33:12
[139726526326256] Http response for https://api.nuki.io/smartlock/xxx/advanced/openerconfig: 400 Bad Request
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/config/custom_components/nuki_ng/switch.py", line 142, in async_turn_on
await self.coordinator.update_config(self.device_id, "openerAdvancedConfig", dict(doorbellSuppression=new_value))
File "/config/custom_components/nuki_ng/nuki.py", line 531, in update_config
await self.api.web_update_config(self.web_id(dev_id), name, obj)
File "/config/custom_components/nuki_ng/nuki.py", line 314, in web_update_config
await self.web_async_json(
File "/config/custom_components/nuki_ng/nuki.py", line 184, in web_async_json
return await self.async_json(
File "/config/custom_components/nuki_ng/nuki.py", line 39, in async_json
raise ConnectionError(f"Http response for {response.request.url}: {response.status_code} {response.reason}")
ConnectionError: Http response for https://api.nuki.io/smartlock/xxx/advanced/openerconfig: 400 Bad Request
I got the same Error 400 when trying to set the suppression via RESTcommand???
I got the same Error 400 when trying to set the suppression via RESTcommand???
Is that a statement or a question?
A statement and a question. Is the problem related to me, when I got the same error with REST or is it random?
I need someone who can debug the issue using either Nuki 3.0 and/or Opener devices.
As discovered in other thread, device IDs for Bridge and Web APIs do not match for those devices. 0.3.10 introduces a special mapping to make sure that hybrid mode works, but it looks like not every API endpoint behaves the same way.
I personally experience none of such issues, my device is Nuki 2.0 Lock and device IDs simply match for both APIs, that's why I can't easily fix the problem
I am using a Nuki 2.0 too, but I have a opener. So tell me what to do.
But, I looked around a little bit. Does the ring suppression uses the advanced web api? The integration is using the "normal" api at the moment, right?
Does the ring suppression uses the advanced web api? No, despite its name, advanced config update isn't the part of their advanced APIs. In my case Auto lock entity update works without any exception.
So, what has to be verified, as a first step:
First, you should know how to call both bridge and web API from console, using curl
or Postman from GUI.
nukiId
and web device ID is webId
https://api.nuki.io/smartlock/xxx/advanced/openerconfig
xxx should be web ID, not bridge IDI know how tu use a terminal, but this is not on my scope. Can you explain how to make that call?
Does this help? There seems to be a prefix for the opener in the webapi
Yes, I'm aware of this, and this conversion has been recently implemented. So IDs should be different for bridge and web APIs. We just need to make sure that they're correct
Then I just need support in doing the call to debug this.
@Se7enair actually you don't need curl
(yet) to debug it.
Just enable debug output if not enabled yet for the nuki_ng integration and you should be able to find all the data in the hass log
I got all the IDs. But I cannot replicate the trace with the url. I only see this if I change the state of the ring suppression switch.
2022-08-29 13:16:54.430 DEBUG (MainThread) [custom_components.nuki_ng.nuki] Updating config: openerAdvancedConfig: {'doorbellSuppression': 2} = {'intercomId': 0, 'busModeSwitch': 0, 'shortCircuitDuration': 0, 'electricStrikeDelay': 0, 'randomElectricStrikeDelay': False, 'electricStrikeDuration': 3000, 'disableRtoAfterRing': True, 'rtoTimeout': 20, 'doorbellSuppression': 2, 'doorbellSuppressionDuration': 500, 'soundRing': 0, 'soundOpen': 0, 'soundRto': 0, 'soundCm': 0, 'soundConfirmation': 1, 'soundLevel': 150, 'singleButtonPressAction': 7, 'doubleButtonPressAction': 1, 'batteryType': 0, 'automaticBatteryTypeDetection': True, 'autoUpdateEnabled': True}
2022-08-29 13:16:54.530 DEBUG (MainThread) [custom_components.nuki_ng.nuki] async_json: http status: 204 -
2022-08-29 13:16:54.530 DEBUG (MainThread) [custom_components.nuki_ng.nuki] Manually updated nuki_ng data
File "/config/custom_components/nuki_ng/switch.py", line 146, in async_turn_off
File "/config/custom_components/nuki_ng/nuki.py", line 532, in update_config
File "/config/custom_components/nuki_ng/sensor.py", line 98, in state
File "/config/custom_components/nuki_ng/sensor.py", line 94, in native_value
@kvj I can see in the web gui that the switches are changing, when changing the state in homeassistant. But there will be a message with "Error: save configuration failed". Also in nuki web the last sync with the opener was at 10:58 and I cannot sync it. "Error: syncronisation failed"
So the message is arriving at nuki web, therefore I think the integration is using the right id.
The settings in nuki web are different to the app. I think the communication between the opener and nuki web is broken? Which would fit to async_json: http status: 204 -
which means, the message reached the server. But obviously not the opener.
2022-08-29 13:16:54.530 DEBUG (MainThread) [custom_components.nuki_ng.nuki] async_json: http status: 204 -
yeah, 204 here means that the command was accepted. Do you also have a bridge?
We obviously don't know when bridge will synchronize its state with web and device
You earlier reported that you were getting 400 on that command. Not a case anymore?
2022-08-29 13:16:54.530 DEBUG (MainThread) [custom_components.nuki_ng.nuki] async_json: http status: 204 -
yeah, 204 here means that the command was accepted. Do you also have a bridge?
We obviously don't know when bridge will synchronize its state with web and device
You earlier reported that you were getting 400 on that command. Not a case anymore?
Yes I have a bridge. Its required for the opener.
400 seems to be gone. Also the notification in homeassistant when changing the switch (something with ...GET...) is gone.
At the moment the switch is on. When I turn it off, it turns back on round about 30seconds later.
2022-08-29 20:55:10.924 DEBUG (MainThread) [custom_components.nuki_ng.nuki] Updating config: openerAdvancedConfig: {'doorbellSuppression': 2} = {'intercomId': 0, 'busModeSwitch': 0, 'shortCircuitDuration': 0, 'electricStrikeDelay': 0, 'randomElectricStrikeDelay': False, 'electricStrikeDuration': 3000, 'disableRtoAfterRing': True, 'rtoTimeout': 20, 'doorbellSuppression': 2, 'doorbellSuppressionDuration': 500, 'soundRing': 0, 'soundOpen': 0, 'soundRto': 0, 'soundCm': 0, 'soundConfirmation': 1, 'soundLevel': 150, 'singleButtonPressAction': 7, 'doubleButtonPressAction': 1, 'batteryType': 0, 'automaticBatteryTypeDetection': True, 'autoUpdateEnabled': True}
2022-08-29 20:55:11.001 DEBUG (MainThread) [custom_components.nuki_ng.nuki] async_json: http status: 204 -
2022-08-29 20:55:11.002 DEBUG (MainThread) [custom_components.nuki_ng.nuki] Manually updated nuki_ng data
2022-08-29 20:55:41.077 DEBUG (MainThread) [custom_components.nuki_ng.nuki] bridge_check_callback: {'callbacks': [{'id': 0, 'url': 'http://192.168.178.7:8123/api/webhook/nuki_ng_bridge_hook_xxx'}]}, http://192.168.178.7:8123/api/webhook/nuki_ng_bridge_hook_xxx
2022-08-29 20:55:41.077 DEBUG (MainThread) [custom_components.nuki_ng.nuki] Callback is set
2022-08-29 20:55:42.461 DEBUG (MainThread) [custom_components.nuki_ng.nuki] _update: {"devices": {"xxx": {"deviceType": 0, "nukiId": xxx, "name": "haustuere", "firmwareVersion": "2.12.4", "lastKnownState": {"mode": 2, "state": 1, "stateName": "locked", "batteryCritical": false, "batteryCharging": false, "batteryChargeState": 98, "timestamp": "2022-08-29T18:14:33+00:00"}, "webId": 5xxxxxxx8, "web_auth": {}, "last_log": {}, "config": null, "advancedConfig": null, "openerAdvancedConfig": null, "bridge_info": {"deviceType": 0, "nukiId": xxx, "name": "Nuki_xxx", "rssi": -48, "paired": true}}, "505732434": {"deviceType": 2, "nukiId": xxx, "name": "opener", "firmwareVersion": "1.8.1", "lastKnownState": {"mode": 2, "state": 1, "stateName": "online", "batteryCritical": false, "ringactionTimestamp": "2022-08-28T17:32:49+00:00", "ringactionState": false, "timestamp": "2022-08-29T16:17:54+00:00"}, "webId": xxx, "web_auth": {"xxx": {"id": "xxx", "smartlockId": xxx, "authId": xxx, "type": 0, "name": "Nuki Web", "enabled": false, "remoteAllowed": true, "lockCount": 0, "lastActiveDate": "2022-08-25T04:37:16.000Z", "creationDate": "2022-08-25T04:37:16.000Z", "updateDate": "2022-08-29T08:58:34.250Z"}, "xxx": {"id": "xxx", "smartlockId": xxx, "authId": xxx, "type": 0, "name": "user1", "enabled": true, "remoteAllowed": true, "lockCount": 9, "lastActiveDate": "2022-08-28T17:32:46.000Z", "creationDate": "2022-08-24T18:32:47.000Z", "updateDate": "2022-08-29T08:14:45.315Z"}, "xxx": {"id": "xxx", "smartlockId": xxx, "authId": xxx, "type": 0, "name": "user2", "enabled": true, "remoteAllowed": true, "lockCount": 0, "lastActiveDate": "2022-08-28T09:00:32.000Z", "creationDate": "2022-08-28T09:00:32.000Z", "updateDate": "2022-08-29T08:14:45.336Z"}}, "last_log": {"name": "user1", "action": "unlatch", "timestamp": "2022-08-28T15:33:44.000+00:00"}, "config": {"name": "opener", "latitude": xxx, "longitude": xxx, "capabilities": 1, "pairingEnabled": true, "buttonEnabled": true, "ledEnabled": true, "timezoneOffset": 0, "daylightSavingMode": 1, "fobPaired": false, "fobAction1": 7, "fobAction2": 0, "fobAction3": 0, "operatingMode": 1, "advertisingMode": 0, "keypadPaired": false, "homekitState": 0, "timezoneId": 37}, "advancedConfig": null, "openerAdvancedConfig": {"intercomId": 0, "busModeSwitch": 0, "shortCircuitDuration": 0, "electricStrikeDelay": 0, "randomElectricStrikeDelay": false, "electricStrikeDuration": 3000, "disableRtoAfterRing": true, "rtoTimeout": 20, "doorbellSuppression": 3, "doorbellSuppressionDuration": 500, "soundRing": 0, "soundOpen": 0, "soundRto": 0, "soundCm": 0, "soundConfirmation": 1, "soundLevel": 150, "singleButtonPressAction": 7, "doubleButtonPressAction": 1, "batteryType": 0, "automaticBatteryTypeDetection": true, "autoUpdateEnabled": true}, "bridge_info": {"deviceType": 2, "nukiId": xxx, "name": "Nuki_Opener_xxx", "rssi": -54, "paired": true}}}, "bridge_info": {"bridgeType": 1, "ids": {"hardwareId": xxx, "serverId": xxx}, "versions": {"firmwareVersion": "2.14.0", "wifiFirmwareVersion": "2.3.0"}, "uptime": 16464, "currentTime": "2022-08-29T18:55:36+00:00", "wlanConnected": true, "serverConnected": true, "scanResults": [{"deviceType": 2, "nukiId": xxx, "name": "xxx", "rssi": -54, "paired": true}, {"deviceType": 0, "nukiId": xxx, "name": "xxx", "rssi": -48, "paired": true}], "callbacks_list": [{"id": 0, "url": "http://192.168.178.7:8123/api/webhook/nuki_ng_bridge_hook_xxx"}]}}
2022-08-29 20:55:42.462 DEBUG (MainThread) [custom_components.nuki_ng.nuki] Finished fetching nuki_ng data in 1.461 seconds (success: True)
NukiWeb was disabled as a user for the opener :face_in_clouds: . It seems to work.
When I turn on ring suppression in homeassistant:
When I turn off ring suppression in homeassistant:
But what about ring? As far as I see you are using suppression 2 and 3.
4 = suppress everything, 3 = suppress rto and continous mode 2 = only suppress RtO 1 = only suppress continous mode 0 = suppress nothing
Maybe three separate switches, which leads to the specific number?
@kvj can you change the suppression mode? At the moment the suppression is useless as it does not suppress the ring. It should change to mode 4 if activated, and back to the mode which was activated previously. Or make all three switches available. (RtO, Continous, All)
I am thinking about getting the Nuki Opener and this is a go/no-go thing having the option to suppress the ringer. So I'd be happy to have it installed soon and participate in testing. Also, does HA know when the doorbell has been pushed with this integration?
I am thinking about getting the Nuki Opener and this is a go/no-go thing having the option to suppress the ringer. So I'd be happy to have it installed soon and participate in testing. Also, does HA know when the doorbell has been pushed with this integration?
At the moment it is working, but with wrong settings. I use a web api call. So there is a way. And yes, the integration knows when the doorbell has been pushed.
@Se7enair I see where the problem is. The API field is a bit-mask so maybe I'm flipping the wrong bit.
I can replace the switch with select and expose all the combinations there
Select would be also great ;)
Hey :) Is there a way to create a switch that can toggle the ring suppression on the Nuki Opener?