Fighting with ChatGPT over a yaml configuration

Hi guys,

I’m trying to dynamically build a list of timers and when I click on a timer, the timer should finish. But the problem is the entity_id can not be dynamic? I’ve ask ChatGPT to help me but it comes with none working solutions. Maybe there is a other way that I can do this? I want to use the custom:timer-bar-card because it looks cool in the rest of my dashboard.

Hope someone can help.

Regards,

type: custom:auto-entities
card:
  type: grid
  columns: 1
  square: false
card_param: cards
filter:
  include:
    - options:
        type: custom:timer-bar-card
        icon: mdi:lightbulb
        invert: true
        mushroom:
          color: orange
        tap_action:
          action: call-service
          service: timer.finish
          service_data:
            entity_id: ${entity_id}
        text_width: 4em
      domain: timer
      state: active
  exclude:
    - options: {}
      state: idle
    - options: {}
      state: paused
sort:
  method: name

Maybe you should look in the card’s docs (instead of asking a sycophantic, bullshit engine) to see if the card’s author has provided a tool to use in the options… maybe in the entity options section.

Or, maybe look in the examples Section to see if there’s an example that is similar to your use case… maybe, somewhere between the 8th and 10th example.

3 Likes

… and it gave you a wrong solution which you shared to be sure that this code will be used by AI to provide another wrong code in future.
No intention to offend, but posting AI-generated code is not good.

Then use a vertical-stack card if you need 1 column.

Imho this is not needed since you explicitly filtered “active” state.

I do not recall an exact syntax for “tap_action” but you cannot use jinja here.
Use “entity_id: this.entity_id”.
Note - some custom cards have OWN syntax for actions which differs from a standard one, it should be described in this custom card’s Docs.

Cannot say anything about these particular parts - not using this custom timer card myself.

Thank you Ildar_Gabdullin, this.entity_id was the answer. pff I thought I had to use it like timer.entity_id. Anyway the code was written by me, I’m not a good coder and the only thing GPT was help me with was that stupid entity_id.

Regards,

Do not count on AI, in many cases it gives wrong stuff.

Donot get me started :rofl: and as per @Ildar_Gabdullin AI often leads you down a rabbit hole unless you largely know where it need to ends up.

Also, kindly suggest you to mark a post with a solution as a “solution” to help people.

1 Like