Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update homeassistant.ts to fix template warnings #9077

Closed
wants to merge 3 commits into from

Conversation

OzGav
Copy link
Contributor

@OzGav OzGav commented Oct 8, 2021

Based on the issue here #8769 and the suggestion here #8617 I have added a default against all of the value and state templates.

Based on the issue here #8769 and the suggestion here #8617 I have added a default against all of the value and state templates.
@OzGav
Copy link
Contributor Author

OzGav commented Oct 8, 2021

Not sure about these errors as they aren't appearing against all of my changes? Will wait for some guidance.

@Koenkk
Copy link
Owner

Koenkk commented Oct 8, 2021

We decided to not use | default(''), see #6988 (review) for the rationale. Instead missing values should be set to null here: #6988 (review)

@OzGav
Copy link
Contributor Author

OzGav commented Oct 8, 2021

Ok but after reading all of that it seems things should have been fixed? Yet there are still people with problems. Here is mine:

Logger: homeassistant.helpers.template
Source: helpers/template.py:1612 
First occurred: 12:13:39 AM (45 occurrences) 
Last logged: 12:44:36 AM

Template variable warning: 'dict object' has no attribute 'state_button_light' when rendering '{{ value_json.state_button_light }}'
Template variable warning: 'dict object' has no attribute 'state_button_fan_high' when rendering '{{ value_json.state_button_fan_high }}'
Template variable warning: 'dict object' has no attribute 'state_button_fan_med' when rendering '{{ value_json.state_button_fan_med }}'
Template variable warning: 'dict object' has no attribute 'state_button_fan_low' when rendering '{{ value_json.state_button_fan_low }}'
Template variable warning: 'dict object' has no attribute 'action' when rendering '{{ value_json.action }}'

So is this a problem created when we did the initial setup for these switches or something else? Can it be fixed without me cobbling together templates at my end?

@Koenkk
Copy link
Owner

Koenkk commented Oct 9, 2021

Can you check the changes from https://github.com/Koenkk/zigbee2mqtt/pull/9088/files ?

UPDATE: nevermind, I need to do some more work here, will ping you when I'm ready

@Koenkk Koenkk closed this Oct 9, 2021
@3PrintD-Solution
Copy link

3PrintD-Solution commented Oct 14, 2021

here the same problem

Logger: homeassistant.helpers.template
Source: helpers/template.py:1612
First occurred: 16:11:33 (17 occurrences)
Last logged: 16:25:33

Template variable warning: 'dict object' has no attribute 'linkquality' when rendering '{{ value_json.linkquality }}'
Template variable warning: 'dict object' has no attribute 'energy' when rendering '{{ value_json.energy }}'
Template variable warning: 'dict object' has no attribute 'temperature' when rendering '{{ value_json.temperature }}'
Template variable warning: 'dict object' has no attribute 'voltage' when rendering '{{ value_json.voltage }}'
Template variable warning: 'dict object' has no attribute 'current' when rendering '{{ value_json.current }}'
Zigbee2MQTT version
1.18.1 commit: 1.18.1
Coordinator type
zStack3x0
Coordinator revision
20210708
Frontend version
0.3.76

@Koenkk
Copy link
Owner

Koenkk commented Oct 14, 2021

Zigbee2MQTT version
1.18.1 commit: 1.18.1

Old version,
If you are still on 1.18.1 check first point of https://github.com/Koenkk/zigbee2mqtt/releases/tag/1.19.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants