LavermanJJ / home-assistant-solarfocus

🏡 Solarfocus eco manager touch integration for Home Assistant
Apache License 2.0
14 stars 3 forks source link

Send a notification with biomass boiler status #87

Open alberto-lessi opened 7 months ago

alberto-lessi commented 7 months ago

Hi, I would like to create an automation that send a notification when the biomass bolier state changes. Unfortunately, when I configure the notification message, I can have only the numeric status information, not the translation. In the message I've used: {{ states('sensor.solarfocus_biomass_boiler_status') }} but I can get only a number. Could you help me to find a solution? Thanks

colgrim commented 6 months ago

Same here, would be interested too...

tinerop commented 6 months ago

Have you tried this in Home Assistant? (see screenshot)

The Screenshot is in German but if you add an new automation it should look the same...

automation

eg ... If the status X changes.. then send an message to iphone...

I have not tested this myself... I will try this later this week... but thats how i usually do automations...

colgrim commented 6 months ago

@tinerop the problem is not the message working itself, but the message content. What we try to achieve is, that the status like "Bereitschaft", "Zündphase" etc. is displayed within the message. What we get at the moment is "boiler has changed to status 2" but the result should look like "boiler has changed to Pelletsbetrieb"

LavermanJJ commented 6 months ago

The reason being, that the state in the backend is a numerical value, and is translated by the frontend to the respective text. Therefore, the text is unfortunately unavailable in templates or messages, as they are handled by the backend and not the frontend. This is a general "issue" of home assistant.

You would need to provide a mapping yourself (doubling the translation mapping of the frontend). As done here: https://community.home-assistant.io/t/how-can-i-get-the-translation-of-a-sensor-state/620106/8

lein1013 commented 5 months ago

Just to confirm - the status should be translated to the text and not like grafik I think I need to check if the integration was update correctly

LavermanJJ commented 5 months ago

If the screenshot is from your Lovelace dashboard, and not showing a template sensor, yes there should be text.

colgrim commented 5 months ago

Ok, I think I've got something for you:

alias: Status Pelletkessel
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.solarfocus_biomass_boiler_status
    to: null
condition: []
action:
  - service: notify.mobile_app*
    data:
      title: Solarfocus Pelletkessel
      message: >-
        Status geändert zu  {% set kessel_message = {'0': 'Bereitschaft',
        '1': 'Zündphase',
        '2': 'Pelletsbetrieb',
        '3': 'Kesselsolltemperatur erreicht, Nachlauf',
        '4': 'Nachlauf',
        '5': 'keine Anforderung, Nachlauf',
        '6': 'Brenner ausgeschaltet',
        '7': 'Pelletsvorratsbehälter ist leer, Nachlauf',
        '8': 'Wärmetauscherreinigung ist aktiv',
        '9': 'Wärmetauscherreinigung benötigt, Nachlauf',
        '10': 'Stromausfall, Nachlauf',
        '11': 'zweiter Zündversuch, Nachlauf',
        '12': 'Füllraumtemperatur überschritten, Nachlauf',
        '13': 'Einschub überlastet, Nachlauf',
        '14': 'Fremdkessel aktiv, Nachlauf',
        '15': 'Fremdkessel aktiv, Bereitschaft',
        '16': 'Brenner ausgeschaltet, Nachlauf',
        '17': 'Sicherheitskette ist offen',
        '18': 'Sicherheitskette ist offen, Nachlauf',
        '19': 'Restsauerstoffgehalt zu hoch, Nachlauf',
        '20': 'Abgastemperatur zu gering, Nachlauf',
        '21': 'Abgastemperatur zu hoch, Bereitschaft',
        '22': 'Abgasfühler ist defekt, Bereitschaft',
        '23': 'Einschubtemperatur zu hoch, Bereitschaft',
        '24': 'Lambdasonde ist defekt, Nachlauf',
        '25': 'Kesseltemperatur ist ausreichend, Bereitschaft',
        '26': 'kein Stromfluss Einschubmotor, Nachlauf',
        '27': 'Kesselfühler ist defekt, Bereitschaft',
        '28': 'Kesselfühler ist defekt, Nachlauf',
        '29': 'Lambdasonde wird beheizt',
        '30': 'Wärmetauscherreinigung wartet auf eine Freigabe, Zeit',
        '31': 'Wärmetauscherreinigung wartet auf eine Freigabe, AGT',
        '32': 'Wärmetauscherreinigung wartet auf eine Freigabe, KT',
        '33': 'Saugaustragung wartet auf nächste Freigabezeit',
        '34': 'Pelletsvorratsbehälter wird befüllt',
        '35': 'Einschubfühlerkurzschluss, Bereitschaft',
        '36': 'Rückbrandschieber öffnet',
        '37': 'Kessel wird befüllt',
        '38': 'Lambdasonde wird kalibriert',
        '39': 'Kaminkehrer Messfreigabe',
        '40': 'Alarm aktiv!',
        '41': 'Kesseltür ist offen, Bereitschaft',
        '42': 'Tür war zu lange offen, Nachlauf',
        '44': 'keine Brennerzeitfreigabe, Nachlauf',
        '45': 'Luftzahl Zündphase zu tief, Nachlauf',
        '46': 'Ascheaustragung aktiv',
        '47': 'Kesseltür/Aschebox ist offen, Bereitschaft',
        '48': 'Kesseltür/Aschebox wurde geöffnet, Nachlauf',
        '49': 'Kessel aktiv',
        '50': 'Saugaustragung wartet auf Umschalteinheit',
        '51': 'Brenner ausgeschaltet, Mindestkessellaufzeit aktiv',
        '52': 'Kaminkehrermessung beendet, Nachlauf',
        '53': 'warten bis die Raumluftklappe offen ist',
        '54': 'Stromausfall, Bereitschaft',
        '55': 'Stromausfall, Nachlauf',
        '56': 'WT-Spülung Brennwertmodul aktiv',
        '57': 'Differenzdruckschalter hat ausgelöst, Nachlauf',
        '58': 'warten auf Freigabe von Differenzdruckschalter',
        '59': 'WT-Spülung Brennwertmodul wartet auf eine Freigabe'} %} 
        {% set kessel_state = states('sensor.solarfocus_biomass_boiler_status') %}  {% if kessel_state
        in kessel_message %} {{ kessel_message[kessel_state] }} {% else %} {{
        kessel_state }} {% endif %}
mode: single
LavermanJJ commented 5 months ago

Thanks for your effort! Do you want to make it part of the readme? Or do you want me to do it? Making it easier for others to find it.

colgrim commented 5 months ago

No problem, please feel free to make this part of the readme. Maybe you could generalize some specific parts which belong to my configuration ;-)

LavermanJJ commented 4 months ago

I just read, that with 2024.03 this is fixed cf https://rc.home-assistant.io/blog/2024/02/28/release-20243/


# Translated
{{ state_translated("binary_sensor.movement_backyard") }}  # Shows: Detected
{{ state_translated("sun.sun") }}  # Shows: Below horizon