KeyMaster Z-Wave lock manager and scheduler

Ok…so I’m still navigating my way through HA…but I don’t have a users folder in my home directory…it’s empty. I’m running Hassio? Does that matter?

Either way here’s my ini (deck.ini) file:

#See README for more information.
[lockmanager]

#number of PINS to setup in lovelace
numcodes=6

#the name or location of the lock you are setting up (no spaces)
lockname="deck"

#the "lowest common denominator" of the factory lock name.  
lockfactoryname="lock.lock"

#The name of the (optional) door sensor.
sensorname="sensor"

#the "lowest common denominator" of the factory door sensor name.  
sensorfactoryname="vision_security_zd2105us_5_recessed_door_window_sensor"

#the Home Assistant EntityID of your (optional) garage door
garageentityid="binary_sensor.tilt_sensor_garage_sensor"

Just create a new directory in your home folder and put it there. Or you can clone it from the repo. Go to your home directory and issue the following:

git clone https://github.com/FutureTense/lock-manager

Put your lock.ini file in there (and delete the original ini file) and then run setup.sh. You will need to make it executable before you call it. And I think your lockfactoryname is wrong. I strongly recommend you exclude it from your system and then include it again. Then do the renaming as mentioned in README. There are a lot of entities, so I suggest that you exclude all of your locks, then add one lock at a time. Once you exclude all of your locks, make sure you check your entities and verify there are no stragglers left over. So now include the deck lock, and go through every entity for this device and append _deck. Find the lockfactoryname “lowest common denominator”. It should be something like: schlage_allegion_be469zp_connect_smart_deadbolt

After you get this working for one lock, the process is the same for the other locks. So concentrate on getting the deck working and the others will be easy. After running the script, you will have 3 new directories in your lock-manager directory if you have 3 ini files. You only need those new directories copied over to the home assistant packages directory, but I find it easier just to copy the entire lock-manager directory.

I’ve never used Hassio, and I suspect that’s part of the problem. You might need to use a linux OS to run setup.sh, as Hassio might be missing some commands used in the script. If you have access to another Linux machine, try cloning the repo and running there. If you don’t get any errors, find a way of copying the new directories it created (or the entire lock-manager folder) to your Hassio packages directory.

FYI - I was about to switch to this package from ptdalen’s and got the same error message when I ran the script. I’m not using Home Assistant (formerly Hassio), I’m using HA Core in Docker.

I appreciate the time you’ve taken to help solve the problem but it seems to be something linked to the OS or Hassio that breaks the install/setup…I have a SAMBA share setup, would you be willing to break down the directory/file structure? Seems like it would just be easier to set it up manually rather than fiddling with the setup file at this point. Looks like a great little script…can’t wait to play with it! Thanks again!

I’m suspecting it’s a command inside the script for a program that is missing. I’ll take a look

Ok so I have been running one lock for a month or so. I just pulled the latest code down and made sure I had all the changes. My first lock still still working (However it doesn’t want to set a random value when I disable a user) Not sure why but I can change a user code and have it work.

My big problem is I added backdoor and now I am getting errors around the backdoor. These 2 errors show up in the log, and it never tries to update the lock on the zwave stack.


Error rendering data template: str: Invalid entity ID 'input_text.backdoor_pin_'
2:46 PM helpers/service.py (ERROR)
Error while executing automation automation.backdoor_clear_code. Invalid data for call_service at pos 1: expected int for dictionary value @ data['code_slot']
2:46 PM helpers/script.py (ERROR)

I have added a 3rd door garage and get the exact same issues on that door.

I too am having this same problem. I have the same line errors on 80 and 97. This happens even with the test directory. Any solution to this?

Ya not sure what is happening here looks like the code is expecting an int variable but not getting one. I have been slammed at work and had no free time to dig into it myself. I was hoping @FutureTense might have an ah-ha moment and go “Opps change this setting”

Paste the automation bits here so we can see about helping.

Since your code is generated via a script you’ll need to post your actual automation yml file bits where the error is occurring.

It isn’t my code it is all in github address above.

Your code could have typos, or other issues related to your configuration. Posting the link to the source in github does not help troubleshoot your issues. The code works for many others, so it could be something in your config that is causing the problem.

Fair enough here are the 3 ini files. FrontDoor is working the other two are not. The ini file is the only file you modify in this. The rest are auto generated by the setup.sh file in github:

FrontDoor.ini contents

#See README for more information.
[lockmanager]

#number of PINS to setup in lovelace
numcodes=6

#the name or location of the lock you are setting up (no spaces)
lockname="FrontDoor"

#the "lowest common denominator" of the factory lock name.  
lockfactoryname="schlage_allegion_be469zp_connect_smart_deadbolt"

#The name of the (optional) door sensor.
sensorname="front_door"

#the "lowest common denominator" of the factory door sensor name.  
sensorfactoryname="front_door_sensor"

#the Home Assistant EntityID of your (optional) garage door
garageentityid="cover.tess_2"

BackDoor.ini

#See README for more information.
[lockmanager]

#number of PINS to setup in lovelace
numcodes=6

#the name or location of the lock you are setting up (no spaces)
lockname="BackDoor"

#the "lowest common denominator" of the factory lock name.  
lockfactoryname="schlage_be469zp_backdoor"

#The name of the (optional) door sensor.
sensorname="backdoor"

#the "lowest common denominator" of the factory door sensor name.  
sensorfactoryname="backdoor_sensor"

#the Home Assistant EntityID of your (optional) garage door
garageentityid="cover.s2000_2"

Garage.ini

#See README for more information.
[lockmanager]

#number of PINS to setup in lovelace
numcodes=6

#the name or location of the lock you are setting up (no spaces)
lockname="Garage"

#the "lowest common denominator" of the factory lock name.  
lockfactoryname="schlage_allegion_be469zp_connect_smart_deadbolt"

#The name of the (optional) door sensor.
sensorname="garage_door"

#the "lowest common denominator" of the factory door sensor name.  
sensorfactoryname="garage_door_sensor"

#the Home Assistant EntityID of your (optional) garage door
garageentityid="cover.tess_2"

Post the yml files from /homeassistant/packages/lockmanager

I will have to do that in a week when I am back home there are 6 or more per lock that it generates.

Same issue here.

awk: line 9: syntax error at or near [
awk: line 10: syntax error at or near [
awk: line 11: syntax error at or near else
awk: line 12: syntax error at or near [
awk: line 16: syntax error at or near [
lock_manager.ini is incomplete or does not exist
./setup.sh: line 80: ((: i<=: syntax error: operand expected (error token is “<=”)
./setup.sh: line 97: ((: i<=: syntax error: operand expected (error token is “<=”)
creating
mkdir: missing operand
Try ‘mkdir --help’ for more information.
mv: missing destination file operand after ‘*.yaml’
Try ‘mv --help’ for more information.
mv: missing destination file operand after ‘_lovelace’
Try ‘mv --help’ for more information.

I can gladly give you access to the config if you want to try it.

Here is where I fail:

when I run the setup.sh no new folder generate as the github instructions state would.

I am only trying to setup one lock, here is the ini:
FrontDoor.ini:

#See README for more information.
[lockmanager]

#number of PINS to setup in lovelace
numcodes=6

#the name or location of the lock you are setting up (no spaces)
lockname="FrontDoor"

#the "lowest common denominator" of the factory lock name.  
lockfactoryname="kwikset_spectrum_brands_unknown_type_0003_id_0541"

#The name of the (optional) door sensor.
sensorname="frontdoor"

#the "lowest common denominator" of the factory door sensor name.  
sensorfactoryname="lumi_lumi_sensor_magnet_aq2_7c804e04remind"

#the Home Assistant EntityID of your (optional) garage door
garageentityid="cover.garage_door_opener"


I might be overlooking something but I see not yaml files in the directory. There are .txt files. As far as I can tell the only thing edited from the Github is the FrontDoor.ini nothing else was touched.

I assume the lock_manager.txt file is the file you need to see?

if so:


############  input_number:  #####################  
input_number:
  accesscount_LOCKNAME_TEMPLATENUM:
    name: Access Count
    min: 0
    max: 100
    step: 1
    unit_of_measurement: "Openings Left"

#################  input_datetime:  ##############  
input_datetime:
  end_date_LOCKNAME_TEMPLATENUM:
    name: 'End'
    has_time: false
    has_date: true
  start_date_LOCKNAME_TEMPLATENUM:
    name: 'Start'
    has_time: false
    has_date: true

  sun_start_date_LOCKNAME_TEMPLATENUM:
    name: 'Start'
    has_time: true
    has_date: false
  sun_end_date_LOCKNAME_TEMPLATENUM:
    name: 'End'
    has_time: true
    has_date: false

  mon_start_date_LOCKNAME_TEMPLATENUM:
    name: 'Start'
    has_time: true
    has_date: false
  mon_end_date_LOCKNAME_TEMPLATENUM:
    name: 'End'
    has_time: true
    has_date: false

  tue_start_date_LOCKNAME_TEMPLATENUM:
    name: 'Start'
    has_time: true
    has_date: false
  tue_end_date_LOCKNAME_TEMPLATENUM:
    name: 'End'
    has_time: true
    has_date: false

  wed_start_date_LOCKNAME_TEMPLATENUM:
    name: 'Start'
    has_time: true
    has_date: false
  wed_end_date_LOCKNAME_TEMPLATENUM:
    name: 'End'
    has_time: true
    has_date: false

  thu_start_date_LOCKNAME_TEMPLATENUM:
    name: 'Start'
    has_time: true
    has_date: false
  thu_end_date_LOCKNAME_TEMPLATENUM:
    name: 'End'
    has_time: true
    has_date: false

  fri_start_date_LOCKNAME_TEMPLATENUM:
    name: 'Start'
    has_time: true
    has_date: false
  fri_end_date_LOCKNAME_TEMPLATENUM:
    name: 'End'
    has_time: true
    has_date: false

  sat_start_date_LOCKNAME_TEMPLATENUM:
    name: 'Start'
    has_time: true
    has_date: false
  sat_end_date_LOCKNAME_TEMPLATENUM:
    name: 'End'
    has_time: true
    has_date: false


####################  input_text:  ###############  
input_text:
  LOCKNAME_name_TEMPLATENUM:
    name: 'Name'
  LOCKNAME_pin_TEMPLATENUM:
    name: 'PIN'

#################  input_boolean: ################  
input_boolean:
  notify_LOCKNAME_TEMPLATENUM:
    name: 'Notifications'
  daterange_LOCKNAME_TEMPLATENUM:
    name: 'Use Date Range'
  smtwtfs_LOCKNAME_TEMPLATENUM:
    name: 'Use SMTWTFS'
  enabled_LOCKNAME_TEMPLATENUM:
    name: 'Enabled'
  accesslimit_LOCKNAME_TEMPLATENUM:
    name: 'Limit Access Count'
    initial: off
  reset_advanced_LOCKNAME_TEMPLATENUM:
    name: 'Reset Advanaced Options'
    initial: off

  sun_LOCKNAME_TEMPLATENUM:
    name: 'Sunday'
    initial: on

  mon_LOCKNAME_TEMPLATENUM:
    name: 'Monday'
    initial: on

  tue_LOCKNAME_TEMPLATENUM:
    name: 'Tuesday'
    initial: on

  wed_LOCKNAME_TEMPLATENUM:
    name: 'Wednesday'
    initial: on

  thu_LOCKNAME_TEMPLATENUM:
    name: 'Thursday'
    initial: on

  fri_LOCKNAME_TEMPLATENUM:
    name: 'Friday'
    initial: on

  sat_LOCKNAME_TEMPLATENUM:
    name: 'Saturday'
    initial: on

################  automation: #################  
automation:

- alias: reset_advanced_CASE_LOCK_NAME_TEMPLATENUM
  trigger:
    entity_id: input_boolean.reset_advanced_LOCKNAME_TEMPLATENUM
    platform: state
    to: 'on'
  action:
    - service: input_number.set_value
      data_template:
        entity_id: input_number.accesscount_LOCKNAME_TEMPLATENUM
        value: "0"
      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.sun_start_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.sun_end_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.mon_start_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.mon_end_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.tue_start_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.tue_end_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.wed_start_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.wed_end_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.thu_start_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.thu_end_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.fri_start_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.fri_end_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.sat_start_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
    - service: input_datetime.set_datetime
      entity_id: input_datetime.sat_end_date_LOCKNAME_TEMPLATENUM
      data_template:
        time: >
          {{  (("00:00")  | timestamp_custom("%H:%M"))  }}      
          
    - service: input_datetime.set_datetime
      entity_id: input_datetime.start_date_LOCKNAME_TEMPLATENUM
      data_template:
        date: >
          {{  (("1980-01-01")  | timestamp_custom("%Y %m %d"))  }}      
          
    - service: input_datetime.set_datetime
      entity_id: input_datetime.end_date_LOCKNAME_TEMPLATENUM
      data_template:
        date: >
          {{  (("1980-01-01")  | timestamp_custom("%Y %m %d"))  }}      

    - service: input_boolean.turn_off
      entity_id: input_boolean.daterange_LOCKNAME_TEMPLATENUM

    - service: input_boolean.turn_off
      entity_id: input_boolean.accesslimit_LOCKNAME_TEMPLATENUM
      
    - service: input_boolean.turn_off
      entity_id: input_boolean.reset_advanced_LOCKNAME_TEMPLATENUM
      
    - service: input_boolean.turn_on
      entity_id: input_boolean.sun_LOCKNAME_TEMPLATENUM
      
    - service: input_boolean.turn_on
      entity_id: input_boolean.mon_LOCKNAME_TEMPLATENUM
      
    - service: input_boolean.turn_on
      entity_id: input_boolean.tue_LOCKNAME_TEMPLATENUM
      
    - service: input_boolean.turn_on
      entity_id: input_boolean.wed_LOCKNAME_TEMPLATENUM
      
    - service: input_boolean.turn_on
      entity_id: input_boolean.thu_LOCKNAME_TEMPLATENUM
      
    - service: input_boolean.turn_on
      entity_id: input_boolean.fri_LOCKNAME_TEMPLATENUM
      
    - service: input_boolean.turn_on
      entity_id: input_boolean.sat_LOCKNAME_TEMPLATENUM
      
################  binary_sensor: #################  
binary_sensor:

- platform: template
  sensors:

    enabled_LOCKNAME_TEMPLATENUM:
      value_template: "{{ is_state('input_boolean.enabled_LOCKNAME_TEMPLATENUM', 'on') }}"

    daterange_LOCKNAME_TEMPLATENUM:
      value_template: "{{ (is_state('input_boolean.daterange_LOCKNAME_TEMPLATENUM', 'off') or ((states.input_datetime.start_date_LOCKNAME_TEMPLATENUM.attributes.timestamp| int | timestamp_custom('%Y%m%d', False)|int)|string <= now().strftime('%Y%m%d')) and (states.input_datetime.end_date_LOCKNAME_TEMPLATENUM.attributes.timestamp| int | timestamp_custom('%Y%m%d', False)|int)|string >=  now().strftime('%Y%m%d'))}}"

    sun_LOCKNAME_TEMPLATENUM:
      entity_id:
        - sensor.time
        - input_datetime.sun_start_date_LOCKNAME_TEMPLATENUM
        - input_datetime.sun_end_date_LOCKNAME_TEMPLATENUM
      value_template: "{{ ((is_state('input_boolean.sun_LOCKNAME_TEMPLATENUM', 'on'))) and (strptime(states('sensor.date'), '%Y-%m-%d').strftime('%A') == 'Sunday') and ((states.input_datetime.sun_start_date_LOCKNAME_TEMPLATENUM.state  == states.input_datetime.sun_end_date_LOCKNAME_TEMPLATENUM.state) or ((states('sensor.time') >= states('input_datetime.sun_start_date_LOCKNAME_TEMPLATENUM')[0:5]) and (states('sensor.time') <= states('input_datetime.sun_end_date_LOCKNAME_TEMPLATENUM')[0:5]))) }}"

    mon_LOCKNAME_TEMPLATENUM:
      entity_id:
        - sensor.time
        - input_datetime.mon_start_date_LOCKNAME_TEMPLATENUM
        - input_datetime.mon_end_date_LOCKNAME_TEMPLATENUM
      value_template: "{{ ((is_state('input_boolean.mon_LOCKNAME_TEMPLATENUM', 'on'))) and (strptime(states('sensor.date'), '%Y-%m-%d').strftime('%A') == 'Monday') and ((states.input_datetime.mon_start_date_LOCKNAME_TEMPLATENUM.state  == states.input_datetime.mon_end_date_LOCKNAME_TEMPLATENUM.state) or ((states('sensor.time') >= states('input_datetime.mon_start_date_LOCKNAME_TEMPLATENUM')[0:5]) and (states('sensor.time') <= states('input_datetime.mon_end_date_LOCKNAME_TEMPLATENUM')[0:5]))) }}"

    tue_LOCKNAME_TEMPLATENUM:
      entity_id:
        - sensor.time
        - input_datetime.tue_start_date_LOCKNAME_TEMPLATENUM
        - input_datetime.tue_end_date_LOCKNAME_TEMPLATENUM
      value_template: "{{ ((is_state('input_boolean.tue_LOCKNAME_TEMPLATENUM', 'on'))) and (strptime(states('sensor.date'), '%Y-%m-%d').strftime('%A') == 'Tuesday') and ((states.input_datetime.tue_start_date_LOCKNAME_TEMPLATENUM.state  == states.input_datetime.tue_end_date_LOCKNAME_TEMPLATENUM.state) or ((states('sensor.time') >= states('input_datetime.tue_start_date_LOCKNAME_TEMPLATENUM')[0:5]) and (states('sensor.time') <= states('input_datetime.tue_end_date_LOCKNAME_TEMPLATENUM')[0:5]))) }}"

    wed_LOCKNAME_TEMPLATENUM:
      entity_id:
        - sensor.time
        - input_datetime.wed_start_date_LOCKNAME_TEMPLATENUM
        - input_datetime.wed_end_date_LOCKNAME_TEMPLATENUM
      value_template: "{{ ((is_state('input_boolean.wed_LOCKNAME_TEMPLATENUM', 'on'))) and (strptime(states('sensor.date'), '%Y-%m-%d').strftime('%A') == 'Wednesday') and ((states.input_datetime.wed_start_date_LOCKNAME_TEMPLATENUM.state  == states.input_datetime.wed_end_date_LOCKNAME_TEMPLATENUM.state) or ((states('sensor.time') >= states('input_datetime.wed_start_date_LOCKNAME_TEMPLATENUM')[0:5]) and (states('sensor.time') <= states('input_datetime.wed_end_date_LOCKNAME_TEMPLATENUM')[0:5]))) }}"

    thu_LOCKNAME_TEMPLATENUM:
      entity_id:
        - sensor.time
        - input_datetime.thu_start_date_LOCKNAME_TEMPLATENUM
        - input_datetime.thu_end_date_LOCKNAME_TEMPLATENUM
      value_template: "{{ ((is_state('input_boolean.thu_LOCKNAME_TEMPLATENUM', 'on'))) and (strptime(states('sensor.date'), '%Y-%m-%d').strftime('%A') == 'Thursday') and ((states.input_datetime.thu_start_date_LOCKNAME_TEMPLATENUM.state  == states.input_datetime.thu_end_date_LOCKNAME_TEMPLATENUM.state) or ((states('sensor.time') >= states('input_datetime.thu_start_date_LOCKNAME_TEMPLATENUM')[0:5]) and (states('sensor.time') <= states('input_datetime.thu_end_date_LOCKNAME_TEMPLATENUM')[0:5]))) }}"

    fri_LOCKNAME_TEMPLATENUM:
      entity_id:
        - sensor.time
        - input_datetime.fri_start_date_LOCKNAME_TEMPLATENUM
        - input_datetime.fri_end_date_LOCKNAME_TEMPLATENUM
      value_template: "{{ ((is_state('input_boolean.fri_LOCKNAME_TEMPLATENUM', 'on'))) and (strptime(states('sensor.date'), '%Y-%m-%d').strftime('%A') == 'Friday') and ((states.input_datetime.fri_start_date_LOCKNAME_TEMPLATENUM.state  == states.input_datetime.fri_end_date_LOCKNAME_TEMPLATENUM.state) or ((states('sensor.time') >= states('input_datetime.fri_start_date_LOCKNAME_TEMPLATENUM')[0:5]) and (states('sensor.time') <= states('input_datetime.fri_end_date_LOCKNAME_TEMPLATENUM')[0:5]))) }}"

    sat_LOCKNAME_TEMPLATENUM:
      entity_id:
        - sensor.time
        - input_datetime.sat_start_date_LOCKNAME_TEMPLATENUM
        - input_datetime.sat_end_date_LOCKNAME_TEMPLATENUM
      value_template: "{{ ((is_state('input_boolean.sat_LOCKNAME_TEMPLATENUM', 'on'))) and (strptime(states('sensor.date'), '%Y-%m-%d').strftime('%A') == 'Saturday') and ((states.input_datetime.sat_start_date_LOCKNAME_TEMPLATENUM.state  == states.input_datetime.sat_end_date_LOCKNAME_TEMPLATENUM.state) or ((states('sensor.time') >= states('input_datetime.sat_start_date_LOCKNAME_TEMPLATENUM')[0:5]) and (states('sensor.time') <= states('input_datetime.sat_end_date_LOCKNAME_TEMPLATENUM')[0:5]))) }}"


    smtwtfs_LOCKNAME_TEMPLATENUM:
      friendly_name: "Status"
      value_template: >-
         {{
            is_state('binary_sensor.sun_LOCKNAME_TEMPLATENUM', 'on')  or  
            is_state('binary_sensor.mon_LOCKNAME_TEMPLATENUM', 'on')  or  
            is_state('binary_sensor.tue_LOCKNAME_TEMPLATENUM', 'on')  or  
            is_state('binary_sensor.wed_LOCKNAME_TEMPLATENUM', 'on')  or  
            is_state('binary_sensor.thu_LOCKNAME_TEMPLATENUM', 'on')  or  
            is_state('binary_sensor.fri_LOCKNAME_TEMPLATENUM', 'on')  or  
            is_state('binary_sensor.sat_LOCKNAME_TEMPLATENUM', 'on')   
         }}

    
    access_count_LOCKNAME_TEMPLATENUM:
      friendly_name: "Access Count"
      value_template: >-
         {{
            (is_state('input_boolean.accesslimit_LOCKNAME_TEMPLATENUM', 'off'))  or  
            (states.input_number.accesscount_LOCKNAME_TEMPLATENUM.state | int > 0)
         }}


    active_LOCKNAME_TEMPLATENUM:
      friendly_name: "Status"
      value_template: >-
         {{
            is_state('binary_sensor.enabled_LOCKNAME_TEMPLATENUM', 'on')  and  
            is_state('binary_sensor.access_count_LOCKNAME_TEMPLATENUM', 'on')  and  
            is_state('binary_sensor.daterange_LOCKNAME_TEMPLATENUM', 'on') and
            is_state('binary_sensor.smtwtfs_LOCKNAME_TEMPLATENUM', 'on')  
         }}
      device_class: connectivity


###################  sensor:  ####################