How to send sensor state in a notification

I’m using the iOS companion app to receive notifications from HA. I’d like a notification that tells me when the dryer is done, but I’d like the message to tell me how long the dryer ran. Something like “the dryer is done, it ran for 45:04.”

I have a sensor, sensor.dryer_on_time, that’s state shows how long the dryer ran. How can I include that state value in the notification message?

data_template:
  message: "The dryer ran for {{ states('sensor.dryer_on_time') }}"
4 Likes

How can i get a message with a specific date format from an entity?

Explain what you mean and what you’ve tried so far.

I want to get a notification on my phone that shows two states in a specific time format

This is my curent config:

service: notify.mobile_app_mike
data:
  message: >-
    Goedkoopste tarief is vandaag €{{
    states('sensor.anwb_energie_lowest_energy_price_today')  }} om deze tijd

       {{ states('sensor.energyzero_today_energy_lowest_price_time') }}
  title: Energie tarief

Please format that code properly — there could be error there that we can’t see. Looks like you have the right idea: what notification do you get from that code?

I receive the folowing on my phone:

Goedkoopste tarief is vandaag € 0,1 om deze tijd 2023-03-14T00:00:00+00:00

This is a slow conversation. Now you’ve changed your original question from “two states in one message” to “a specific date format” — completely off-topic —do you think it might be a good idea to tell us what date format you want?

I would like something like 17 march and then with the time it is the cheapest hour like 13:00

{{ states('sensor.energyzero_today_energy_lowest_price_time')
   |as_timestamp(0)
   |timestamp_custom('%d %B %H:%M') }}
1 Like