custom-cards / flex-table-card

Highly Flexible Lovelace Card - arbitrary contents/columns/rows, regex matched, perfect to show appdaemon created content and anything breaking out of the entity_id + attributes concept
GNU General Public License v3.0
208 stars 26 forks source link

Request: Manually order entity list #3

Closed cryptooth closed 5 years ago

cryptooth commented 5 years ago

Is it possible to manually set entity order? for example in the order of the list.

daringer commented 5 years ago

Can not really understand what you mean, could you maybe write how you think this might look like in the .yaml configuration.

cryptooth commented 5 years ago

This is my config: (This is a class timetable.)

      - type: custom:flex-table-card 
        title: Dersler
        entities:
          include: 
            - **sensor.birinci_ders**
            - sensor.ikinci_ders
            - sensor.ucuncu_ders
            - **sensor.dorduncu_ders**
            - sensor.besinci_ders
            - sensor.altinci_ders
            - sensor.yedinci_ders
            - sensor.sekizinci_ders
            - sensor.dokuzuncu_ders
        columns:
          - name: Ders
            attr: friendly_name
          - name: Konu
            prop: state

But here is the result:

**dorduncu ders** .....
ikinci ders .....
ucuncu ders .....
**birinci ders**.....
besinci ders .....
altinci ders .....
yedinci ders .....
sekizinci ders .....
dokuzuncu ders .....

Entities are not same order. And there is no any additional/uniqe field for using "sort_by" option.

daringer commented 5 years ago

did you try the following?

- type: custom:flex-table-card 
        title: Dersler
        sort_by: friendly_name
        entities:
          include: 
            - **sensor.birinci_ders**
            - sensor.ikinci_ders
            - sensor.ucuncu_ders
            - **sensor.dorduncu_ders**
            - sensor.besinci_ders
            - sensor.altinci_ders
            - sensor.yedinci_ders
            - sensor.sekizinci_ders
            - sensor.dokuzuncu_ders
        columns:
          - name: Ders
            attr: friendly_name
          - name: Konu
            prop: state

If you did and this did not match your expectations, can you please show for your above example how the right result should look like?

cryptooth commented 5 years ago

Here is the antoher (english) version:

- type: custom:flex-table-card 
        title: Food Menu
        entities:
          include: 
            - sensor.morning
            - sensor.noon
            - sensor.evening
        columns:
          - name: Time
            attr: friendly_name
          - name: Menu
            prop: state

But results is alphabetical:

- sensor.evening
- sensor.morning
- sensor.noon

and expected:

- sensor.morning
- sensor.noon
- sensor.evening

each sensor reading from mySQL database as text (this is daily school menu)

My expectation is, if the sort_by field is not used, the result must be based on the sensor (include) sequence.

daringer commented 5 years ago

uha, this took long until I now finally understand the issue. In fact this just was introduced as a feature in the last commit(s), the regular expressions get stitched together thus any entity matching any of the includes was immediately added to the results.

Obviously this is wrong and as you state, the output order must in any case (without a provided sort_by) be in the order as the include-regex-es are provided.

The commit 57e7aff, which refers to this issue should have resolved it, please re-open if not.

thank you for finding and reporting with so much patience :smile: !