AWTRIX Light - Mega Weather + Sunrise + Moonrise

i don t get it runing.

i have this error all the time:

2023-11-29 05:36:55.402 ERROR (MainThread) [homeassistant.components.automation.awtrix_weather_forecast] Error rendering variables: UndefinedError: homeassistant.helpers.template.Wrapper object has no element 8

my config is this:

alias: AWTRIX Weather ⛈️ + Forecast + 🌕️
description: neuer versuch
use_blueprint:
  path: jeeftor/awtrix_weatherflow.yaml
  input:
    awtrix:
      - c1bc8b9997fe44faa85bb5b4dbeb28ca
    forecast_var: weather.openweathermap
    temp_suffix: °C
    current_temp_var: sensor.openweathermap_feels_like_temperature
    moon: sensor.moon
    moon_rise_set: sensor.ip_geo_location
    when_show_moon: never

how did you fix this problem?

i don t know why but no it is running. i played around with the values and now the automation is running.
i think some value was not really set but all fields were filled with text

Hey guys … unfortunately this one is a little lower on my priority list at the moment - Im currently working on a refactor of the IntelliFire integration but … The best advice I have is to look at the logs. One issue could be your weather provider. What are you guys using?

Hello, I have some basic questions on how to get this setup and working. Is the Discord still up and running? I tried joining and it said there are no chats available to me.

I’m a blueprint newbie. I set up all of the pre-requisites and see all of that as options to select in the blueprint. My question is, how to do ‘fire off’ this blueprint as an automation? I imported blueprint, created automation from it and entered in all of my information, but I never see it fire off.

MQTT is set up on my Awtrix flashed Ulanzi and I can test MQTT works by sending a test message from Home Assistant to the clock.

I can’t find a single Youtube video running thru setup and creation of this. I also uploaded the ‘Assets’ to the icons folder of my Ulanzi clock. I did enter in the moon stuff into my configuration.yaml file. After reboot, I’m able to select it within the blueprint. All seems well, just can’t understand why it doesn’t fire off…

Are there some helpers I need to create to get this to work?
I wonder if there is additional step I needed to take, what is this flow thing?

I had that red outline as well.

I restarted my Awtrix device and now the weather blueprint isn’t working at all.

The error I get is:

Logger: homeassistant.components.automation.awtrix_weather
Source: components/automation/__init__.py:604
Integration: Automation (documentation, issues)
First occurred: December 6, 2023 at 12:57:07 PM (12074 occurrences)
Last logged: 5:36:45 AM

Error rendering variables: JSONDecodeError: Input must be bytes, bytearray, memoryview, or str: line 1 column 1 (char 0)

Any thoughts?

I’m having the same issue. Looks like it broke with the latest home assistant upgrade to 2023.12.0
Not sure if others have seen the same thing.

(Mine has been working awesome for many months up until I upgraded to version 12)

Same here - the automation is broken after the upgrade to 2023.12. While I tried to debug the error I noticed that besides the error message (the same one @johnsturgeon is seeing) it appears that the REST sensor for moon rise/set is no longer updating, but I can’t say if that is related or not…

  1. remove line
  color_matrix_json: >-
    {"-12": "#D977DF","-6": "#9545BC","-1": "#4B379C","0": "#FEC4FF","4":
    "#31B8DB","10": "#31DB8B","15": "#6ED228","21": "#FFFF28","27":
    "#F87E27","32": "#CF3927","38": "#A12527"}
  1. change the next line like:
  color_dict: >-
    {% 
    set color_matrix_json = {
        "-12": "#D977DF", 
        "-6": "#9545BC",
        "-1": "#4B379C",
        "0": "#FEC4FF",
        "4": "#31B8DB",
        "10": "#31DB8B",
        "15": "#6ED228", 
        "21": "#FFFF28", 
        "27": "#F87E27", 
        "32": "#CF3927", 
        "38": "#A12527"
    }
    %}
    {%
    set b = color_matrix_json %}     {%- set ns =
    namespace(tuples=[]) %} {%- for k,v in b | items -%}
      {%- set key = k|float -%}
      {%- set ns.tuples = ns.tuples + [(key,v)] %}      
    {% endfor %} {{ dict.from_keys(ns.tuples) }}

for devs:

{%
   set color_matrix_json = {"foo": "bar"}
%}

{%
   set x = color_matrix_json | from_json
%}

{{x}}

JSONDecodeError: Input must be bytes, bytearray, memoryview, or str: line 1 column 1 (char 0)

but

{%
   set color_matrix_json = '{"foo":"bar"}'
%}

{%
   set x = color_matrix_json | from_json
%}

{{x}}

2 Likes

Hi @10der. Saw your post and deleted the line bellow from my automation (section Color Matrix)

color_matrix_json: >-
    {"-12": "#D977DF","-6": "#9545BC","-1": "#4B379C","0": "#FEC4FF","4":
    "#31B8DB","10": "#31DB8B","15": "#6ED228","21": "#FFFF28","27":
    "#F87E27","32": "#CF3927","38": "#A12527"}

However, it is not clear where should I change the line you mention on point number 2. Is it on the blueprint?

Thanks

sorry. I used the own version. let me check the actual script version.
5 min!

lets play

Works now with your changed bluprint. Thank you very much from the fast help!!

1 Like

I still think something fundamental is wrong. I did some debugging this morning and the main issue is that for some reason Home Assistant thinks that the text is not a string and so it can’t turn it into json. Even though it is a string because if you asked the template agent to report what it is, it says it’s a string…

I think I found the bug:

Use the hacks for now … or … wait for the next update :slight_smile:

1 Like

I just downgraded to 2023.11 because the upgrade also broke entity_controller

HA 2023.12.1 is now out and it seems the issue is fixed.

Thanks for bugging me here as i was able to identify the bug and they got a quick fix out :slight_smile:

Hi,

the automation never gets executed. I use Homeassistant 2023.12.1 on HA green. Error log shows:

Logger: homeassistant.components.automation.awtrix_weather_forecast
Source: components/automation/init.py:604

Error rendering variables: ValueError: Template error: float got invalid input 'unknown' when rendering template '{%- macro interpolate(dictionary, x) -%} {%- set sorted_keys = dictionary|dictsort -%} {%- set above = sorted_keys|selectattr('0', 'gt', x)|map(attribute='0')|list|first -%} {%- set below = sorted_keys|selectattr('0', 'lt', x)|map(attribute='0')|list|last -%} {#- Key matches x exactly -#} {%- if above is defined and dictionary[above] == x -%} {%- set value = dictionary[above] -%} {{ value }} {%- elif below is defined and dictionary[below] == x -%} {%- set value = dictionary[below] -%} {{ value }} {#- Interpolation between two values -#} {%- elif below is defined and above is defined -%} {%- set lower_value = dictionary[below] -%} {%- set upper_value = dictionary[above] -%} {%- set lower_rgb = lower_value[1:] -%} {%- set upper_rgb = upper_value[1:] -%} {%- set lower_r = lower_rgb[0:2]|int(base=16) -%} {%- set lower_g = lower_rgb[2:4]|int(base=16) -%} {%- set lower_b = lower_rgb[4:6]|int(base=16) -%} {%- set upper_r = upper_rgb[0:2]|int(base=16) -%} {%- set upper_g = upper_rgb[2:4]|int(base=16) -%} {%- set upper_b = upper_rgb[4:6]|int(base=16) -%} {%- set interpolation_factor = (x - below) / (above - below) -%} {%- set interpolated_r = ((1 - interpolation_factor) * lower_r + interpolation_factor * upper_r)|int -%} {%- set interpolated_g = ((1 - interpolation_factor) * lower_g + interpolation_factor * upper_g)|int -%} {%- set interpolated_b = ((1 - interpolation_factor) * lower_b + interpolation_factor * upper_b)|int -%} {%- set interpolated_hex = '#' ~ '%02X' % interpolated_r ~ '%02X' % interpolated_g ~ '%02X' % interpolated_b -%} {{ interpolated_hex }} {#- Only below key available -#} {%- elif below is defined -%} {%- set value = dictionary[below] -%} {{ value }} {#- Only above key available -#} {%- elif above is defined -%} {%- set value = dictionary[above] -%} {{ value }} {#- No matching keys available -#} {%- else -%} No matching key found. {%- endif -%} {%- endmacro -%} {#- Define macro to get length of the forecast} {%- macro str_len(str) %} {%- if '.' in str %} {%- set char_count = (str | length) -1 %}{{char_count * 3 + 1 + char_count}} {%- else %} {%- set char_count = (str | length) %}{{char_count * 3 + (char_count - 1)}} {%- endif %} {%- endmacro %} {#- Define a macro to draw out the forecast lines#} {%- macro draw_forecast_lines(x,hours,height) %} {%- for hour in range(hours) %} {%- if height == 0 %} {"dp": [{{x+hour}},7,"{{interpolate(color_dict, forecast[hour][forecast_temp_field]) }}"]} {%- else %} {"dl": [{{x+hour}},7,{{x+hour}},{{7 - height}},"{{interpolate(color_dict, forecast[hour][forecast_temp_field]) }}"]} {%- endif %} {%- if hour+1 != hours %},{%endif%} {%- endfor %} {%- endmacro %} {# Define the color mapping dictionary #} { "draw": [ {%- if hours_to_show > 0 %} {{draw_forecast_lines(8,hours_to_show,0)}} {%- endif %} {%- if current_temp != 'unavailable' -%} ,{"dt":[{{text_x}},1,"{{temp_text}}","{{interpolate(color_dict, current_temp | float)}}"]} {%- else -%} {"dt":"err"} {%- endif -%} {% if show_moon %} ,{{moon_data}} {% endif %} ], "icon": "{{icon}}", "duration": {{message_duration}}, "pushIcon": 2, "lifetime": 120, "lifetimeMode":1, "weather": "{{weather}}" }' but no default was specified

Perhaps it is possible to issue a simple version w/o moon nor sun, only for weather.

Thanks for your effort and dedication to this project,

-sam

1 Like

I need to write a debug guide for this stuff :slight_smile:

1 Like