Automate heating connected to solar generation

Hej. So I’m trying to build a automation that if the sun us out and electricity price is above a fixed value, then stop heating and pumping the pool and stop AC for eg 3 hours. the issue is that the automation triggers even if the price value have not been reached (trigger threashold) where is my flaw in my logic? I could also use instead of weather state of coarse say Solar is producing above XX Kw. if that helps.

Attaching code below:

alias: Turn of pool heat and pump if electricity price is high and sun is shining
trigger:
  - platform: numeric_state
    entity_id: sensor.electricity_price_xxx
    above: 1
condition:
  - condition: state
    entity_id: sensor.xxx_weather_condition
    state: sunny
action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.poolpump
        - switch.pool_varmevaxlare
  - delay:
      hours: 3
  - service: switch.turn_on
    data: {}
    target:
      entity_id:
        - switch.poolpump
        - switch.pool_varmevaxlare

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

sorry updated the post to correct format now.