Plex on temporary available host

I’ve installed plex on desktop computer which runs only few hours daily. After that is off.
In logs of HA ive got constantly Errors:

Could not connect to plex server at http://192.168.1.40:32400 (HTTPConnectionPool(host=‘192.168.1.40’, port=32400): Max retries exceeded with url: /clients (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x6e930b30>: Failed to establish a new connection: [Errno 113] Host is unreachable’,)))
07:27 components/media_player/plex.py (ERROR)

Is it possible to connect with plex only if host 192.168.1.40 is running? I have sensor which shows me state of this computer.

switch:
  - platform: wake_on_lan    
    mac_address: "XXXXXXXXXX"
    name: "Komputer-w-salonie"
    host: 192.168.1.40
    turn_off:
        service: hassio.addon_stdin
        data:
            addon: core_rpc_shutdown
            input: Komputer-w-salonie

Hi,

Did you find a solution for this, my log show the same errors ?