I cannot figure out how to fix this error on startup.
Could not render template Front Door Report, the state is unknown.
front_door_report:
friendly_name: 'Front Door Report'
value_template: >
{% set number = states('sensor.lock_front_door_deadbolt_alarm_level') %}
{% set alarm_type_value = states('sensor.lock_front_door_deadbolt_alarm_type') %}
{% set entity_id = 'input_text.door_keypad_' + number + '_name' %}
{% set user = 'Master' if number == '0' else states(entity_id) %}
{% set alarm_type_value = '24' if (as_timestamp(now())-as_timestamp(states.lock.lock_front_door_lock.last_changed)) < 15 and (as_timestamp(now())-as_timestamp(states.sensor.lock_front_door_deadbolt_alarm_type.last_changed)) > 15 and (states.lock.lock_front_door_lock.state) == 'locked' else alarm_type_value %}
{% set alarm_type_value = '25' if (as_timestamp(now())-as_timestamp(states.lock.lock_front_door_lock.last_changed)) < 15 and (as_timestamp(now())-as_timestamp(states.sensor.lock_front_door_deadbolt_alarm_type.last_changed)) > 15 and (states.lock.lock_front_door_lock.state) == 'unlocked' else alarm_type_value %}
{% set alarm_type_general_actions = {
'0':'No Status Reported',
'9':'Lock Jammed',
'17':'Keypad Lock Jammed',
'21':'Manual Lock',
'22':'Manual Unlock',
'23':'HA Lock Jammed',
'24':'HA Lock',
'25':'HA Unlock',
'26':'Auto Lock Jammed',
'27':'Auto Lock',
'32':'All Codes Deleted',
'161':'Bad Code Entered',
'167':'Battery Low',
'168':'Battery Critical',
'169':'Battery Too Low To Operate Lock' } %}
{% set alarm_type_lock_actions = {
'18':'Keypad Lock',
'19':'Keypad Unlock',
'162':'Lock Code Attempt Outside of Schedule' } %}
{% set alarm_type_code_actions = {
'33':'Code Deleted',
'112':'Code Changed',
'113':'Duplicate Code' } %}
{% if alarm_type_value in alarm_type_code_actions %}
{{ alarm_type_code_actions[alarm_type_value] }} (Code {{ number}})
{% elif alarm_type_value in alarm_type_lock_actions and number == '0' %}
{{ alarm_type_lock_actions[alarm_type_value] }} with Schlage Button
{% elif alarm_type_value in alarm_type_lock_actions %}
{{ alarm_type_lock_actions[alarm_type_value] }} with Code {{ number }} ({{ user }})
{% elif alarm_type_value in alarm_type_general_actions %}
{{ alarm_type_general_actions[alarm_type_value] }}
{% else %}
Unknown Alarm Type Value {{ states('sensor.lock_front_door_deadbolt_alarm_type') }}
{% endif %}
I believe the error is in here
{% set alarm_type_value = '24' if (as_timestamp(now())-as_timestamp(states.lock.lock_front_door_lock.last_changed)) < 15 and (as_timestamp(now())-as_timestamp(states.sensor.lock_front_door_deadbolt_alarm_type.last_changed)) > 15 and (states.lock.lock_front_door_lock.state) == 'locked' else alarm_type_value %}
{% set alarm_type_value = '25' if (as_timestamp(now())-as_timestamp(states.lock.lock_front_door_lock.last_changed)) < 15 and (as_timestamp(now())-as_timestamp(states.sensor.lock_front_door_deadbolt_alarm_type.last_changed)) > 15 and (states.lock.lock_front_door_lock.state) == 'unlocked' else alarm_type_value %}
but when I’ve tried to change to states(’… I’ve gotten different errors. Thoughts?
Actually I tried a couple things, had no success got sidetracked and never fixed it.
I know it’s generally an “easy” fix but just have not put the time into it since it’s just on startup.
cool thanks. It’s because HA recently restarted and when it restarts the lock state gets erased so HA is looking for a value that doesn’t exist. Is that correct?
While I have you… I saw in your code that you were able to update openzwave on 9/4/18 which fixed the clear_usercode functionality. I’m on version 1.4.3254 and still having trouble with clear_usercode no working (even by calling the service directly in HA). Did you update to 1.5 or to the current version on GitHub?
Yes I believe that is the cause of the error on start up.
For open zwave I created my own fork a few months back and added an updates file for the clear user codes. This was before HA added their own fork. So I have not upgraded the past few versions.
do you remember if you were using 1.4xx when you had clear_usercode working? Trying to figure out if it’s zwave that is my problem or something else.
trying to figure out where I would find that file & how to incorporate it. I was expecting to see config_path: defined in your configuration.yaml file referencing the new openzwave stuff. What am I missing? Am I supposed to be looking for a file in the OpenZwave fork?
This is more of a rant and less a request for you to hold my hand and figure this out for me. Thank you again for all of that awesome lock functionality code.
No problem. I’m on mobile right now but this should get you started.
Basically the need to create your own fork was something that people with a specific garage door opener had to do for quite a while. In 82.x HA created their own fork to add the files needed for the garage but are not quite on board with the user code.cpp yet so it’s not included. Read through the post there are instructions on how to fork the HA branch to add the user code. I just have not made the time to do it yet.
@ptdalen can I take a look at your zwcfg_xxx.xml and compare your entry for your Schlage BE469 to mine? If it’s on your GitHub I didn’t see it but maybe I was looking in the wrong place.
I’ll try to get it added in the next day or so. I will say that I’m still running 81.6. The version before HA added their own zwave fork. I just have not had the time to update.
Had some time to go through this but I still don’t understand what I need to do.
I looked for differences between the xml for your lock and my lock (contained in my zwcfg_xxxxxxxxxx.xml file) and it doesn’t seem to be anything related to user code.
Your lines 38-41 are slightly different but I’m assuming that has to do with individual user codes set or not set in those slots (4, 5, 6, and 7).
Your line 143 is different, assuming because we have different values for Alarm Type
Your line 146 and 147 are different, I’m assuming it’s the same reason but for the Access Control and Burglar settings
Your line 159 has a different value for Battery Level.
All of these differences don’t seem to be connected to the user code and my inability to delete user codes through HA. I think there’s a broader problem or something I’m missing due to the fact that I don’t fully understand the way the open-wave code/libraries are stored for my HassIO install and how I would go about updating them. The only other z-wave related files I think I have to look at are pyozw.sqlite, OZW_Log.txt, and zwscene.xml
I understand that to fork your open-wave directory means to copy it for my own use but after that I have no idea what to do. I tried downloading that entire directory and moving the contents onto my RasberryPi with samba and then pointing my zwave component to it by defining config_path but that didn’t work. Should I see a similar directory somewhere on my RasberryPi?
Sorry for all the noob questions and thanks for your patience.
This pulls down my branch with the garage cover files I needed and the updated usercode.cpp
Then I stopped HA and ran the script below.
Couple of things. I’m running Ubuntu
this line
export LOCAL_OPENZWAVE=/home/homeassistant/open-zwave/
is not 100% the same on some flavors of unix.
What the script does is removes the default version of owz, and then uses your local files.
Issues are, that every time OWZ updates, you’ll have to repeat this process. You can fork your own branch from mine (I recommend that), so you can keep as up to date as you need.
if [ "$(id -u)" != "0" ]; then
echo "This script must be run with sudo. Use \"sudo ${0} ${*}\"" 1>&2
exit 1
fi
echo "Changing to user homeassistant"
sudo -H -u homeassistant /bin/bash <<EOF
echo "Activating virtual environment"
source /srv/homeassistant/bin/activate
# install cython if not already installed
# pip3 install --upgrade cython==0.24.1
# remove previously install python_openzwave
pip3 uninstall -y homeassistant-pyozw==0.1.1
# install ozwdev flavor of python_openzwave
export LOCAL_OPENZWAVE=/home/homeassistant/open-zwave/
pip install homeassistant-pyozw==0.1.1 --no-cache-dir --no-deps --install-option="--flavor=dev"
echo "Deactivating virtual environment"
deactivate
EOF
exit 0
If you are running a different version you steps might be a bit different. Even though this thread is for a garage door opener issue
I really recommend reading through this if you’re stuck. Although the forks will be different the process and concepts are the same.
Sounds like I need SSH access to my RasberryPi? HomeAssistant install? What’s the difference?
I don’t have the SSH add-on installed as listed here: addons/ssh/README.md at master · home-assistant/addons · GitHub but even if I did “This add-on will not enable you to install packages or do anything as root. This is not allowed with Hass.io.” So am I barking up the wrong tree?
I can get to what I think is my /homeassistant folder which contains the folders (addons, backup, config, share, ssl) but I do that with Samba because I’m extremely in-experienced with command line stuff and I’m not sure how I would go about running
inside of that folder. My limited knowledge tells me that this is a way of adding the folders contained in your GitHub fork to my home assistant folder via command line instead of downloading them and then a good ol’ fashion “drag-n-drop” or am I way off track?