Filter ping on 30 seconds active time

Dear HA community,

I monitor the kids playtime on PS5 by pinging this device (only answering when it is on). With the following config I can measure how long playstation has been online (‘binary_sensor.ps5_state’ is the ping device):

- platform: history_stats #PS5 ping oplossing
    name: PS5_play_time_today
    entity_id: binary_sensor.ps5_state
    state: 'on'
    type: time
    start: '{{ now().replace(hour=5, minute=0, second=0) }}'
    end: '{{ now() }}'

Resulting in this entity on my dashboard
image

Now I want to do the same for the Nintendo Switch. This device however does also respond to the ping command when not turned on: Every hour it comes online for about 30 seconds:
image

My question: can I filter these 30 seconds somehow?
I’ve checked the HA Filter or Threshold helpers both do not help in this situation

1 Like

You can use sql to get state and filter if state is under 30 sec. if you filter them then device show only when it is off.