##################################################
## Components/Sensors
##################################################
cover:
  - platform: mqtt
    name: "PetDoor"
    command_topic: "homeassistant/cover/petdoor/set"
    state_topic: "homeassistant/cover/petdoor/state"
    availability:
      - topic: "homeassistant/cover/petdoor/availability"
    retain: false

sensor:
  - platform: history_stats
    name: PetDoor opened today count
    entity_id: cover.petdoor
    type: count
    state: 'open'
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

##################################################
## Components/Sensors
##################################################
mqtt: 
  cover:
    name: "PetDoor"
    command_topic: "homeassistant/cover/petdoor/set"
    state_topic: "homeassistant/cover/petdoor/state"
    availability:
      - topic: "homeassistant/cover/petdoor/availability"
    retain: false

sensor:
  - platform: history_stats
    name: PetDoor opened today count
    entity_id: cover.petdoor
    type: count
    state: 'open'
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

Update mqtt sensor definition, change in HA 2022.6
Update mqtt sensor definition, change in HA 2022.6
