According to your reply via Private Message, the addition of to_json
fixed the issue and it now works correctly.
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic is resolved. This helps other users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.
You had also asked if there is a way for the Direction sensor to report descriptively as opposed to numerically. Here’s what I suggest:
- name: 'Direction'
unique_id: 'Direction'
state_topic: 'oregon/wind/Direction'
value_template: >
{% set directions =
{ 12: 'North',
35: 'North North East',
57: 'North East',
80: 'East North East',
102: 'East',
125: 'East South East',
147: 'South East',
170: 'South South East',
192: 'South',
215: 'South South West',
237: 'South West',
260: 'West South West',
282: 'West',
305: 'West North West',
327: 'North West',
349: 'North North West',
360: 'North' } %}
{{ directions.get(directions.keys() | select('>', value_json.Direction | int(0)) | first, 'Unknown') }}