Automation error when trying to configure

Below is an automation I’m trying to setup

Have to post a picture given the error, it won’t save.

Essentially I have an input number helper that I want to set to the value of the Water meter total usage at the time listed so a card will display 0L used at midnight each day and start counting the L used for that day.

I can’t seem to figure out what I’m doing incorrect in this automation.

Thanks in advance,

The value goes under data: not target:

Please don’t post pictures of text. Post the text correctly formatted for the forum.

It would have been a lot easier for me to show you this if you had done that.

How do I do that when it hasn’t actually saved the automation yet?

I tried copy to clipboard the pasting as “pre formatted text”, but it just comes up with lots of numbers & %, totally unreadable

Are you editing on an iOS device?

Yeah unfortunately that’s an issue. You’d need to copy it from a PC.

This is what I mean, indent the value: under data:

9b959321ecb12450f7d9222f1e0f9a1f5ac7970f_2_690x318

That is a pita indeed. IOS creates a hyperlink when you copy text from some places. What I do is paste it in IOS notes, long press to remove the hyperlink, copy it again and paste it here. A lot of hassle, but it beats having to type over what you see in a screenshot.

Do I need the word value: or just the line starting with {{

I would love to try that remove hyperlinks process, but can you explain why the saved automation shows up in the automation.YAML file as the last entry, but can’t be found when searching automations in the GUI reason??

I replaced the {} on the data line with the line you mentioned without the word value:

Even though it got rid of the error, the automation didn’t add the value of said sensor to the said input.number helper

Yes you do need it. Just move what you have. Look at the 4th example here: https://www.home-assistant.io/integrations/input_number/#automation-examples

Tried adjusting to this, but doesn’t set the input.number to the current value of the sensor.watermeter_total_water_usage

I adjusted the time for testing but nothing happens kinda stuck, if I manually change the state of the input.number to match the sensor.watermeter current value, my daily meter showing water used resets to zero correctly, just can’t seem to get that to happen via automation. Doh!!


- alias: "Store Water Meter Value at End of Day"
    trigger:
      - platform: time
        at: '23:59:59'
    action: input_number.set_value
        data: value "{{ states('sensor.watermeter_total_water_usage') | float }}"
        target:
          entity_id: input_number.water_usage_end_of_day

And you forgot the “:” and you messed up the action block.

- alias: "Store Water Meter Value at End of Day"
  trigger:
    - platform: time
      at: '23:59:59'
  action:
    - action: input_number.set_value
      data: 
        value: "{{ states('sensor.watermeter_total_water_usage') | float }}"
      target:
        entity_id: input_number.water_usage_end_of_day

Have you considered using the GUI automation editor instead of YAML?

Thanks Tom, the action block is correct in the automations.YAML file, I just quickly manually typed a similar format in iOS note to copy it as pre formatted text but missed the - on actions, my bad. Thanks heaps for your help, I will adjust and try.

Side note: is the reason it not findable in setting/automations, because the format is not supported in visual editor? I can only see it if I go directly to the automations.YAML file.

No it is becasue your automation does not have a unique id.

Try this:

- id: store_water_meter_value_at_end_of_day
  alias: "Store Water Meter Value at End of Day"
  trigger:
    - platform: time
      at: '23:59:59'
  action:
    - action: input_number.set_value
      data: 
        value: "{{ states('sensor.watermeter_total_water_usage') | float }}"
      target:
        entity_id: input_number.water_usage_end_of_day

The id can be anything but it must be unique, no other automation may have the same id.

I use GUIDs as the editor I use (VSCode) has an extension that can generate them.

- id: 77e083dd-77a6-43d7-9f5b-e3170d4aaf99 
  alias: 'Front Porch Light Auto On'
  mode: single
  max_exceeded: silent
  trigger:
  - platform: state

OK powered up the laptop so I could copy and paste exactly what’s in the Automations.yaml file as ios does’nt let you highlight a block of text to copy.

bleow is exact how it is set up but still failed to update the input.number helper at 15:51
any further ideas?

cheers.

- id: '1726209466459'
  alias: Store end of day Total Water Usage
  description: 'store end of day water'
  trigger:
  - platform: time
    at: '15:51:00'
  action:
  - action: input_number.set_value
    data: 
     - value: '{{ states(''sensor.watermeter_total_water_usage'') | float }}'
    target:
      entity_id: input_number.yesterday_water_total
  mode: single

Ohh, sorry