Skip to content

Timer CountDown on Button #985

Discussion options

You must be logged in to vote

Place this in your custom styles:

#Place all the DOM changing stuff on the bottom
  ${(() => {
    //Getting the timer-data from hass and saving as local variable
    const timerEntity = hass.states['timer.scaldabagno'];
    
    //Saving the now as a Date variable so we can calculate the difference 
    const now = new Date(); 
    
    //Preparing the result 
    let result = "";

  	try {
      	  const endTime = new Date(timerEntity.attributes.finishes_at);      //Taking endtime from timer-entity and making a date-time from it 
  	  const runningTime = Math.round((endTime - now)/1000);           //Calculating the difference
          const minutes = Math.floor(runningTime / 60);      …

Replies: 3 comments 15 replies

Comment options

You must be logged in to vote
8 replies
@MrBearPresident
Comment options

@Marcoletto
Comment options

@Marcoletto
Comment options

@MrBearPresident
Comment options

Answer selected by Marcoletto
@Marcoletto
Comment options

@johndoe0815
Comment options

Comment options

You must be logged in to vote
2 replies
@MrBearPresident
Comment options

@Marcoletto
Comment options

Comment options

You must be logged in to vote
5 replies
@johndoe0815
Comment options

@MrBearPresident
Comment options

@MrBearPresident
Comment options

@johndoe0815
Comment options

@MrBearPresident
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment