Mathematical operation as an action of automation?

I need to do some simple math based on triggers. Doing something based on a trigger sounds like a typical automation to me…

However, I do not seem to find anything from actions I could use?

Calling a service could be an option, but again, I cannot find anything suitable from services either. E.g. running a template should probably do it, but there is no such option.

How then?

Can you clarify what you are actually trying to do?

You can perform a number of mathematical operations within templates in an automation using variables or you can create template sensors that are rendered based on a trigger event… but it is hard to advise you without knowing your planned method of output.

For example, each night 23:59 I would like to store avalue to input_value with some simple additions to it.

I could do the math in a template, but the problem is that in the automations I cannot find a way to do it.

Template sensor could be a way to go? These structures, taking for example the one You linked to:

template:
  - trigger:
      - platform: time_pattern
        # This will update every night
        hours: 0
        minutes: 0
    sensor:
      # Keep track how many days have past since a date
      - name: "Not smoking"
        state: '{{ ( ( as_timestamp(now()) - as_timestamp(strptime("06.07.2018", "%d.%m.%Y")) ) / 86400 ) | round(default=0) }}'
        unit_of_measurement: "Days"

…does not seem to be someting one could start with an autoimation graphical UI (and perhaps edit it in yaml), it needs to go to configuration.yaml?

You are correct that template sensors cannot be created in the UI.

In this case you do not need a triggered template sensor, just use a state-based template sensor:

template:
  - sensor:
      - name: "Not Smoking"
        state_class: measurement
        unit_of_measurement: "days"
        state: >
          {{(now() - now().replace(day = 6, month = 7, year = 2018)).days}}

If you wanted to use a triggered template sensor to save a little bit of processing, you can… just make sure to include a trigger for restarts as well as your time trigger:

template:
  - trigger:
      - platform: homeassistant
        event: start
      - platform: time
        at: "00:00:00"
    sensor:
      - name: "Not Smoking"
        state_class: measurement
        unit_of_measurement: "days"
        state: >
          {{(now() - now().replace(day = 6, month = 7, year = 2018)).days}}

And if you want to avoid configuration.yaml, you can do it in the UI by saving the value to an Input number helper using the input_number.set_value service. (You will need to switch to the yaml editor by clicking the three-dot menu at the top right of the UI automation editor so that you can add the template).

Sorry for delay. Been quite busy lately, but will look into this a bit later. Some more urgent issues needs to be solved first…