logbook-card icon indicating copy to clipboard operation
logbook-card copied to clipboard

Remove duplicates in multiple logbook card

Open Kanecaine opened this issue 1 year ago • 4 comments

Describe the bug The feature described here

https://github.com/royto/logbook-card/issues/8#issue-517587134

doesnt work in multiple logbook card. I wanted to see a logbook for my window sensors and want to show when they have been open.

Expected behavior No duplicate entries.

Screenshots IMG_0433

Environment (please complete the following information):

  • HA Version: 2024.3.3
  • Browser: Safari, iPad, latest iOS
  • Card version: 2.5.5

Card configuration


type: custom:multiple-logbook-card
desc: true
entities:
  - entity: binary_sensor.alle_fenster
    hidden_state:
      - unavailable
      - 'on'
    state_map:
      - label: geschlossen
        value: 'off'
  - entity: binary_sensor.fenster_bad
    hidden_state:
      - unavailable
      - 'off'
    state_map:
      - label: geöffnet
        value: 'on'
  - entity: binary_sensor.terrassentur
    hidden_state:
      - unavailable
      - 'off'
    state_map:
      - label: geöffnet
        value: 'on'
  - entity: binary_sensor.fenster_wohnen_links
    hidden_state:
      - unavailable
      - 'off'
    state_map:
      - label: geöffnet
        value: 'on'
title: Fenster
collapse: 1
show:
  end_date: false
  start_date: true
group_by_day: true
scroll: true
minimal_duration: 90

Additional context I used the logbook card for multiple entities and added each window sensor with a state filter for „unavailable“ and „off“ - for showing only when they are open. Additionally i added a „all windows closed“ sensor with a state filter for „on“ - for showing only when all windows are closed. I turned on the group-by-day function.

Kanecaine avatar Apr 01 '24 15:04 Kanecaine

I suppose it is the minimal_duration option. It filters out when a window is only opened for a short time. At least in one case it is the reason for duplicate entries in my config.

Kanecaine avatar Apr 01 '24 15:04 Kanecaine

Can you provide the full history (without hidden states) and provide the history you want to be displayed based on your configuration?

Is it working with non multiple card ?

royto avatar Apr 03 '24 20:04 royto

Hi, thanks for your reply. I found an explanation for the 2 „alle Fenster geschlossen“ at 21:29 on March, 31. I simply missed too add all window sensors. So between these to „closed“ events, there have been another “opened“ event. After adding the missing sensor, the history shows right.

With all filters removed i scrolled to the same date/time (2 cards, first one with filters, second one without):

IMG_0435

The two „Terrassentür geöffnet“ events at 14:28 on April, 1st: between them is a „Terrassentür geschlossen“ event which i filtered out. So maybe your card does all right - i don’t know what it should show in that case. Combining the two „open“ events would not be right. So if i filter out the „closed“ event it shows right in history, isn‘t it?

Kanecaine avatar Apr 03 '24 21:04 Kanecaine

Yes, to me the behaviour is correct and squashing the 2 open state will lead to a invalid state ...

If OK for you, you can close the issue

royto avatar Apr 07 '24 18:04 royto

@Kanecaine can we close the issue ?

royto avatar May 01 '24 20:05 royto

Hi @royto, yes it works as aspected now. This can be closed. Sorry, for my late response and thanks for your support.

Kanecaine avatar May 01 '24 21:05 Kanecaine