Schlage lock Error rendering template

lock_batteries:
  value_template: "{{ states.lock.__locked_13_0.attributes.battery_level|default(-1)|int if states.lock.__locked_13_0 is not none }}"
  unit_of_measurement: '%'
  entity_id: lock.__locked_13_0

this template was working before , but now its giving me this error

Error rendering template: SecurityError: access to attribute ‘__locked_13_0’ of ‘DomainStates’ object is unsafe, any ideas … ?

Also a bunch of sensor dissapear from my Schlage lock after the 0.37.0 udpate

  • sensor.schlage_be469nxcen_touchscreen_deadbolt_access_control_3_9
  • sensor.schlage_be469nxcen_touchscreen_deadbolt_burglar_3_10
  • sensor.schlage_be469nxcen_touchscreen_deadbolt_power_management_3_11
  • sensor.schlage_be469nxcen_touchscreen_deadbolt_sourcenodeid_3_2
  • sensor.schlage_be469nxcen_touchscreen_deadbolt_system_3_12

Just FYI , for some reason after the update the lock lost its setup had to rejoin the network and everything started to working properly.