Awtrix Solar Monitor zeigt keine negativen Werte an

Hallo,

ich habe es geschafft, dass die Awtrix Uhr mit den Solar Monitor die Werte aus dem Tasmota Zähler-Lesekopf anzeigt. Allerdings keine negative Werte. Ich korrigiere, die negativen Werte werden auch positiv angezeigt.

Leider bin ich ein absoluter Neuling, was das hier angeht.

Was kann ich unternehmen, dass die negativen Werte anders angezeigt werden?

Falls noch Daten benötigt werden, stelle ich diese gerne zur Verfügung.

Vielen Dank

Hallo,

hat niemand eine Antwort für mich?

Danke

Du lässt Dir doch einen Sensorwert auf der Awtrix wiedergeben.
Ist der Sensorwert in Home Assistant negativ oder zeigt hier schon nur positive werte an?

Gruß Osorkon

Oh Mann, Sorry. Mein Fehler.

In der Weboberfläche wird der Wert korrekt dargestellt.

In der Awtrix aber nur positiv. Egal ob Erzeugung oder Verbrauch.

Zeig mal das Template, dass Du an die Awtrix übergeben tust.

Gruß Osorkon

Ich habe das über ein Blueprint gelöst

[CODE]

blueprint:
  name: AWTRIX Solar Monitor
  description: 'This blueprint will show the current solar energy received.

    It uses a icons 54156 (solar-green), 50557 (solar-white-dyn), 50546 (solar-static)
    that you need to install.

    '
  domain: automation
  input:
    awtrix:
      name: AWTRIX Device
      description: Select the Awtrix light device
      selector:
        device:
          filter:
            integration: mqtt
            manufacturer: Blueforcer
            model: AWTRIX 3
          multiple: true
    power_source:
      name: Power Sensor
      description: A sensor providing the current power received from your solar system.
      selector:
        entity:
          filter:
            domain: sensor
          multiple: false
    threshold_high:
      name: Threshold for high solar production (W)
      description: The threshold above which the energy production of your solar system
        should be visualized as high. Input in Watts (W).
      selector:
        number:
          min: 0.0
          max: 100000.0
          unit_of_measurement: Watt
          mode: slider
          step: 1.0
      default: 400
    threshold_low:
      name: Threshold for low solar production (W)
      description: The threshold below which the energy production of your solar system
        should be visualized as low. Input in Watts (W).
      selector:
        number:
          min: 0.0
          max: 100000.0
          unit_of_measurement: Watt
          mode: slider
          step: 1.0
      default: 100
    skip_if_zero_watts:
      name: Hide solar production if at 0 Watts
      description: This will not show the solar energy production on your awtrix if
        the production is below 0 Watts.
      selector:
        boolean: {}
      default: false
    skip_during_night_hours:
      name: Hide solar production during night time
      description: This will not show the solar energy production on your awtrix during
        night hours (as specified below).
      selector:
        boolean: {}
      default: false
    night_starts_after_time:
      name: Night Time Start
      description: Set the start of the night time.
      default: 00:00:00
      selector:
        time: {}
    night_ends_after_time:
      name: Night Time End
      description: Set the end of the night time.
      default: 00:00:00
      selector:
        time: {}
mode: single
variables:
  device_ids: !input awtrix
  devices_topics: "{%- macro get_device_topic(device_id) %} {{ states((device_entities(device_id)
    | select('search','device_topic') | list)[0]) }} {%- endmacro %}\n{%- set ns =
    namespace(devices=[]) %} {%- for device_id in device_ids %}\n  {%- set device=get_device_topic(device_id)|replace('
    ','') %}\n  {% set ns.devices = ns.devices + [ device ~ '/custom/solar_power']
    %}\n{%- endfor %} {{ ns.devices }}"
  power_sensor: !input power_source
  power_level: '{{ states[power_sensor].state | int(0) | abs }}'
  threshold_low: !input threshold_low
  threshold_high: !input threshold_high
  power_level_icon: '{%- if power_level > threshold_high %}{{54156}}{%- endif %} {%-
    if (power_level <= threshold_high) and (power_level > threshold_low) %}{{50557}}{%-
    endif %} {%- if power_level <= threshold_low %}{{50546}}{%- endif %}'
  power_level_color: '{%- if power_level > threshold_high %}{{"#04FE04"}}{%- endif
    %} {%- if (power_level <= threshold_high) and (power_level > threshold_low) %}{{"#FCFEFC"}}{%-
    endif %} {%- if power_level <= threshold_low %}{{"#FF4E1A"}}{%- endif %}'
  power_level_text: '{%- if power_level > 1000  %}{{ ((power_level | float(default=0))
    / 1000) | round(1)}} kW{%- else %}{{power_level | round(0)}} W{%- endif %}'
  skip_if_zero_watts: !input skip_if_zero_watts
  skip_during_night_hours: !input skip_during_night_hours
  payload: '{"icon":"{{ power_level_icon }}", "text": "{{ power_level_text }}",  "color":
    "{{ power_level_color }}"}'
  night_start: !input night_starts_after_time
  night_end: !input night_ends_after_time
trigger:
- platform: time_pattern
  minutes: /1
condition:
action:
- choose:
  - alias: Skipping
    conditions:
    - condition: template
      value_template: '{% set now_time = now().strftime("%H:%M") %} {% set night_start
        = night_start %} {% set night_end = night_end %} {{ (skip_during_night_hours
        and ((now_time < night_end) or (now_time > night_start))) or (skip_if_zero_watts
        and (power_level == 0)) }}

        '
    sequence:
    - repeat:
        for_each: '{{ devices_topics }}'
        sequence:
        - service: mqtt.publish
          data:
            qos: 0
            retain: false
            topic: '{{ repeat.item }}'
            payload: '{}'
  - alias: Not skipping
    conditions:
    - condition: template
      value_template: '{% set now_time = now().strftime("%H:%M") %} {% set night_start
        = night_start %} {% set night_end = night_end %} {{ not((skip_during_night_hours
        and ((now_time < night_end) or (now_time > night_start))) or (skip_if_zero_watts
        and (power_level == 0))) }}

        '
    sequence:
    - repeat:
        for_each: '{{ devices_topics }}'
        sequence:
        - service: mqtt.publish
          data:
            qos: 0
            retain: false
            topic: '{{ repeat.item }}'
            payload: '{{ payload }}'

[/CODE]

Ist es dieser Teil um das es geht?

Also Wenn power_level < 0, dann soll ein minis als Vorzeichen hin?

Gruß Osorkon

Ja, das würde hefen. Wie ändere ich das?

Hier mal das Template erweitert. Bei negativen Werten wird ein “-” davor gesetzt und das ganze als String formatiert. Kannst j Amal versuchen.

{% set vorzeichen = iif(power_level < 0, "- ","") %}
{%- if power_level > 1000 or power_level < 1000  %}{{vorzeichen}}{{ (((power_level | abs | float(0))
    / 1000) | round(1)) | string }} kW{%- else %}{{vorzeichen}}{{(power_level | abs | round(0)) | string}} W{%- endif %}

Gruß Osorkon

1 „Gefällt mir“

Wo kann ich den Code für die Automation ändern? Oder muss ich den Blueprint anpassen?

Danke

Ich habe jetzt File Editor im Ordner die /homeassistant/blueprints/automation/blueforcer/flow_qRWNolZn5X4w.yaml geändert.
Diese sieht jetzt wie folgt aus

> blueprint:
> name: AWTRIX Solar Monitor
> description: 'This blueprint will show the current solar energy received.
>
> It uses a icons 54156 (solar-green), 50557 (solar-white-dyn), 50546 (solar-static)
> that you need to install.
> 
> domain: automation
> input:
> awtrix:
> name: AWTRIX Device
> description: Select the Awtrix light device
> selector:
> device:
> filter:
> - integration: mqtt
> manufacturer: Blueforcer
> model: AWTRIX 3
> multiple: true
> power_source:
> name: Power Sensor
> description: A sensor providing the current power received from your solar system.
> selector:
> entity:
> filter:
> - domain:
> - sensor
> multiple: false
> threshold_high:
> name: Threshold for high solar production (W)
> description: The threshold above which the energy production of your solar system
> should be visualized as high. Input in Watts (W).
> selector:
> number:
> min: 0.0
> max: 100000.0
> unit_of_measurement: Watt
> mode: slider
> step: 1.0
> default: 400
> threshold_low:
> name: Threshold for low solar production (W)
> description: The threshold below which the energy production of your solar system
> should be visualized as low. Input in Watts (W).
> selector:
> number:
> min: 0.0
> max: 100000.0
> unit_of_measurement: Watt
> mode: slider
> step: 1.0
> default: 100
> skip_if_zero_watts:
> name: Hide solar production if at 0 Watts
> description: This will not show the solar energy production on your awtrix if
> the production is below 0 Watts.
> selector:
> boolean: {}
> default: false
> skip_during_night_hours:
> name: Hide solar production during night time
> description: This will not show the solar energy production on your awtrix during
> night hours (as specified below).
> selector:
> boolean: {}
> default: false
> night_starts_after_time:
> name: Night Time Start
> description: Set the start of the night time.
> default: 00:00:00
> selector:
> time: {}
> night_ends_after_time:
> name: Night Time End
> description: Set the end of the night time.
> default: 00:00:00
> selector:
> time: {}
> source_url: https://github.com/blueforcer/flows_blueprints/blob/main/flows/flow_qRWNolZn5X4w.yaml
> mode: single
> variables:
> device_ids: !input awtrix
> devices_topics: “{%- macro get_device_topic(device_id) %} {{ states((device_entities(device_id)
> | select(‘search’,‘device_topic’) | list)\[0\]) }} {%- endmacro %}\\n{%- set ns =
> namespace(devices=[ ]) %} {%- for device_id in device_ids %}\\n  {%- set device=get_device_topic(device_id)|replace(’
> ‘,’') %}\\n  {% set ns.devices = ns.devices + \[ device \~ ‘/custom/solar_power’\]
> %}\\n{%- endfor %} {{ ns.devices }}”
> power_sensor: !input power_source
> power_level: ‘{{ states\[power_sensor\].state | int(0) | abs }}’
> threshold_low: !input threshold_low
> threshold_high: !input threshold_high
> power_level_icon: ‘{%- if power_level > threshold_high %}{{54156}}{%- endif %} {%-
> if (power_level <= threshold_high) and (power_level > threshold_low) %}{{50557}}{%-
> endif %} {%- if power_level <= threshold_low %}{{50546}}{%- endif %}’
> power_level_color: ‘{%- if power_level > threshold_high %}{{“#04FE04”}}{%- endif
> %} {%- if (power_level <= threshold_high) and (power_level > threshold_low) %}{{“#FCFEFC”}}{%-
> endif %} {%- if power_level <= threshold_low %}{{“#FF4E1A”}}{%- endif %}’
>
> power_level_text: ‘{% set vorzeichen = iif(power_level < 0, “- “,””) %}
> {%- if power_level > 1000 or power_level < 1000  %}{{vorzeichen}}{{ (((power_level | abs | float(0))
> / 1000) | round(1)) | string }} kW{%- else %}{{vorzeichen}}{{(power_level | abs | round(0)) | string}} W{%- endif %}’
>
> # power_level_text: '{%- if power_level > 1000  %}{{ ((power_level | float(default=0))
>
> # / 1000) | round(1)}} kW{%- else %}{{power_level | round(0)}} W{%- endif %}’
>
> skip_if_zero_watts: !input skip_if_zero_watts
> skip_during_night_hours: !input skip_during_night_hours
> payload: ‘{“icon”:“{{ power_level_icon }}”, “text”: “{{ power_level_text }}”,  “color”:
> “{{ power_level_color }}”}’
> night_start: !input night_starts_after_time
> night_end: !input night_ends_after_time
> trigger:
>
> * platform: time_pattern
>   minutes: /1
>   condition:
>   action:
> * choose:
>   * alias: Skipping
>     conditions:
>     * condition: template
>       value_template: '{% set now_time = now().strftime(“%H:%M”) %} {% set night_start
>       = night_start %} {% set night_end = night_end %} {{ (skip_during_night_hours
>       and ((now_time < night_end) or (now_time > night_start))) or (skip_if_zero_watts
>       and (power_level == 0)) }}
>
>       ’
>       sequence:
>
>     * repeat:
>       for_each: ‘{{ devices_topics }}’
>       sequence:
>
>       * service: mqtt.publish
>         data:
>         qos: 0
>         retain: false
>         topic: ‘{{ repeat.item }}’
>         payload: ‘{}’
>   * alias: Not skipping
>     conditions:
>     * condition: template
>       value_template: '{% set now_time = now().strftime(“%H:%M”) %} {% set night_start
>       = night_start %} {% set night_end = night_end %} {{ not((skip_during_night_hours
>       and ((now_time < night_end) or (now_time > night_start))) or (skip_if_zero_watts
>       and (power_level == 0))) }}
>
>       sequence:
>
>     * repeat:
>       for_each: ‘{{ devices_topics }}’
>       sequence:
>
>       * service: mqtt.publish
>         data:
>         qos: 0
>         retain: false
>         topic: ‘{{ repeat.item }}’
>         payload: ‘{{ payload }}’

:crayon:by HarryP: Code-/Logzeilen formatiert (bitte immer in </> einbinden)
s.a.: (Neues Update & Features - Hier in der Community 🫶)