Chips : aircon unit counter / status

Hi all - sorry a newbie question here. I have created an HA dashboard for my iPhone and set up a chip at the top of the screen showing how many lights are currently on. This works great. I attempted to do the same for Climate / Aircon but clearly something is wrong. I have added the following into configuration.yaml:
template:

  • sensor:
    • name: “Total aircon Count Template”
      state: “{{ states.climate | rejectattr(‘attributes.entity_id’, ‘defined’) | selectattr(‘state’, ‘eq’, ‘on’) | list | count }}”

Its identical code to the ‘lights’ counter - just replaced ‘light’ with ‘climate’.

Any help would be much appreciated. If it adds any value they are Daikin units.