jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
191 stars 46 forks source link

Failed to call service lock/lock. Code '' for locking Lock: Back Door doesn't match pattern ^\d4 #194

Closed npotgieter closed 1 year ago

npotgieter commented 1 year ago

Thank you for this incredibly useful integration.

This enables me to separate my Home Assistant instance from my zwave controller allowing me to reboot HA without impacting the stability of my zwave network.


Not sure if this was introduced by the recent HA update or by the integration update.

Been running a HE C7 hub for a while (firmware fully up to date) and it has been working flawlessly with my zwave locks, contact and water sensors.

Here is the issue:

Calling lock.lock or lock.unlock I receive the following error:

Failed to call service lock/lock. Code '' for locking Lock: Back Door doesn't match pattern ^\d4

Attributes listed in HA for the lock:

code_format: ^\d4$ codes: '1': name: a '2': name: b

code_length: 4 last_code_name: a max_codes: 250 friendly_name: Lock: Garage Door supported_features: 0

Please note:

All my other zwave devices are working flawlessly. Contact/water sensors.

jason0x43 commented 1 year ago

I'm seeing the same behavior. It looks like HA lock entities just started validating codes in the last couple of weeks, and the code format provided by this integration isn't correct. I should have a fix out shortly.

This enables me to separate my Home Assistant instance from my zwave controller allowing me to reboot HA without impacting the stability of my zwave network.

Just out of curiosity, how are you running Home Assistant? Typically HA and ZwaveJS run in separate Docker containers, so rebooting HA doesn't impact the ZwaveJS container.

npotgieter commented 1 year ago

I am not using ZwaveJs. I run HA in a VM on Proxmox. I use node-red and there is no easy way to roll back changes using a standard HA install. You can restore config files but have to deal with new entities created during testing, etc. My VM backups can be restored within a few minutes (restoring the entire environment to a previous state). My HE C7 is connected via physical cable to my network and it, as the zwave hub, maintains the zwave network state until the restored VM starts up and your integration "connects" the C7 hub with the HA "state engine" and commands can be sent via node-red or Lovelace UI again.

jason0x43 commented 1 year ago

This has been fixed in v0.8.5.

npotgieter commented 1 year ago

Updated to v0.8.5. Still receiving the following error: Failed to call service lock/lock. Code '' for locking Lock: Back Door doesn't match pattern ^\d(4)$

jason0x43 commented 1 year ago

Hmmm…that’s a different pattern, at least (it should be ^\d{4}$).

Is it actually saying Code ‘’, or are you just hiding the code? If that’s the actual error, are you sending an unlock command without a code?

npotgieter commented 1 year ago

Thx. Works perfectly now after I resolved an issue on my end.

Using the custom button card:

Pasting my code into the code editor dropped the code: '1111" parameter under the "service_data" section resulting in the following:

tap_action:
  action: call-service
  service: |
    [[[
      return (entity.state === 'locked') ? 'lock.unlock' : 'lock.lock';
    ]]]
  service_data:
    '1111': null
    entity_id: lock.lock_back_door

instead of:

tap_action:
  action: call-service
  service: |
    [[[
      return (entity.state === 'locked') ? 'lock.unlock' : 'lock.lock';
    ]]]
  service_data:
    code: '1111'
    entity_id: lock.lock_back_door