Closed Jasper-itsme closed 1 year ago
hi i tried using your code, I keep getting an error in the logs can you help? thanks
Logger: homeassistant.helpers.event Source: helpers/template.py:425 First occurred: 14:01:59 (1 occurrences) Last logged: 14:01:59
Error while processing template: Template("{% if states('sensor.fingerprint_id') | int >= 1 %} {%- set printid = states('sensor.fingerprint_id') | int -%} {%- set prints = states("input_text.fingerprint_data") | from_json if states("input_text.fingerprint_data") else [] -%} {%- set fingerprint = prints|selectattr('id', 'eq', states('sensor.fingerprint_id') | int) | first -%} {{fingerprint["name"]}} {% elif is_state('sensor.fingerprint', 'Waiting') %} Waiting {% elif is_state('sensor.fingerprint', 'Not matched') %} Not matched {% endif %}") Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 423, in async_render render_result = _render_with_context(self.template, compiled, kwargs) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1942, in _render_with_context return template.render(kwargs) File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "", line 1, in top-level template code File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1729, in forgiving_int_filter raise_no_default("int", value) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1411, in raise_no_default raise ValueError( ValueError: Template error: int got invalid input 'unknown' when rendering template '{% if states('sensor.fingerprint_id') | int >= 1 %} {%- set printid = states('sensor.fingerprint_id') | int -%} {%- set prints = states("input_text.fingerprint_data") | from_json if states("input_text.fingerprint_data") else [] -%} {%- set fingerprint = prints|selectattr('id', 'eq', states('sensor.fingerprint_id') | int) | first -%} {{fingerprint["name"]}} {% elif is_state('sensor.fingerprint', 'Waiting') %} Waiting {% elif is_state('sensor.fingerprint', 'Not matched') %} Not matched {% endif %}' but no default was specified
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 540, in async_render_to_info render_info._result = self.async_render(variables, strict=strict, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 425, in async_render raise TemplateError(err) from err homeassistant.exceptions.TemplateError: ValueError: Template error: int got invalid input 'unknown' when rendering template '{% if states('sensor.fingerprint_id') | int >= 1 %} {%- set printid = states('sensor.fingerprint_id') | int -%} {%- set prints = states("input_text.fingerprint_data") | from_json if states("input_text.fingerprint_data") else [] -%} {%- set fingerprint = prints|selectattr('id', 'eq', states('sensor.fingerprint_id') | int) | first -%} {{fingerprint["name"]}} {% elif is_state('sensor.fingerprint', 'Waiting') %} Waiting {% elif is_state('sensor.fingerprint', 'Not matched') %} Not matched {% endif %}' but no default was specified
Hi, can you share me your configuration.yaml content?
Op vr 9 dec. 2022 om 14:01 schreef Itayabram @.***>:
hi i tried using your code, I keep getting an error in the logs can you help? thanks
Logger: homeassistant.helpers.event Source: helpers/template.py:425 First occurred: 14:01:59 (1 occurrences) Last logged: 14:01:59
Error while processing template: Template("{% if states('sensor.fingerprint_id') | int >= 1 %} {%- set printid = states('sensor.fingerprint_id') | int -%} {%- set prints = states("input_text.fingerprint_data") | from_json if states("input_text.fingerprint_data") else [] -%} {%- set fingerprint = prints|selectattr('id', 'eq', states('sensor.fingerprint_id') | int) | first -%} {{fingerprint["name"]}} {% elif is_state('sensor.fingerprint', 'Waiting') %} Waiting {% elif is_state('sensor.fingerprint', 'Not matched') %} Not matched {% endif %}") Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 423, in async_render render_result = _render_with_context(self.template, compiled, kwargs) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1942, in _render_with_context return template.render(kwargs) File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "", line 1, in top-level template code File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1729, in forgiving_int_filter raise_no_default("int", value) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1411, in raise_no_default raise ValueError( ValueError: Template error: int got invalid input 'unknown' when rendering template '{% if states('sensor.fingerprint_id') | int >= 1 %} {%- set printid = states('sensor.fingerprint_id') | int -%} {%- set prints = states("input_text.fingerprint_data") | from_json if states("input_text.fingerprint_data") else [] -%} {%- set fingerprint = prints|selectattr('id', 'eq', states('sensor.fingerprint_id') | int) | first -%} {{fingerprint["name"]}} {% elif is_state('sensor.fingerprint', 'Waiting') %} Waiting {% elif is_state('sensor.fingerprint', 'Not matched') %} Not matched {% endif %}' but no default was specified
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 540, in async_render_to_info render_info._result = self.async_render(variables, strict=strict, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 425, in async_render raise TemplateError(err) from err homeassistant.exceptions.TemplateError: ValueError: Template error: int got invalid input 'unknown' when rendering template '{% if states('sensor.fingerprint_id') | int >= 1 %} {%- set printid = states('sensor.fingerprint_id') | int -%} {%- set prints = states("input_text.fingerprint_data") | from_json if states("input_text.fingerprint_data") else [] -%} {%- set fingerprint = prints|selectattr('id', 'eq', states('sensor.fingerprint_id') | int) | first -%} {{fingerprint["name"]}} {% elif is_state('sensor.fingerprint', 'Waiting') %} Waiting {% elif is_state('sensor.fingerprint', 'Not matched') %} Not matched {% endif %}' but no default was specified
— Reply to this email directly, view it on GitHub https://github.com/EverythingSmartHome/fingerprint-mqtt/issues/21#issuecomment-1344282042, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM6734HEJAWN73T5OZD3XETWMMUSJANCNFSM6AAAAAASWSAA7I . You are receiving this because you authored the thread.Message ID: @.***>
yes thank you, I just deleted tokens and passwords. uploaded it as txt file configuration.txt
Had a look but did not find anything odd in regards to the configuration code. Besides that, the error is stating that the sensor template received an incorrect input, ' unknown' . This seems to say that your sensor or input value generated by the code on your ESP is providing a bad value. Perhaps you can trace back the steps you did there?
Additionally: which ESP and sensor are you using? I`m using the R503 sensor together with a Wemos d1 mini. Ended up with using a script from another author based on the EverythingSmartHome source code.
I will try to trace back as you said. I'm using wemos d1 mini + R503, exactly the same as you. Which script did you use? Thanks again
This is what I have implemented and is working with the mentioned hardware: Fingerprints-reader-R503---R502-esp8266-mqtt-Home-Assistant I used the lovelace_standard view. Also please note that you also have to replace the mqtt part in configuration.yaml. Remove:
- platform: mqtt
name: "Fingerprint"
state_topic: "/fingerprint/mode/status"
value_template: "{{value_json.state}}"
json_attributes_topic: "/fingerprint/mode/status"
json_attributes_template: "{{value_json | tojson}}"
Add:
#Fingerprint mqtt topic
mqtt:
sensor:
- name: "Fingerprint"
state_topic: "/fingerprint/mode/status"
value_template: "{{value_json.state}}"
json_attributes_topic: "/fingerprint/mode/status"
json_attributes_template: "{{value_json | tojson}}"
As said, the code is based on the EverythingSmartHome source code.
ok im starting to make a progress here. now when i go to the arduino ide and try to verify the file i get this error:
exit status 1
Compilation error: 'class Adafruit_Fingerprint' has no member named 'led_control'
at the original sketch i didn't get any errors. can i just use the original sketch?
oh just figured it out, the ide automatically updated the adafruit library. disabled it and now it's ok! thank a lot my friend
You`re welcome. In case you are still wondering: the "lovelace_standard" code can be pasted in the yaml editor of the dashboard.
Hey, do take a look at PR #20 on this repo if you're looking for a sketch with finger.LEDcontrol() for R503+ESP32. I've added a set number of colored led blinks for different error messages and successful scans.
It's a strong community, thank you all! Edit: Typo
Opened PR #22 for consideration.
Fix has been merged; can we move to close issue?
Issue When copy pasting your configuration.yaml code into HomeAssistant, the editor shows that your mqtt topic code is depricated. Also after restarting HomeAssistant the logs show a warning regarding the same and is referring to: https://www.home-assistant.io/integrations/sensor.mqtt/#new_format
Suggestion
(love your work and tutorials, thanks!)