Home Assistant : Q&A, Tips & Tricks, Your Configs

chickenbeef

Executive Member
Joined
Sep 10, 2008
Messages
9,112

Tinuva

The Magician
Joined
Feb 10, 2005
Messages
11,543
Well I think I got the logic right for my very 1st loadshedding slot work-around to....work.

I started with the pool pump, and will later today also do it for some of my other timers like the geysers.

So I have a loadshedding.yaml package with the following:
Code:
input_number:
  loadshedding_stage_eskom:
    name: Eskom Loadshedding Stage
    min: -100
    max: 8
  loadshedding_stage_coct:
    name: CoCT Loadshedding Stage
    min: -100
    max: 8
input_boolean:
  loadshedding_slot_active:
    name: Loadshedding slot active
timer:
  loadshedding_slot:
    duration: '02:35:00'
automation:
  - alias: start_loadshedding_slot_timer
    trigger:
      - platform: state
        entity_id: input_boolean.loadshedding_slot_active
        to: 'on'
      - platform: numeric_state
        entity_id: input_number.loadshedding_stage_coct
        above: 0
    condition:
      # make sure timer not already active
      - condition: state
        entity_id: timer.loadshedding_slot
        state: 'idle'
      # check conditions for both tiggers
      - condition: state
        entity_id: input_boolean.loadshedding_slot_active
        state: 'on'
      - condition: numeric_state
        entity_id: input_number.loadshedding_stage_coct
        above: 0
    action:
      - service: timer.start
        data:
          entity_id: timer.loadshedding_slot

Node-red manages the 3 inputs. Sometimes it gets CoCT's loadshedding level correct, if not it will be the same as eskom. Loadshedding slot active can be used, but my other automations will be based on events from the timer.

Anyways, so here is what my pool pump package look like now:
Code:
input_datetime:
  pool_pump_on_time:
    name: Pool pump on time
    has_date: false
    has_time: true
timer:
  pool_pump:
    name: Pool pump
    duration: '03:00:00'
automation:
  # Pool pump on based on input time
  - alias: Turn on pool pump
    trigger:
      platform: template
      value_template: "{{ states('sensor.time') == (state_attr('input_datetime.pool_pump_on_time', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
    condition:
      - condition: state
        entity_id: timer.loadshedding_slot
        state: 'idle'
    action:
    - service: switch.turn_on
      data:
        entity_id: switch.pool_pump
    - service: timer.start
      data_template:
        entity_id: timer.pool_pump
        duration: >
          {% set day_names = [ 'monday', 'tuesday', 'wednesday','thursday','friday','saturday','sunday'] %}
          {% set today_name = day_names[now().weekday()] %}
          {% if today_name == 'sunday' %}{{ 300 | int * 60 }}
          {% else %}{{ 300 | int * 60 }}{% endif -%}
  # pool pump off when timer finish
  - alias: Turn off pool pump
    trigger:
      - platform: event
        event_type: timer.finished
        event_data:
          entity_id: timer.pool_pump
    action:
      - service: switch.turn_off
        data:
          entity_id: switch.pool_pump

  # Loadshedding work-arounds
  # When in loadshedding, start timer and pause
  - alias: Turn on pool pump timer in loadshedding
    trigger:
      platform: template
      value_template: "{{ states('sensor.time') == (state_attr('input_datetime.pool_pump_on_time', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
    condition:
      - condition: state
        entity_id: timer.loadshedding_slot
        state: 'active'
    action:
    - service: timer.start
      data_template:
        entity_id: timer.pool_pump
        duration: >
          {% set day_names = [ 'monday', 'tuesday', 'wednesday','thursday','friday','saturday','sunday'] %}
          {% set today_name = day_names[now().weekday()] %}
          {% if today_name == 'sunday' %}{{ 300 | int * 60 }}
          {% else %}{{ 300 | int * 60 }}{% endif -%}
    # Waits 1 seconds
    - delay: '00:00:01'
    - service: timer.pause
      data_template:
        entity_id: timer.pool_pump
  # Resume pool pump after loadshedding finished
  - alias: Turn on pool pump after loadshedding slot ended
    trigger:
      - platform: event
        event_type: timer.finished
        event_data:
          entity_id: timer.loadshedding_slot
    condition:
      - condition: state
        entity_id: timer.pool_pump
        state: 'paused'
    action:
      # Starts or restarts a timer with the provided duration. 
      # If no duration is given, it will either restart with its initial 
      # value, or continue a paused timer with the remaining duration.
      - service: timer.start  
        data:
          entity_id: timer.pool_pump
      - service: switch.turn_on
        data:
          entity_id: switch.pool_pump
  # Pause pool pump if loadshedding slot started
  - alias: Pause pool pump if loadshedding slot started
    trigger:
      - platform: event
        event_type: timer.started
        event_data:
          entity_id: timer.loadshedding_slot
    condition:
      - condition: state
        entity_id: timer.pool_pump
        state: 'active'
    action:
      - service: timer.pause
        data:
          entity_id: timer.pool_pump
      - service: switch.turn_off
        data:
          entity_id: switch.pool_pump

Maybe it can help someone else who also needs to do this, or even better yet, tell me how to do it better!
 

markshep

Member
Joined
Jan 16, 2021
Messages
15
I run 4 x voltronic axpert 5kva inverters in parallel. I monitor everything in home assistant. I use grid frequency sensors to trigger automation to kick off power guzzlers (pool pump, dishwasher, tumble dryer etc) to save battery. Works really well.
 

Tinuva

The Magician
Joined
Feb 10, 2005
Messages
11,543
I run 4 x voltronic axpert 5kva inverters in parallel. I monitor everything in home assistant. I use grid frequency sensors to trigger automation to kick off power guzzlers (pool pump, dishwasher, tumble dryer etc) to save battery. Works really well.
CoCT been dragging a long time with my solar application.

But when my inverter is installed I will add more inputs for automations.
 

markshep

Member
Joined
Jan 16, 2021
Messages
15
CoCT been dragging a long time with my solar application.

But when my inverter is installed I will add more inputs for automations.
Every January for the past 6 years I vow this is the year I put up panels and something else ends up taking priority. I'm using utility power to recharge batteries between loadshedding. Which inverter are you going for?
 

Tinuva

The Magician
Joined
Feb 10, 2005
Messages
11,543
Every January for the past 6 years I vow this is the year I put up panels and something else ends up taking priority. I'm using utility power to recharge batteries between loadshedding. Which inverter are you going for?
Settled for the Goodwe GW5048D-ES inverter.

It is more expensive than the axperts but cost less than the ultimate brand which I won't name.
So for me it was the best value for money choice. Also, its on CoCT's list of approved inverters for a solar install. The list is very limited for choices at the time I looked at it.

I convinced my solar installer to install the inverter+batteries next week since I can't live with this loadshedding anymore. He is free to come install the solar panels once the application is approved by CoCT.
 

markshep

Member
Joined
Jan 16, 2021
Messages
15
Settled for the Goodwe GW5048D-ES inverter.

It is more expensive than the axperts but cost less than the ultimate brand which I won't name.
So for me it was the best value for money choice. Also, its on CoCT's list of approved inverters for a solar install. The list is very limited for choices at the time I looked at it.

I convinced my solar installer to install the inverter+batteries next week since I can't live with this loadshedding anymore. He is free to come install the solar panels once the application is approved by CoCT.
Seems like a good choice. The Goodwe. Integrates well into home assistant. My neighbour has one. I'm still not convinced that I need coct approval for off grid PV.
 

Tinuva

The Magician
Joined
Feb 10, 2005
Messages
11,543
Seems like a good choice. The Goodwe. Integrates well into home assistant. My neighbour has one. I'm still not convinced that I need coct approval for off grid PV.
Only if its connected to the grid, even when its not pushing back to the grid. Unfortunately thats the case for me.
 

calypso

Expert Member
Joined
Feb 10, 2009
Messages
1,791
Yip - I have google calendars which I reference in code.

I wrote a SQL script (because I had SQL open) which generates the calendar csv, and them import it into Google.
Is the import manual? I'd like a way to populate with calendar automatically. If Eskom Se P just had an API that spoke to HA I'd pay for that.
 

xrapidx

Honorary Master
Joined
Feb 16, 2007
Messages
39,651
Is the import manual? I'd like a way to populate with calendar automatically. If Eskom Se P just had an API that spoke to HA I'd pay for that.
In to Google Calendar its manual, but I've loaded two years in advance.

It probably wouldn't be diffucult to calculate it in home-assistant as the times are rule based.
 

MidnightZA

Expert Member
Joined
Mar 9, 2013
Messages
2,168
Im trying to update my RPi3 to 2021.1.4, how long does it usually take?

I pressed update about 15 min ago and the Pi stopped showing on my "attached devices" on my router list and I cant access it through the [IP]:8123 or the homeassistant.local:8123. (those where the 2 ways I accessed it earlier today).
 

markshep

Member
Joined
Jan 16, 2021
Messages
15
I had my paradox system and ip150 installed yesterday, so I'm guessing I'm going down that path when I get some time, but I still need to put up my weather station at the new place as well.
Kicked out the DSC Neo for the Paradox SP6000 with IP150. Works brilliantly. Integration into HA was a breeze.
 

ArmatageShanks

Honorary Master
Joined
Nov 3, 2013
Messages
15,297
Im trying to update my RPi3 to 2021.1.4, how long does it usually take?

I pressed update about 15 min ago and the Pi stopped showing on my "attached devices" on my router list and I cant access it through the [IP]:8123 or the homeassistant.local:8123. (those where the 2 ways I accessed it earlier today).

Ehh

I hope its not

1611058247936.png
 

powermzii

Expert Member
Joined
Jun 4, 2007
Messages
4,860
I have a few of the Eachen no neutral switches collecting dust. No way to flash them. Spent days on this and eventually gave up.
Would you be keen to flog them? I'm guessing this is the light wall switches?
 

markshep

Member
Joined
Jan 16, 2021
Messages
15
I just bought a new house and I am not in the mood to pull neutral everywhere. That is why I tried it.

I ordered some more now.
Couldn't flash any of the Eachen light switches. I ended up ordering the Zemismart no neutral switches that were pretty easy to flash with tasmota. They have been running about a year now. No issues.
 

ebendl

Expert Member
Joined
Sep 27, 2004
Messages
4,683
Couldn't flash any of the Eachen light switches. I ended up ordering the Zemismart no neutral switches that were pretty easy to flash with tasmota. They have been running about a year now. No issues.
Where did you buy them?
 
Top