Help with automation (new guy)

looking for assistance here.
Intention is:
I want spa to switch on when: solar production is above 4kw and HWS is off.
Conditions: switch off again if HWS is on or solar drops below 4kw.

Current Yaml:

trigger: numeric_state
entity_id:
sensor.alphaess_current_pv_production
above: 4000
conditions:
condition: device
type: is_off
device_id: 6d750978e86e459f07131a2b8c9bbe36
entity_id: bfe30b6173fe0020b3d640a90ad4b0ab
domain: switch
actions:
action: switch.turn_on
metadata: {}
data: {}
target:
device_id: a2424ee51dacd428b9c88787d71b5d9f
mode: single

thanks for your help in advance

Please format your code correct.

f6be36681e0da431418ec7781fb6c62712941803

1 Like

Not sure what you mean by this - can’t see any switch off action (@francisp is right, it’s hard to follow unless the code is formatted properly).

In any event, switching off would not be a condition, it would be another action with its own trigger. If you’re just starting out, the easiest way to achieve this is to have two automations, one to switch on the spa and another to switch off. Once you get that working you can look at combining them if you still want to. :grin:

2 Likes

I use this (works perfectly)