Quantcast
Channel: Configuration - Home Assistant Community
Viewing all 109599 articles
Browse latest View live

Global variable in automation

$
0
0

Hey there,

I know this topic has been discussed many times (thus I am very sorry for asking again) but I was unable to find the solution in the forum.
I’d like to set the value of a variable depending on a condition and use the variable afterwards (outside of the IF block). As stated in the docs variables have their own scope and are reset after the if.
Take the example from the docs

sequence:
  # Set the people variable to a default value
  - variables:
      people: 0
  # Try to increment people if Paulus is home
  - if:
      - condition: state
        entity_id: device_tracker.paulus
        state: "home"
    then:
      # At this scope and this point of the sequence, people == 0
      - variables:
          people: "{{ people + 1 }}"
      # At this scope, people will now be 1 ...
      - action: notify.notify
        data:
          message: "There are {{ people }} people home" # "There are 1 people home"
  # ... but at this scope it will still be 0
  - action: notify.notify
    data:
      message: "There are {{ people }} people home" # "There are 0 people home"

How can I achieve that there are 1 people home in the last action?

The only solution I found was to create helpers for the variables, however as I want to define multiple variables it does not seem appropriate/efficient to define so many helpers that are only used in one automation.
It has to be possible to define global variables, right?


Background (not that important)
I want to create a notification with different content and to different users depending on a condition. Currently I have all steps after the variable definition duplicated in each branch of the condition which creates a whole lot of code duplication.

alias: "Benachrichtigung: Wenn Felicitas auf dem Heimweg ist"
description: ""
triggers:
  - alias: Wenn Felicitas sich an zuhause annähert
    trigger: state
    entity_id:
      - sensor.home_bewegung_von_felicitas
    for:
      hours: 0
      minutes: 2
      seconds: 0
    to: towards
    id: felicitas_heimweg
  - alias: Wenn Felix an zuhause annähert
    trigger: state
    entity_id:
      - sensor.home_bewegung_von_felix
    for:
      hours: 0
      minutes: 2
      seconds: 0
    to: towards
    id: felix_heimweg
conditions: []
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.id == 'felicitas_heimweg' }}"
        sequence:
          - variables:
              person_coming: seine Freundin
              user: den Nutzer
              distance: "{{ states('sensor.home_entfernung_von_felicitas') }}"
              unit_of_measurement: >-
                {{ state_attr('sensor.home_entfernung_von_felicitas',
                'unit_of_measurement') }}
              phone_to_notify: mobile_app_felix_handy
              notify_title: Felicitas ist auf dem Heimweg
          - variables:
              main_prompt: >-
                Benachrichtige {{ user }} darüber, dass {{ person_coming }} auf
                dem Heimweg ist und aktuell {{ distance }}{{ unit_of_measurement
                }} entfernt ist. Sei glücklich und enthusiastisch darüber.
                Schreibe genau einen kurzen Satz. Benutze ein glückliches Emoji
                am Ende.
          - action: google_generative_ai_conversation.generate_content
            metadata: {}
            data:
              prompt: "{{ main_prompt }}"
            response_variable: response
          - action: notify.{{ phone_to_notify }}
            metadata: {}
            data:
              message: "{{ response.text }}"
        alias: Wenn Felicitas auf dem Heimweg ist
      - conditions: []
        sequence:
          - variables:
              person_coming: ihr Freund
              user: die Nutzerin
              distance: "{{ states('sensor.home_entfernung_von_felix') }}"
              unit_of_measurement: >-
                {{ state_attr('sensor.home_entfernung_von_felix',
                'unit_of_measurement') }}
              phone_to_notify: mobile_app_felicitas_handy
              notify_title: Felix ist auf dem Heimweg
          - variables:
              main_prompt: >-
                Benachrichtige {{ user }} darüber, dass {{ person_coming }} auf
                dem Heimweg ist und aktuell {{ distance }}{{ unit_of_measurement
                }} entfernt ist. Sei glücklich und enthusiastisch darüber.
                Schreibe genau einen kurzen Satz. Benutze ein glückliches Emoji
                am Ende.
          - action: google_generative_ai_conversation.generate_content
            metadata: {}
            data:
              prompt: "{{ main_prompt }}"
            response_variable: response
          - action: notify.{{ phone_to_notify }}
            metadata: {}
            data:
              title: "{{ notify_title }}"
              message: "{{ response.text }}"
        alias: Wenn Felicitas auf dem Heimweg ist
mode: single

Thank you for any hints, I appreciate it! :slight_smile:

Cheers,
Felix

2 posts - 2 participants

Read full topic


Templates and multiple sensor

$
0
0

Hello, new user and tried to gather an understanding but need some guidance on template yaml

I can successfully create one sensor and it works but when I try to add another it only updates the last b.

Below is the code in the template yaml file.

sensor:
  name: scaled_amp_a
  unique_id: scaled_amp_a
  unit_of_measurement: "A"
  device_class: current
  state:
    "{{ (states('sensor.pwr_monitorct200_current_a','current') | float * 2.5 ) }}"


  name: scaled_amp_b
  unique_id: scaled_amp_b
  unit_of_measurement: "A"
  device_class: current
  state:
    "{{ (states('sensor.pwr_monitorct200_current_b','current') | float * 2.5 ) }}"

3 posts - 2 participants

Read full topic

Unexpected problem when using "while" with TTS

$
0
0

I have an automation to speak (tts) and notify devices if a sensor detects humidity. Sensor is irrelevant (Ikea, MQTT) as it works.
I want it to repeat the message “Water leak in…” every 30 seconds until sensor gets dry.
I first set it to speak/notify, then enter a “while (sensor wet)” loop to speak/notify then wait 30 seconds.
That works.
Then I thought the first speak/notify is redundant, as the one inside the while loop should be enough. Here’s the rub: if I disable the speak/notify before the “while” then the one inside the “while” doesn’t work.
I suspect that the next call happens before the tts finishes but why would that depend on what’s before the loop?
Log includes things like “SpeakScript turned off triggered by automation AutomationName triggered by state of SensorName”
I tried direct tts “calls”, separate scripts to call the TTS, even script for the 30s delay (instead of just the delay) in the hope that scripts would wait for each other.
The code below works, but doesn’t if I disable the “scriptandnotifydevices” before the “repeat”:

alias: ZigIkeaWater1-Wet_Test
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.zigikeawater1_water_leak
    to: "on"
conditions: []
actions:
  - action: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.31
    target:
      entity_id: media_player.cat_s_bedroom_speaker
    enabled: true
  - action: script.scriptspeakandnotifydevices
    metadata: {}
    data:
      message: Water leak in "{{ location }}"
    enabled: true
  - repeat:
      sequence:
        - action: script.speakmessage
          metadata: {}
          data:
            message: Water leak in "{{ location }}"
          alias: "Call script SpeakMessage: \"Water leak in...\""
        - action: script.scriptwait30s
          metadata: {}
          data: {}
      while:
        - condition: state
          entity_id: binary_sensor.zigikeawater1_water_leak
          state: "on"
  - action: script.scriptspeakandnotifydevices
    metadata: {}
    data:
      message: No more water leak in "{{ location }}"
    alias: "Script SpeakAndNotify: \"No more Water leak in...\""
mode: single
variables:
  location: the laundry room

1 post - 1 participant

Read full topic

AVM fritz and ping check

$
0
0

I have several fritz-boxes in my home and they are auto-disovering devices.
now, I have some servers which I want to turn power off (relays connected) when they are shut down.
unfortunately, when I try to add an ping (ICMP) check, the integration tells me that the device is already configured (even if not in ping integration).
now, I tried to delete the device using developer tools → actions, but the only action for avm is wifi password reset.
now, I could create a ping entity by not using the name but the ip, but this is not so beautiful.
any suggestions would be great!

1 post - 1 participant

Read full topic

Home assistant - duckdns - incl google wifi nest router

$
0
0

I have ha running behind a google-wifi-router on ip adres http://192.168.xx.xx:8123/
the google-wifi-router has wan-ip http://109.129.xxx.xx:confused: given by the internet router
on the google-wifi-router a port forwarding configured (on port 8123)
so accessing on the local network http://109.129.xxx.xx:8123 is indeed home assistant starting up., proving that the portforwarding is working :wink:

the setup is if i understand wel een double nat

on duckdns.org a domain famx.duckdns.org is configured (and ping to this domain is working find)

the home assistant duckdns add-on is configured with
domains:

  • famx.duckdns.org
    token: 57xxxxxxxxxxxxxxxxxxxxxxxxxxx
    aliases:
    lets_encrypt:
    accept_terms: false
    algo: secp384r1
    certfile: fullchain.pem
    keyfile: privkey.pem
    seconds: 300

nevertheless http://amx.duckdns.org:8123 is not working
What did i forget in the setup ?

txs for the support

1 post - 1 participant

Read full topic

Recorder Setup Failed

$
0
0

Hello,

I have HAOS running in a VM on my Truenas server. I’ve been running it for several months, and finally noticed the recorder does not start.

In parrallel, I spun up another copy of HAOS in a VM on a fresh install and noticed that it also has a recorder that fails to start.

Copy of the log below.

Can anyone suggest how I might fix this issue?

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 146, in __init__
    self._dbapi_connection = engine.raw_connection()
                             ~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 3298, in raw_connection
    return self.pool.connect()
           ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 449, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 1263, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 179, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 177, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
    return _ConnectionRecord(self)
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/create.py", line 646, in connect
    return dialect.connect(*cargs, **cparams)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/default.py", line 622, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not translate host name "home-assistant-postgres" to address: Name has no usable address


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 912, in _setup_recorder
    self._setup_connection()
    ~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/core.py", line 1427, in _setup_connection
    migration.pre_migrate_schema(self.engine)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/recorder/migration.py", line 323, in pre_migrate_schema
    inspector = sqlalchemy.inspect(engine)
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/inspection.py", line 140, in inspect
    ret = reg(subject)
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/reflection.py", line 313, in _engine_insp
    return Inspector._construct(Inspector._init_engine, bind)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/reflection.py", line 246, in _construct
    init(self, bind)
    ~~~~^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/reflection.py", line 257, in _init_engine
    engine.connect().close()
    ~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 3274, in connect
    return self._connection_cls(self)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 148, in __init__
    Connection._handle_dbapi_exception_noconnection(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        err, dialect, engine
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 2439, in _handle_dbapi_exception_noconnection
    raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 146, in __init__
    self._dbapi_connection = engine.raw_connection()
                             ~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/base.py", line 3298, in raw_connection
    return self.pool.connect()
           ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 449, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 1263, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 179, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/impl.py", line 177, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
    return _ConnectionRecord(self)
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 146, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/create.py", line 646, in connect
    return dialect.connect(*cargs, **cparams)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/sqlalchemy/engine/default.py", line 622, in connect
    return self.loaded_dbapi.connect(*cargs, **cparams)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not translate host name "home-assistant-postgres" to address: Name has no usable address

(Background on this error at: https://sqlalche.me/e/20/e3q8)

2 posts - 1 participant

Read full topic

Problems tracking Pixel 7 via beacons and Shelly Blu Gateway

$
0
0

I’m having some trouble finding my Pixel 7 mobile via bluetooth through my HA OS installation.

My set up:

  • HA OS running as vm on Proxmox
  • Shelly BLU gateway, set up through Bermuda, which is seeing other devices
  • Pixel 7 with the companion app, beacon transmission turned on

I’m not experienced and not sure if I miss something. I was looking out for the Pixel 7 bluetooth mac address which doesn’t show up (it also didn’t show up using a regular bluetooth 5.3 USB stick).

My end goal is having real time recognition of my mobile so I can use it as trigger for automations.
Since I can see all kinds of bluetooth devices, icluding beacons, something might be wrong with the set up on my Pixel 7. I’m also not sure if looking for the bluetooth mac address is the correct way to go.

I would appreciate some help on this!

1 post - 1 participant

Read full topic

Template sensor in data section of action

$
0
0

Hi,
I am adding functionallity to pre heat my Audi to home assistant. It works when I set it up as an action in the visual view but I would like to be able to have input toggles to say which seats it should heat up and if it should head the windshield also. I have tried the following which looks correct in developer tools. i.e. it shows True or False which is what is expected. (There is also a VIN number but I left that out here for obvious reasons)

action: audiconnect.start_climate_control
data:
  glass_heating: false
  seat_fl: {{states('input_boolean.car_seat_front_left')=='on'}}
  seat_fr: {{states('input_boolean.car_seat_front_right')=='on'}}
  seat_rl: {{states('input_boolean.car_seat_rear_left')=='on'}}
  seat_rr: {{states('input_boolean.car_seat_rear_right')=='on'}}

When I try to use this I get the following message:

Failed to perform the action script/car_heating. invalid boolean value {[object Object]": None) for dictionary
value @ data['seat_fl]

I tried to add “” or ‘’ but I guess as this is a boolean they should not be there…
All input is much appreciated, thanks!

2 posts - 2 participants

Read full topic


Homekit bridge stateless programmable switch showing "not supported" after a few days

$
0
0

I have a zigbee programmable button, and was connected to home assistant via zigbee2mqtt.

I also configured homekit bridge to bridge this button to apple home, by adding the button in advanced configuration of programmable switches.

It works OK at first (despite not showing the single press, double press, long press options). However, after a few days, the switch in apple home showed “not supported”, and configured actions no longer works.

Is there anything I am doing wrong? any help will be appreciated

1 post - 1 participant

Read full topic

Why does the conversation I'd change every 5 minutes?

$
0
0

I’m good at gluing things together that I don’t understand … Anyway my goal is to insert things that are announced with assist_satellite.announce into the history of voice assist, so if I miss a detail I can ask for it to be repeated. This led to finding the conversation Id for voice assist burried in the debug log and copying it into all automations that might announce something. And, it worked, for 5 minutes.
I also found that all voice assist history is lost every 5 minutes. That might make sense for turning lights on and off, but for having a conversation with an ai agent it seems like a very bad decision.
After a lot of searching I found:

That led me to esphome where I found conversation_timeout, added here:

I tried changing that and recompiling, didn’t help.
The current 2025.3.3 change log lists several changes to conversation Id, but none of it looks like it adds any functionality.
If it matters I’m running everything locally
S3 box 3 for “assist device”
N100 mini pc running Debian for home assistant
Big Ubuntu desktop with 3090 for wisper/piper/ollama and frigate

Anyone have some insight? The documentation does not go into much detail.

Thanks for reading

1 post - 1 participant

Read full topic

Sonoff ZBCurtain turning light on and off

$
0
0

I have a Sonoff ZBCurtain set up via Zigbee2MQTT.
All of a sudden it started turning the bedroom light on when closing the curtain and off when opening the curtain. This even happens when I use the remote that came with the curtain mover. I have no idea why it is doing this now after 6 months of use. The curtain mover is called “Bedroom Curtain” and the light switch is “Bedroom Light Switch”.
In the logbook I can see that the light switch was set to on/off, but not what is causing it.

I have deleted the ZBCurtain in Zigbee2MQTT and re-installed it, but the problem still persists.

Any ideas?

1 post - 1 participant

Read full topic

Helper template number use set value in action

$
0
0

I set up a helper template number to check my led’s white channel.
the state is {{ state_attr(“light.shellyplusrgbwpm_kitchenbottomright”, “rgbw_color”)[3] }} which works fine.

I tried adding an action to change the led’s value

action: light.turn_on
metadata: {}
data:
  rgbw_color:
    - 0
    - 0
    - 0
    - "{{ states('number.kitchenbottomrightwhite') | int }}"
target:
  entity_id: light.shellyplusrgbwpm_kitchenbottomright

This does not change my led because the state of my helper is not updated with the value set.
How can I use the value set in the helper, instead of the state which is always representing my current led white value?

10 posts - 3 participants

Read full topic

Having troubles adding 2 sensor values together in a sensor. it buggers up my other sensors

$
0
0

so i working on a energy sensor as i going to order Clamp meters so i made 3 values L1 L2 and Total i did this twice for my shop and house

i can do L1 and L2 but when i do the Total sensor adding L1 and L2 it removes my other generatored sensors… i have had it if it will just do 50 + 50 but it wont add it as 100

here is part of it

  template:
    sensors:
      #         # House KW/H Used"

      grid_energy_house_l1_imported:
        friendly_name: "Grid Energy House L1 Imported"
        value_template: "{{ states('sensor.back_room_light_1_power')|float(0) }}"
        unit_of_measurement: "kwh"
      grid_energy_house_l2_imported:
        friendly_name: "Grid Energy House L2 Imported"
        value_template: "{{ states('sensor.back_room_light_2_power')|float(0) }}"
        unit_of_measurement: "kwh"

      grid_energy_house_Total_imported:
        friendly_name: "Grid Energy House Total Imported"
        value_template: "{{ states('sensor.grid_energy_house_l1_imported')| float(0) + states('sensor.grid_energy_house_l2_imported')| float(0)}}"
        unit_of_measurement: "kwh"

so the L1 and L2 work the first 2 but if i run the 2nd one it removes the the first two and doesnt generate the math…
what is wrong with my coding as i googled how to add it but its not

2 posts - 2 participants

Read full topic

How can I reset repeat.index to 0?

$
0
0

Hi All!

I would add some anti-rattle in my automation, but how can I reset anti-rattle timeout?

alias: CarCharge
description: ""
triggers:
  - trigger: state
    entity_id:
      - switch.s_8_avtomobilnoe_zariadnoe_ustroistvo
    from: "off"
    to: "on"
  - trigger: template
    value_template: >-
      {{ ( now().timestamp() -
      as_timestamp(state_attr('automation.carcharge','last_triggered')) ) >
      259200 }}
conditions: []
actions:
  - type: turn_on
    device_id: 2b37ebd4166a01aefa38555777834ce9
    entity_id: 50ec59ebdac6e04bc4196a5ebd99ca74
    domain: switch
  - repeat:
      sequence:
        - delay:
            hours: 0
            minutes: 0
            seconds: 10
            milliseconds: 0
        - if:
            - condition: template
              value_template: >-
                {{ states('sensor.s_8_avtomobilnoe_zariadnoe_ustroistvo_power')
                | float(0) > 0 }}
          then: [HERE I NEED TO RESET repeat.index to 0]
      while:
        - condition: template
          value_template: "{{ repeat.index <= 10 }}"
    enabled: true
  - type: turn_off
    device_id: 2b37ebd4166a01aefa38555777834ce9
    entity_id: 50ec59ebdac6e04bc4196a5ebd99ca74
    domain: switch
mode: restart

1 post - 1 participant

Read full topic

How do I access a variable to use during loading of a dashboard

$
0
0

Hello;

I have been working in HA for only a week, steep learning curve. And first post.

I have a dashboard that uses a small string (2 or 3 characters), to create button labels, and is also inserted into various entity and sensor names. Currently this is accomplished by setting the string as a default variable in 7 decluttering templates; here’s one as an example:

  charger_status_status_card:
    default:
      - var_charger_number: '05'
    card:
      type: custom:button-card
      entity: input_text.[[var_charger_number]]_charge_type
      show_state: true
      show_name: false
      show_icon: false
      show_label: false
      color_type: card
      card_size: 1
      aspect_ratio: 7/1
      icon: '[[var_icon]]'
      styles:
        card:
          - background-color: transparent

Now: I need to make 25 or more of these dashboards, all identical except for that small string. I have a “parent” dashboard with 25 buttons, each of which performs a tap_action: navigate. Each of the 25 subview dashboards live in their own directory, conveniently named with their own string of interest. So the “05” charger dashboard is in /config/dashboards/05/.

The only difference between all the 25 dashboards is that string. I am trying to figure out how to do something that provides that string when the dashboard loads.

  • I do not believe that the navigate tap_action can pass along a variable.
  • I have created a one-line shell script which successfully gets the string of interest, and which I have wrapped into an action:
/bin/pwd | awk -F/ '{print $NF}'
  • I have read in config-template-card about the possibility of dashboard wide variables.
  • I have tried (and failed) various pieces of Javascript in places (window.location.pathname for example).

And of course I am swimming in understanding how HA ties things together, being pretty new.

I am hoping I can be guided to how to do something like:

  • pass the string variable along with the navigate call
  • use shell_command or command_line to read the dashboard’s directory and insert the string into the dashboard - either into the template or the view - when it loads
  • some other way to insert the (correct) string into the dashboard in the right places

Once the dashboard loads, this value is static and does not need to be re-checked.

If I can get and use this one item, I can create all 25 dashboards from two generic files, the decluttering template and the dashboard view. Here would be an entire dashboard:

decluttering_templates: !include /config/decluttering_templates/charger_dashboard.yaml
views: !include /config/dashboards/charger_dashboard_master.yaml

Any help appreciated greatly,
hugh

1 post - 1 participant

Read full topic


HA core unavailable from time to time under container

$
0
0

I have installed HA core on Qnap NAS under container station. My Qnap NAS is backup NAS that only sync main NAS in the night time. So it is light in use. Since I get HA core running for more than 2 years, from time to time, I found that HA is offline or very very slow that my phone HA connect get lost. At that time, my PC HA web console is lost as well. However, Qnap server is still online, but very slow. To fix this, all I need to do is restart container station app service. (Don’t need restart NAS). This issue happens sometimes after a few days or sometimes once in a few weeks. However, it do happens. Not sure why? and any clue that causes this? My current HA core is 2025.1.0.

1 post - 1 participant

Read full topic

Color change of Angela Smart Bulb in Automation?

$
0
0

Hello,

I am new to HA and have an issue.

I have a Antela Smart Bulb that was integrated with Tuya. When I click on it from the dashboard, I can choose different colors.

But for some reason when creating an Automation and choosing it as action, the only options are on/off and brightness.

Anyone know how to get the color option to be used?

Thank you!

2 posts - 2 participants

Read full topic

Aqara FP2 won't trigger automation after midnight

$
0
0

Hello everyone,

I’m experiencing an issue with my Home Assistant automation using the Aqara FP2 motion sensor. The automation works perfectly before midnight, but after midnight, it stops triggering the lights.

Setup Details:

  • Home Assistant Version: 2025.3.3 (latest)
  • Devices Involved:
    • Aqara FP2 Motion Sensor (used in the bedroom)
    • Philips Hue Bulbs (controlled via Hue Bridge)
    • Google Nest Mini (for night mode command)
  • Other Working Rooms:
    • Bathroom & Toilet (using Philips Hue Motion Sensors) → These work fine after midnight.

Automation Logic:

  1. Trigger:
  • Motion detected (occupied) on Aqara FP2
  • Condition: After sunset
  • Action: Turns on lights (all 3 lights or 1 light depending on “Night Mode”)
  1. Night Mode:
  • Activated via Google Home “Good Night” routine
  • When Night Mode is on, only 1 light turns on instead of 3

Problem:

  • Before midnight: Everything works fine.
  • After midnight: The automation no longer triggers when I enter the room.
  • The same automation logic works fine in other rooms (toilet & bathroom) with Hue Motion Sensors.
  • Google Home automation (separate test) successfully turns on the light after midnight, meaning the light itself is working fine.

What I’ve Checked So Far:

:white_check_mark: Aqara FP2 Detection (Developer Tools → States)

  • Before midnight → Motion (occupied ) detected :white_check_mark:
  • After midnight → Motion (occupied ) detected :white_check_mark:

:white_check_mark: Manually Running the Automation (Automations & Scenes → “Run” button)

  • Lights turn on manually :white_check_mark:

:white_check_mark: Checked for Conditions Blocking the Automation

  • There are no time-based conditions stopping the automation.
  • The automation should run anytime after sunset, including past midnight.

:white_check_mark: Checked Logs for Errors

  • No obvious errors related to light.turn_on or Aqara FP2 .

Possible Causes:

  1. Aqara FP2 stops detecting motion after midnight (or has a sleep mode I don’t know about?).
  2. Home Assistant or Zigbee network (if relevant) stops receiving updates from FP2.
  3. A hidden condition or bug in the automation preventing it from triggering.

Questions:

  • Has anyone else experienced the Aqara FP2 stopping motion detection past midnight?
  • Is there a known timeout, sleep mode, or inactivity reset that needs to be configured on the FP2?
  • Could this be an issue with Home Assistant’s handling of motion sensors after a certain time?

Any help would be greatly appreciated! Thanks in advance. :pray:

1 post - 1 participant

Read full topic

Voice Assistant PE update is not working

$
0
0

I’m seeing the update for VA PE in my HA install (and have been for a few days). But the update button does nothing. It’s to version 25.3.0, from the current 25.2.1

Read release announcement


I’ve tried restarting (also updated HA yesterday as I thought that might help).

Clicking the update button just lights the button up for a few seconds and then it goes back to how it was. I’ve tried it via the notifcation and directly via the device page, neither makes any difference.

Logs show an error that I’ve not got to the bottom of:

2025-03-15 07:06:46.162 WARNING (MainThread) [aioesphomeapi.connection] home-assistant-voice-092d71 @ 192.168.1.215: Connection error occurred: home-assistant-voice-092d71 @ 192.168.1.215: EOF received

Any ideas? I’ve not found anything similar on threads here or elsewhere.

1 post - 1 participant

Read full topic

Set number with automation

$
0
0

I have following automation:

alias: Waermepumpe Verbrauch heat
description: “”
triggers:

  • trigger: state
    entity_id:
    • sensor.ebusd_ehp_heatpumpstatus
      to: heat
      conditions:
      actions:
  • action: number.set_value
    metadata: {}
    data:
    value: 1400
    target:
    entity_id: input_number.waermepumpe_aktueller_verbrauch
    mode: single

The automation is started when the sensor changes to heat. But the number will not be stored. What could be wrong. By hand I can change the number -see picture

5 posts - 2 participants

Read full topic

Viewing all 109599 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>