Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 107148

Duration of a switch state - In seconds

$
0
0

Hello,

I want to automate my pool and need timers for the switches to record how long they were on and off.
I would then like to use these to control my automation with conditions.

This is working so far for example:

  - trigger:
      - platform: state
        entity_id: switch.pool_pump_switch
        from: 'on'
        to: 'off'
    sensor:
      - unique_id: pool_pump_time_off
        name: "test1 pool pump off"
        state: "{{trigger.to_state.last_changed}}"
        device_class: timestamp

However, I would need the values ​​in seconds since the switch was last in the on or off state.
Is there a way to do this?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 107148

Trending Articles



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