Nuki Card with Callback support (supports both Lock & Opener, it replaces the official integration)

If you want to write easy instructions using the browser, I can include it in the first post when I update it with v6.0. :slight_smile:

Thanks, I have to analyze the code, will do it tonight. Just one question: the code already updated the sensors with all 3 platforms (trigger, state, reload), what’s the difference? Why did you have to split in 3 automations? Looks overkill to me. But I have to read the code first.

I don’t understand: the sensors from REST call were already updated, why did you need to do force_update? You noticed they weren’t updated? When one of the REST sensor is updated why do you have to trigger something? The only trigger needed is from the bridge callback, all the rest of the sensors should be updated at low priority by the polling REST commands.

I’ll give you a complete feedback once I check the code…now it’s pool time with the kids. :slight_smile:

The reason why I splitted it up into 3 automations, is that I didn’t succeed in updating the sensors from different sources correctly. So I decided to use input_text fields for updating the sensors and I was able to update the input_text fields from different automations. For me it makes the code more readable and easier to debug.

Have fun at the pool.

Did you try the 6.0-beta1 I shared? It’s working perfectly here, and all sensors are updating…

I’m also thinking to put all the polled info in attributes of the door sensor instead of making a sensor of each one.

Thanks, we had fun with a couple of friends and their families. Hope you had a relaxing sunday too.

Further 0.6b1 feedback - had one issue today after unlocking binary_sensor.nuki_door_state and Nuki Lock Action became unavailable for good 60+ seconds, also I noticed those entities are unavailable for few seconds every now and then. Other than that - no problems.

Try RC1 and let me know if it behaves better. :slight_smile:

########################
# Nuki Card v6.0-rc1   #
########################

#######################################################################################################################
###                                                                                                                 ###
### Automations                                                                                                     ###
###                                                                                                                 ###
#######################################################################################################################

automation:
  - id: "nuki_card_callback"
    alias: Nuki Card Callback
    description: Automation for the Nuki doorlock
    trigger:
      - platform: webhook
        webhook_id: !secret nuki_bridge_webhook
      - platform: event
        event_type:
          - automation_reloaded
          - event_template_reloaded
      - platform: state
        entity_id: sensor.nuki_door_sensor_state
        to:
          - "open"
          - "closed"
      - platform: state
        entity_id: sensor.nuki_lock_sensor_state
        to:
          - "locked"
          - "unlocked"
    condition: []
    action:
      - choose:
          - conditions: >
              {{ trigger.platform == 'webhook' }}
            sequence:
              - service: input_text.set_value
                target:
                  entity_id: input_text.nuki_bridge_door_sensor
                data:
                  value: >
                    {% set my_state = {1: 'deactivated', 2: 'closed', 3: 'open', 4: 'unknown', 5: 'calibrating'} %}
                    {{ my_state[trigger.json.doorsensorState] }}
              - service: input_text.set_value
                target:
                  entity_id: input_text.nuki_bridge_lock_sensor
                data:
                  value: >
                    {% set my_state = {0: 'uncalibrated', 1: 'locked', 2:'unlocking', 3: 'unlocked', 4: 'locking', 5: 'unlatched', 6: "unlocked (lock 'n' go)", 7: 'unlatching', 254: 'motor blocked', 255: 'undefined'} %}
                    {{ my_state[trigger.json.state] }}
              - service: input_text.set_value
                target:
                  entity_id: input_text.nuki_bridge_last_activity
                data:
                  value: >
                    {{ as_timestamp(now()) | timestamp_custom("%H:%M:%S (%b %d)") }}
              - service: input_text.set_value
                target:
                  entity_id: input_text.nuki_bridge_trigger_platform
                data:
                  value: >
                    {{ trigger.platform }}
          - conditions: >
              {{ trigger.platform == 'state' or trigger.platform == 'event' }}
            sequence:
              - service: input_text.set_value
                target:
                  entity_id: input_text.nuki_bridge_door_sensor
                data:
                  value: >
                    {{ states('sensor.nuki_door_sensor_state') }}
              - service: input_text.set_value
                target:
                  entity_id: input_text.nuki_bridge_lock_sensor
                data:
                  value: >
                    {{ states('sensor.nuki_lock_sensor_state') }}
              - service: input_text.set_value
                target:
                  entity_id: input_text.nuki_bridge_last_activity
                data:
                  value: >
                    {{ states('sensor.nuki_last_activity') }}
              - service: input_text.set_value
                target:
                  entity_id: input_text.nuki_bridge_trigger_platform
                data:
                  value: >
                    {{ trigger.platform }}
        default: []
    mode: single

#######################################################################################################################
###                                                                                                                 ###
### Binary sensors                                                                                                  ###
###                                                                                                                 ###
#######################################################################################################################

binary_sensor:
  - platform: template
    sensors:
      nuki_door_state:
        unique_id: nuki_door_state
        friendly_name: "Nuki Door State"
        device_class: door
        value_template: >
          {{ is_state('input_text.nuki_bridge_door_sensor', 'open') }}
        availability_template: >
          {{ (is_state('sensor.nuki_door_sensor_state', 'open') or is_state('sensor.nuki_door_sensor_state', 'closed')) }}
        icon_template: >
          {% set trigdoor = states('input_text.nuki_bridge_door_sensor') %}
          {% set triglock = states('input_text.nuki_bridge_lock_sensor') %}
          {% if (trigdoor == 'open') %}
            mdi:door-open
          {% elif trigdoor == 'closed' and triglock == 'locked' %}
            mdi:door-closed-lock
          {% elif trigdoor == 'closed' and triglock == 'unlocked' %}
            mdi:door-closed
          {% else %}
            mdi:alert-box-outline
          {% endif %}
        attribute_templates:
          trigger_platform: >
            {{ states('input_text.nuki_bridge_trigger_platform') }}
          nuki_id: >
            {{ states('sensor.nuki_id') }}
          door_state: >
            {{ states('input_text.nuki_bridge_door_sensor') }}
          lock_state: >
            {{ states('input_text.nuki_bridge_lock_sensor') }}
          lock_battery: >
            {{ states('sensor.nuki_lock_battery_level') }}
          lock_battery_critical: >
            {{ states('sensor.nuki_lock_battery_critical_state') }}
          keypad_battery_critical: >
            {% if states('sensor.nuki_keypad_battery_critical_state') != 'unknown' %}
              {{ states('sensor.nuki_keypad_battery_critical_state') }}
            {% else %}
              not installed 
            {% endif %}
          last_update: >
            {{ states('input_text.nuki_bridge_last_activity') }}
          last_update_polled: >
            {{ states('sensor.nuki_last_activity') }}
          door_sensor_polled: >
            {{ states('sensor.nuki_door_sensor_state') }}
          lock_sensor_polled: >
            {{ states('sensor.nuki_lock_sensor_state') }}

#######################################################################################################################
###                                                                                                                 ###
### Input Texts                                                                                                     ###
###                                                                                                                 ###
#######################################################################################################################
input_text:
  nuki_bridge_host:
    name: "Nuki Card (bridge host)"
    initial: !secret nuki_bridge_host
  nuki_bridge_port:
    name: "Nuki Card (bridge port)"
    initial: !secret nuki_bridge_port
  nuki_bridge_token:
    name: "Nuki Card (bridge token)"
    initial: !secret nuki_bridge_token
  nuki_bridge_door_sensor:
    name: "Nuki Card (door sensor)"
  nuki_bridge_lock_sensor:
    name: "Nuki Card (lock sensor)"
  nuki_bridge_last_activity:
    name: "Nuki Card (last activity)"
  nuki_bridge_trigger_platform:
    name: "Nuki Card (trigger platform)"

#######################################################################################################################
###                                                                                                                 ###
### Locks                                                                                                           ###
###                                                                                                                 ###
#######################################################################################################################

lock:
  - platform: template
    name: "Nuki Lock Action"
    unique_id: nuki_lock_action
    value_template: >
      {{ is_state_attr('binary_sensor.nuki_door_state', 'lock_state', 'locked') }}
    availability_template: >
      {{ is_state_attr('binary_sensor.nuki_door_state', 'lock_state', 'locked') or
        is_state_attr('binary_sensor.nuki_door_state', 'lock_state', 'unlocked')}}
    lock:
      service: rest_command.nuki_lock_action
      data:
        action: 2
    unlock:
      service: rest_command.nuki_lock_action
      data:
        action: 1

#######################################################################################################################
###                                                                                                                 ###
### rest commands                                                                                                   ###
###                                                                                                                 ###
#######################################################################################################################

rest_command:
  nuki_lock_action:
    url: "http://{{ states('input_text.nuki_bridge_host') }}:{{ states('input_text.nuki_bridge_port') }}/lockAction?nukiId={{ states('sensor.nuki_id') }}&token={{ states('input_text.nuki_bridge_token') }}&action={{ action }}"

#######################################################################################################################
###                                                                                                                 ###
### sensors                                                                                                         ###
###                                                                                                                 ###
#######################################################################################################################

sensor:
  - platform: rest
    scan_interval: 150
    resource_template: "http://{{ states('input_text.nuki_bridge_host') }}:{{ states('input_text.nuki_bridge_port') }}/list?&token={{ states('input_text.nuki_bridge_token') }}"
    name: "Nuki Endpoint List"
    value_template: "OK"
    json_attributes:
      - lastKnownState
      - firmwareVersion
      - nukiId
      - name

  - platform: rest
    scan_interval: 150
    resource_template: "http://{{ states('input_text.nuki_bridge_host') }}:{{ states('input_text.nuki_bridge_port') }}/info?&token={{ states('input_text.nuki_bridge_token') }}"
    name: "Nuki Endpoint Info"
    value_template: "OK"
    json_attributes:
      - versions
      - scanResults
      - wlanConnected
      - serverConnected

  - platform: template
    sensors:
      nuki_device_name:
        unique_id: nuki_device_name
        friendly_name: "Nuki Device Name"
        icon_template: mdi:alphabetical-variant
        value_template: >
          {% if states('sensor.nuki_endpoint_info') == "OK" %}
            {{ state_attr('sensor.nuki_endpoint_info','scanResults')[0]['name'] }}
          {% endif %}

  - platform: template
    sensors:
      nuki_bridge_fw_version:
        unique_id: nuki_bridge_fw_version
        friendly_name: "Nuki Bridge FW Version"
        icon_template: mdi:numeric
        value_template: >
          {% if states('sensor.nuki_endpoint_info') == "OK" %}
            {{ state_attr('sensor.nuki_endpoint_info','versions')['firmwareVersion'] }}
          {% endif %}

      nuki_bridge_lock_bt_rssi:
        unique_id: nuki_bridge_lock_bt_rssi
        friendly_name: "Nuki Bridge<->Lock BT RSSI"
        icon_template: mdi:signal-distance-variant
        value_template: >
          {% if states('sensor.nuki_endpoint_info') == "OK" %}
            {{ state_attr('sensor.nuki_endpoint_info','scanResults')[0]['rssi'] }}
          {% endif %}

      nuki_bridge_wifi_connected:
        unique_id: nuki_bridge_wifi_connected
        friendly_name: "Nuki Bridge WiFi Connected"
        icon_template: mdi:wifi-cog
        value_template: >
          {% if states('sensor.nuki_endpoint_info') == "OK" %}
            {{ state_attr('sensor.nuki_endpoint_info','wlanConnected') }}
          {% endif %}

      nuki_bridge_wifi_fw_version:
        unique_id: nuki_bridge_wifi_fw_version
        friendly_name: "Nuki Bridge WiFi FW Version"
        icon_template: mdi:numeric
        value_template: >
          {% if states('sensor.nuki_endpoint_info') == "OK" %}
            {{ state_attr('sensor.nuki_endpoint_info','versions')['wifiFirmwareVersion'] }}
          {% endif %}

      nuki_bridge_cloud_connected:
        unique_id: nuki_bridge_cloud_connected
        friendly_name: "Nuki Bridge Cloud Connected"
        icon_template: mdi:server-network
        value_template: >
          {% if states('sensor.nuki_endpoint_info') == "OK" %}
            {{ state_attr('sensor.nuki_endpoint_info','serverConnected') }}
          {% endif %}

      nuki_bridge_lock_bt_state:
        unique_id: nuki_bridge_lock_bt_state
        friendly_name: "Nuki Bridge<->Lock BT State"
        icon_template: >
          {% if states('sensor.nuki_endpoint_info') == "OK" %}
            {% if state_attr('sensor.nuki_endpoint_info','scanResults')[0]['paired'] %}
              mdi:bluetooth-connect
            {% elif not state_attr('sensor.nuki_endpoint_info','scanResults')[0]['paired'] %}
              mdi:bluetooth-off
            {% else %}
              mdi:bluetooth-audio
            {% endif %}
          {% endif %}
        value_template: >
          {% if states('sensor.nuki_endpoint_info') == "OK" %}
            {% if state_attr('sensor.nuki_endpoint_info','scanResults')[0]['paired'] %}
              connected
            {% elif not state_attr('sensor.nuki_endpoint_info','scanResults')[0]['paired'] %}
              disconnected
            {% else %}
              Unknown
            {% endif %}
          {% endif %}

      nuki_id:
        unique_id: nuki_id
        friendly_name: "Nuki ID"
        icon_template: mdi:numeric
        value_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {{ state_attr('sensor.nuki_endpoint_list','nukiId') }}
          {% endif %}

      nuki_lock_fw_version:
        unique_id: nuki_lock_fw_version
        friendly_name: "Nuki Lock FW Version"
        icon_template: mdi:numeric
        value_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {{ state_attr('sensor.nuki_endpoint_list','firmwareVersion') }}
          {% endif %}

      nuki_lock_battery_critical_state:
        unique_id: nuki_lock_battery_critical_state
        friendly_name: "Nuki Lock Battery Critical State"
        icon_template: mdi:battery-alert-variant-outline
        value_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {{ state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryCritical'] }}
          {% endif %}

      nuki_friendly_name:
        unique_id: nuki_friendly_name
        friendly_name: "Nuki Friendly Name"
        icon_template: mdi:numeric
        value_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {{ state_attr('sensor.nuki_endpoint_list','name') }}
          {% endif %}

      nuki_last_activity:
        unique_id: nuki_last_activity
        friendly_name: "Nuki Last Activity"
        icon_template: mdi:clock-check-outline
        value_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {{ (as_timestamp(state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['timestamp'])) | timestamp_custom("%H:%M:%S (%b %d)") }}
          {% endif %}

      nuki_lock_battery_level:
        unique_id: nuki_lock_battery_level
        friendly_name: "Nuki Lock Battery Level"
        device_class: "battery"
        unit_of_measurement: "%"
        icon_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {% set battery_level = state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryChargeState'] | default(0) | int %}
            {% set battery_charging = state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryCharging'] %}
            {% set battery_round = (battery_level / 10) | int * 10 %}
            {% if battery_round >= 100 and not battery_charging %}
              mdi:battery
            {% elif battery_round >= 100 and battery_charging %}
              mdi:battery-charging
            {% elif battery_round > 0 and not battery_charging %}
              mdi:battery-{{ battery_round }}
            {% elif battery_round > 0 and battery_charging %}
              mdi:battery-charging-{{ battery_round }}
            {% else %}
              mdi:battery-alert-variant-outline
            {% endif %}
          {% endif %}
        value_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {% set battery_level = state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryChargeState'] | default(0) | int %}
            {% if state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryCharging'] %}
              {{ battery_level }}
            {% else %}
              {{ battery_level }}
            {% endif %}
          {% endif %}

      nuki_door_sensor_state:
        unique_id: nuki_door_sensor_state
        friendly_name: "Nuki Door Sensor State"
        icon_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {% set door_icon = state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['doorsensorState'] %}
            {% set lock_icon = state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['state'] %}
            {% if door_icon == 2 and lock_icon == 3 %}
              mdi:door-closed
            {% elif door_icon == 2 and lock_icon == 1 %}
              mdi:door-closed-lock
            {% elif door_icon == 3 %}
              mdi:door-open
            {% endif %}
          {% endif %}
        value_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {% set my_state = {1: 'deactivated', 2: 'closed', 3: 'open', 4: 'unknown', 5: 'calibrating'} %}
            {{ my_state[state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['doorsensorState']] }}
          {% endif %}

      nuki_lock_sensor_state:
        unique_id: nuki_lock_sensor_state
        friendly_name: "Nuki Lock Sensor State"
        icon_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {% set lock_icon = state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['state'] %}
            {% if lock_icon == 1 %}
              mdi:lock-outline
            {% elif lock_icon == 3 %}
              mdi:lock-open-outline
            {% endif %}
          {% endif %}
        value_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {% set my_state = {0: 'uncalibrated', 1: 'locked', 2:'unlocking', 3: 'unlocked', 4: 'locking', 5: 'unlatched', 6: "unlocked (lock ‘n’ go)", 7: 'unlatching', 254: 'motor blocked', 255: 'undefined'} %}
            {{ my_state[state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['state']] }}
          {% endif %}

      nuki_keypad_battery_critical_state:
        unique_id: nuki_keypad_battery_critical_state
        friendly_name: "Nuki Keypad Battery Critical State"
        icon_template: mdi:battery-alert-variant-outline
        value_template: >
          {% if states('sensor.nuki_endpoint_list') == "OK" %}
            {% if state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['keypadBatteryCritical'] != null %}
              {{ state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['keypadBatteryCritical'] }}
            {% else %}
              not installed 
            {% endif %}
          {% endif %}

Dear community,

here my approach which I successfully implemented yesterday.
Thanks in advance for any feedback, suggestions, comments …

Walter

Dear Walter,

I’m happy to have inspired and helped you solve a home automation problem. Your node-red idea is nice, well done. Check RC1 version I posted right above your post, I added the automation_reloaded event, could help.

      - platform: event
        event_type:
          - automation_reloaded
          - event_template_reloaded

Thanks a lot for your contribution, and don’t hesitate to give us feedbacks in this thread, we always need people like you to improve things and help others. :slight_smile:

One last thing: the door sensor is just a small magnet to attach near the lock, I highly recommend its use, for me knowing if the door is open or closed is maybe more important than knowing if it’s locked/unlocked.

Ciao,

Alessandro

Dear Alessandro,

thank you for your feedback. You are right - a reed sensor is a nice add on.

I just mentioned it because in your automation you are analyzing the POST-request-payload (callback/webhook) which comes in three different versions according to the official Nuki Bridge documentation (https://developer.nuki.io/page/nuki-bridge-http-api-1-12/4)
(normal, with sensor, with opener).
Your code works with sensor only because you read out doorsensorState (which is not available in the json map if you do not have the sensor).

{{ my_state[trigger.json.doorsensorState] }}

A “no sensor-version” of your automation would be fine.

And by the way: Forza squadra azzurra!

Walter

Yes, I always gave for granted that everybody had the doorsensor. I didn’t consider it like another device, like the keypad, the fob key, etc. :slight_smile:

A no door-sensor version would be focused only on the lock itself, but if you noticed, for me the door state is central, and it’s actually the main sensor.

I have to think about it…

Forza Azzurri!! :it:

Hi all,
Firstly, @alexdelprete thanks for your work on this.

I’ve just got my Nuki Smart Lock v2 and it’s all up and running. I’ve gone straight for this, rather than the official integration, and thought I’d done everything correctly, but alas I’ve messed something up along the way. :confused:

Some of the entities are working but others, including the state of the lock aren’t.

Logs are showing:

2021-07-07 19:12:26 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet: Unsupported URL protocol ''; Retrying in background in 30 seconds
2021-07-07 19:12:26 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet: Unsupported URL protocol ''; Retrying in background in 30 seconds
2021-07-07 19:12:52 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: dict object has no element Undefined when rendering '{% if states('sensor.nuki_endpoint_list') == "OK" %}
{% set my_state = {1: 'deactivated', 2: 'closed', 3: 'open', 4: 'unknown', 5: 'calibrating'} %}
{{ my_state[state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['doorsensorState']] }}
{% endif %}'
2021-07-07 19:12:52 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'batteryCharging' when rendering '{% if states('sensor.nuki_endpoint_list') == "OK" %}
{% set battery_level = state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryChargeState'] | default(0) | int %}
{% if state_attr('sensor.nuki_endpoint_list', 'lastKnownState')['batteryCharging'] %}
{{ battery_level }}
{% else %}
{{ battery_level }}
{% endif %}
{% endif %}'

Any ideas on where I should be looking or what I’ve missed?

Thanks!

Ciao,

what version of the Nuki Card are you using? the one in the first post or the automation version 6.0-rc1?

I think the problem is the fw version of the lock and bridge (specifically, the bridge). These are my versions, yours are really old. Upgrade firmware of all devices and it will work. :slight_smile:

image

I’ve used everything from the first post, should I update to 6.0-rc1?

Weird, I can only find a way to force a FW update check on the lock and it’s claiming that it’s up to date. :confused: I’ll leave it overnight and see if it has changed in the morning, if not I’ll get on to Nuki support and see if they can push the latest versions for me.

Grazie

I said “specifically the bridge”. :slight_smile:

All the info that you are missing in the integration are available only from a specific version of the bridge firmware. These are the minimum versions required for Bridge API v1.12 that this integration is based upon:

image

You can update the bridge quickly this way:

1 Like

@Sym0nd0 after you upgrade the bridge firmware, try the packaged version, it’s much easier to install so to avoid any possible copy&paste error.

Obviously you have to clean the previous integration split on multiple files.

If it works for you, I think I’ll release it, replacing the version of the first post.

1 Like

Boom! The FW update call did the trick, now have v2.9.3 for bridge and v2.2.0 wifi. :raised_hands:t2:

Now I know that it’s working, I’ll roll back to before setting this up and give the packaged version a go in the morning. If all goes to plan, as I’m sure it will, I’ll let you know.

Thanks again for all your help and work.

Glad you got it working. It’s my fault, I didn’t specify the prerequisites in the first post, when I’ll release the packaged version I’ll write a specific paragraph so to make sure that the environment is ok before installing the card.

Did you test locking/unlocking, opening/closing the door and reaction on the lovelace card? Is it fast enough?

I’ll wait for your feedback before releasing it.

I’ve just reinstalled using the packaged method and it’s all gone through smoothly, working identically the same as the split method.

Have a few warnings in the log, but doesn’t appear to be causing issues:

2021-07-08 11:12:58 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet: Unsupported URL protocol ''; Retrying in background in 30 seconds
2021-07-08 11:12:58 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet: Unsupported URL protocol ''; Retrying in background in 30 seconds
2021-07-08 11:13:19 WARNING (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Already running

The lovelace card isn’t responding to locking/unlocking or the door state. The lock/unlock triggers and works as expected but the state of the entities on the cards don’t update.

Enabled debug logging (I’ve tried to pick out what’s relevant below), restarted my instance, unlocked via lovelace and let it auto-lock:

2021-07-08 11:22:35 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.template
2021-07-08 11:22:35 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.template
2021-07-08 11:22:35 INFO (MainThread) [homeassistant.setup] Setting up rest
2021-07-08 11:22:35 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rest
2021-07-08 11:22:35 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rest
2021-07-08 11:22:35 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet: Unsupported URL protocol ''; Retrying in background in 30 seconds
2021-07-08 11:22:35 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet: Unsupported URL protocol ''; Retrying in background in 30 seconds
2021-07-08 11:22:35 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'ffmpeg', 'group', 'script', 'input_number', 'cast', 'input_select', 'zone', 'persistent_notification', 'blueprint', 'met', 'mqtt', 'counter', 'network', 'wled', 'tag', 'media_source', 'nest', 'sun', 'default_config', 'my', 'tts', 'mobile_app', 'logbook', 'ssdp', 'trace', 'dhcp', 'lock', 'updater', 'yeelight', 'hive', 'tasmota', 'rpi_power', 'google_home', 'binary_sensor', 'scene', 'timer', 'input_text', 'rest_command', 'zeroconf', 'map', 'input_boolean', 'input_datetime', 'hacs', 'system_health', 'automation', 'sensor', 'history', 'upnp'}
2021-07-08 11:22:54 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rest
2021-07-08 11:22:54 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rest
2021-07-08 11:22:54 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Initialized trigger Nuki Card Callback
2021-07-08 11:22:56 WARNING (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Already running
2021-07-08 11:22:56 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Running automation actions
2021-07-08 11:22:56 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Running automation actions
2021-07-08 11:22:56 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service
2021-07-08 11:22:57 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service
2021-07-08 11:22:57 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service
2021-07-08 11:22:57 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service
2021-07-08 11:24:06 INFO (MainThread) [homeassistant.helpers.script.nuki_lock_action] Nuki Lock Action: Running template script
2021-07-08 11:24:06 INFO (MainThread) [homeassistant.helpers.script.nuki_lock_action] Nuki Lock Action: Executing step call service
2021-07-08 11:25:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Running automation actions
2021-07-08 11:25:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Running automation actions
2021-07-08 11:25:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service
2021-07-08 11:25:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service
2021-07-08 11:25:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service
2021-07-08 11:25:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service
2021-07-08 11:30:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Running automation actions
2021-07-08 11:30:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Running automation actions
2021-07-08 11:30:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service
2021-07-08 11:30:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service
2021-07-08 11:30:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service
2021-07-08 11:30:26 INFO (MainThread) [homeassistant.components.automation.nuki_card_callback] Nuki Card Callback: Choose at step 1: choice 2: Executing step call service

After some delay, a couple of minutes maybe, the lock state updated both to show it unlocked and then locked on the lovelace card.

Let me know if you need anything more.

I think you have leftovers from the split configuration to the packaged one.

The package has been tested by several people with no particular issues, apart some warnings in log due to REST sensors being started after some others etc, but nothing special.

When you restart HA, you should see IMMEDIATELY the status of the lock and door sensor, and all those info sensors updated. If it takes time (minutes??), you can’t lock/unlock from lovelace, or else, it means you are still having install issues. Take into account that the REST calls to update info are being made at startup and then every 150 secs.

Clean everything and just use the packaged version, it should work straight-away pretty easily, but make sure you start from a clean known state. The REST sensors are important at startup time, make sure you don’t have the split ones when you transition to the packaged version. The fact that you mention it takes minutes to see some status updates leads me to think that the REST polling is not working.

Hey there,

I followed the instructions on post 1 and can see all the entities but most of them do not show any values and I cannot lock/unlock the door using the button.

Btw: I renamed the door sensor and lock action but this is not the reason for my problems. It was the same before renaming.

Anything I can do to figure out the reason for this?
Thanks!