Advertisement
penright

Untitled

Jun 22nd, 2022
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1.  
  2. globals:
  3. # ============================================================================= #
  4. # Store Finish Time.
  5. - id: time1_finish
  6. type: int
  7. restore_value: no
  8. initial_value: "0"
  9.  
  10. sensor:
  11. - platform: template
  12. name: test time 1 finish
  13. id: test_time_1_finish
  14. lambda: "return id(time1_finish);"
  15. accuracy_decimals: 0
  16. unit_of_measurement: minutes
  17. icon: mdi:timer-outline
  18.  
  19.  
  20. # Update the countdown timers every 5 seconds.
  21. interval:
  22. - interval: 5s
  23. then:
  24. - lambda: |-
  25. time1_finish = id(homeassistant_time).now();
  26. - sensor.template.publish:
  27. id: test_time_1_finish
  28. state: !lambda return id(time1_finish);
  29.  
  30. # - lambda: |-
  31. # if (id(remaining_time1) > 0) {
  32. # // Store the previous time.
  33. # id(remaining_time1) = id(time1_finish) - id(homeassistant_time).now();
  34. # }
  35.  
  36.  
  37. time:
  38. - platform: homeassistant
  39. id: homeassistant_time
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement