OpenWeatherMap Cloud Coverage sensor + Ecoflow River 2 Max + Shelly Plug - automation

Hi all!
I’m trying to figure out a way to check when it’s sunny or partlycloudy for Shelly Plug which switches AC power off to my Ecoflow River2 Max via AC so that it can charge via solar panels instead and turn on when let’s say battery of Ecoflow River2 max is under 15% and it’s a bad weather, cloudy, rainy, snowing…
Sure, another way would be to install Shelly 1PM Plus on solar panels and monitor the solar power, but I might do that later if this won’t function well…
Problem is that Ecoflow River2 Max can’t simultaneously charge via AC and solar. And I can’t monitor solar power when AC power is on.

Right now this is my config:

alias: forecast solar ON sunny
description: ""
trigger:
  - platform: time_pattern
    minutes: /10
condition: []
action:
  - if:
      - condition: and
        conditions:
          - condition: numeric_state
            entity_id: sensor.openweathermap_cloud_coverage
            above: 0
            below: 70
          - type: is_battery_level
            condition: device
            device_id: someid
            entity_id: sensor.river2max_main_battery_level
            domain: sensor
            above: 16
    then:
      - type: turn_off
        device_id: someid
        entity_id: switch.shellyplug_s_80646f81671a
        domain: switch
    else:
      - type: turn_on
        device_id: someid
        entity_id: switch.shellyplug_s_80646f81671a
        domain: switch
mode: single

Problem is that this automation turns ON shelly for some reason…

Thanks a lot!

What are the states of both sensors? Perhaps they are outside of the limits you set? By the way, you probably do not need above: 0 for the cloud_coverage.

yeah, I removed above:0 and it seems it works now.
Thanks! :slight_smile:

1 Like

Also, any idea how to add checks if weather is sunny, rainy, cloudy?
And is it day or night.
Tnx!

This is really sunset/surise, but you can use

conditions:
  - condition: state
    entity_id: sun.sun
    state: above_horizon  # or below_horizon

Try:

conditions:
  - or:
      - condition: state
        entity_id: weather.openweathermap
        state: sunny
      - condition: state
        entity_id: weather.openweathermap
        state: rainy
      - condition: state
        entity_id: weather.openweathermap
        state: cloudy

But be careful, there are other variants like partly_cloudy etc etc