Custom button card : action depending on state

Because you’re not following the Readme. Tap_action doesn’t go under state, it goes directly under the card (like state, name, entity). Tap_action is not an option within state.

Follow the Readme on Github and copy/paste the examples and alter them to your own needs. In your case you should either use toggle as action (if climate supports that) or use a template like explained there.

Also, it’s easier to ask for help in a thread dedicated to this card that has already over 6000 replies, than creating your own. You can search withing that thread and most likely have answers to a lot of questions: