Converting a sensor to a timer?

Hi there,

I have sensors for my Hunter Hydrawise integration that reports the number of minutes remaining for a water cycle. Is there any way to make a timer entity out of that so it can be used on a timer card?

Thanks

Do you just want to show the timer, eg. you want to show something like “2022-07-23:231800H”, or do you want to change the time somehting happens, eg. you set 10 minutes and then something should happen?

If the first, you’d need to setup a template sensor that gives you the friendly time/date. This is an example, that will not work as is. :slight_smile: You need to adjust the state the sensor gives you to a timedelta, eg. if the timer gives you minutes or days and minutes, and this needs to be adjusted. And you’d need to make that a really friendly date by using eg. timestamp_custom as a filter. Just to get you an idea:

template:
  - trigger:
      - platform: state
        entity_id: your_sensor_from_the_integration_here
    sensor: 
      name: your_new_sensor_name
      state: >
        {% set time_to_add = states('your_sensor_from_the_integration_here') %}
        {{ now() + timedelta(hours=time_to_add) }}

I have a sensor that reports the minutes remaining on a sprinkler that is running. I want to convert that to a timer so it can be used in a custom bar-timer-card that requires a timer entity to show a bar graph of time remaining that is updated continually.

Thanks

That doesn’t answer my question, unfortunately. :slight_smile:

Do you want this timer to control something or just show a remaining time? If the latter, use something like the example I posted above. :slight_smile:

Control means, if you change the time on the timer, should this be reflected by the sprinkler? Show means, you only want to know how much time is left.

Sorry, to be clear…

I need the integration sensor, which reports minutes remaining to work as a timer. That timer is used in a custom card to show a bar that decreases in length as the time decreases.

Thanks

Ok, now I get what you want. :slight_smile: For the next time, it would help a lot, if you give links and some more information about the integrations/cards you use. Not meant rude, really, but would have saved some time. :slight_smile:

You don’t need that kind of conversion for the “timer-bar-card” (different name, that’s why I couldn’t find it in the first place :wink: ): Great card btw., thanks for introducing it to me! :+1:

For what I can see, the Hunter Hydrawise reports minutes as its sensor state. Is this correct? Something like “10.0”? And what is the exact name of that sensor?

The card can use that already, see here:

If you post the actual sensor (please include the attribute watering_time because of the format) and binary_sensor, we can try to set that up. :slight_smile:

Thanks, that’s completely fair.

Here are the three entities provided by Hydrawise. Yes, the Watering Time sensor reports minutes as its state. I created a template sensor for the next cycle time to cleanup the timestamp format.

There is no watering_time attribute that I can see.




Thanks

Try this and report back if it works (I hope it does :rofl: )

type: custom:timer-bar-card
debug: true
entities:
  - binary_sensor.left_front_yard_watering
duration:
  entity: sensor.left_front_yard_watering_time
  units: minutes

The debug option should bring up errors, if some come up.

1 Like

That worked perfectly. No idea why I was so confused. Thanks!!

1 Like

Hey got the same Problem
i have a loading time from my car shown up like this in the sensor
is it possible to convert it to a timer ?
Dauer Ladezeit

Blockquote

sensor.dauer_ladezeit

Hi,

I’m trying to do something similar.
I have the nintendo integration - Nintendo Switch Parental Controls
It produce this:

But I can’t get the bar to display.:

Any suggestions?

THX.