Sonoof Integration with Home Assistant

Hi, I’m new using Home Assistant.
I try to make Automation for turn on and turn off Sonoff POWR316 using time triggered. I use Sonoff POWR316 to monitor and control AC.
The scenario are: Sonoff will turn on at 8.00 AM and off on 8.00 PM, so the AC can only on bettwen 8.00 AM - 8.00 PM
Time triggered work well. But the problem came the next day. Sonoff didn’t turn on but when I check log history at HA, the time trigged was active. Is there any configuration did I miss?

Did you look at the traces of the automation?
How does it look like?

This is when they triggered:
Triggered

Look at the traces of the automation, like this for one of mine

Here is mine:

What if you click on the orange node? what do you see?

Here is:

Do you realise that this is a turn_off and it is from 8pm?
I mean, here, in Belgium, it is 10am already, but it seems to me that there is nothing triggering the turn_on or is it another automation?

Yes, I made separated automation to turn on and turn off. Previous screenshot is traces from yesterday. Here is traces from today:

- alias: Turn On/Off Lt.1
  trigger:
  - platform: time_pattern
    hours: '20'
    minutes: '0'
    seconds: '0'
    id: evening
    alias: In the evening
  - platform: time_pattern
    hours: '8'
    minutes: '0'
    seconds: '0'
    id: morning
    alias: In the morning
  condition: []
  action:
  - if:
    - condition: trigger
      id: evening
    then:
    - service: switch.turn_off
      data: {}
      target:
        entity_id: switch.sonoff_10017e8d4e_1
  - if:
    - condition: trigger
      id: morning
    then:
    - service: switch.turn_on
      data: {}
      target:
        entity_id: switch.sonoff_10017e8d4e_1
  mode: single

EDIT replaced [] with {} for data, my eyes are bad :smiley:

Have a look at my automation above to merge the 2 (made in the editor, might need some debug).
In your screenshot, it seems that it is not the latest execution, is it?

I tried your code, but there show problem.

Yes, my last screenshot is not my last execution

Yes, my bad, edited, it is {}, not []

Ok, thank you. I’ve tried your code in short time duration and it work.
I will tried in long time duration I will give you an update tomorrow.

Update:
It works well, thank you Oliver

1 Like