hass-config icon indicating copy to clipboard operation
hass-config copied to clipboard

[FR] Countdown on items like HVAC

Open icodesdeveloper opened this issue 2 years ago • 3 comments

A great addition would be to implement a countdown timer in the popups for things like the HVAC.

icodesdeveloper avatar May 29 '22 14:05 icodesdeveloper

Good idea! How should it work? I came up with this

screen
timer:
  climate:
    name: Countdown
    icon: mdi:timer-outline

input_number:
  climate_timer:
    name: Shutdown time
    icon: mdi:timer-outline
    initial: 4
    min: 1
    max: 12
    unit_of_measurement: h

switch:
  - platform: template
    switches:
      climate_timer:
        friendly_name: State
        icon_template: mdi:timer-outline
        value_template: >
          {{ is_state('timer.climate', 'active') }}
        turn_on:
          service: timer.start
          target:
            entity_id: timer.climate
          data:
            duration: >
              {{ states('input_number.climate_timer') | int(0) * 3600 }}
        turn_off:
          service: timer.cancel
          target:
            entity_id: timer.climate

automation:
  - alias: climate_timer
    id: '3683394346277'
    trigger:
      platform: event
      event_type: timer.finished
      event_data:
        entity_id: timer.climate
    action:
      service: climate.turn_off
      target:
        entity_id: climate.ac

popup

- type: entities
  entities:
    - type: custom:slider-entity-row
      entity: input_number.climate_timer
      hide_state: false
    - entity: switch.climate_timer
    - entity: timer.climate

matt8707 avatar May 29 '22 18:05 matt8707

Wow i forgot this already, very busy in my last year secundairy school. Maybe now searching a fancyer slider that fits more in the ui and if it is possible making it universal, now it needs per AC unit in the home a timer, it is easier to make a system that generates a timer.

icodesdeveloper avatar Jun 08 '22 19:06 icodesdeveloper

A few hours is also way too long, it is much better per quarter hour.

I changed the timer to this:

  climate_bureau:
    name: Shutdown time
    icon: mdi:timer-outline
    initial: 0.25
    min: 0.25
    max: 6
    step: 0.25
    unit_of_measurement: h

Also for working per quarter hours you cant use an int so we need a float

- platform: template
  switches:
    climate_woonkeuken:
      friendly_name: Status
      icon_template: mdi:timer-outline
      value_template: >
        {{ is_state('timer.climate_woonkeuken', 'active') }}
      turn_on:
        service: timer.start
        target:
          entity_id: timer.climate_woonkeuken
        data:
          duration: >
            {{ states('input_number.climate_woonkeuken') | float * 3600 }}
      turn_off:
        service: timer.cancel
        target:
          entity_id: timer.climate_woonkeuken

Now it shows as small tip in the slider as .25 hours it would be better if we can change that it for example 01.00, 01.15, 01.45, 45m image

Also i changed the popup to this:

      - type: custom:mod-card
        style: |
          ha-card {
            {% if is_state("climate.bureau", "off")%}
              display: none
            {% endif %}
          }
        card:
          type: entities
          entities:
            - type: custom:slider-entity-row
              entity: input_number.climate_bureau
              hide_state: false
            - entity: switch.climate_bureau
            - entity: timer.climate_bureau

That makes the timer controls disappear wen the HVAC is off

What still needs to be fixed:

  • Showing minutes instead of .25 hours
  • Styling the slider control to something that fits the design
  • If possible, making the helpers autogenerated and the popup universal, we at home have multiple hvac units.

icodesdeveloper avatar Jun 08 '22 21:06 icodesdeveloper

@icodesdeveloper I like your idea of not showing the timer when the AC is off, but I can't stand that it messes up the alignment. Any idea on how to solve that?

Xitro01 avatar Jan 29 '23 14:01 Xitro01