Panasonic Viera does not execute turn_on_action - Greyed out when off

I have an old Panasonic Viera TV that can be controlled (including turning it off) as long as it is turned on. If it is not turned on, the entity/device is not available and thus the UI element is greyed out.

I am able to turn the TV on with an IR command. I have added a script that does this so HA can turn on the TV without a problem.

I have added the script to the manual configuration for the TV like this:

  name: Panasonic
  - service: script.tv_an
    data: {}

Executing this turn_on_action via the developer tools (execute service) also works.

How can I change the state of the device so that it is “turned off” instead of “not available” and then (hopefully) executes the turn_on_action?

Cheers, Joe