markgdev / home-assistant_OctopusAgile

Octopus Agile custom component for Home Assistant
Apache License 2.0
89 stars 32 forks source link

Disable entities being turned off at half hour markers #84

Closed GrandadEvans closed 2 years ago

GrandadEvans commented 3 years ago

I'm not sure whether this is covered by one of the other features such as the octopusagile.timers, but it would be great if there was a way to disable the entities eg octopusagile.dishwasher

Sometimes we need to put an entity on during the day such as the washing machine or the dishwasher. This means that my wife has to bug me to sort it - I then have to go into Integrations and disable the entity itself, say from TP-Link Integration for the HS-110 TP-Link KASA smart plug. Often I just forget and then I get told off when it goes off at the next half-hour marker. It's even worse, if nobody realises until several hours later. In that case, my life is made a living Hell for the rest of the day.

It would be great if there was a switch that I could have on the dashboard, that simply disables the octopusagile.??? entity being turned off on the half-hour markers.

Again: I'm not sure if it's my fault, and I don't understand the concept of the octopusagile timers properly, and this is something that they are meant to address.

I understand that this means that the entity will also not be turned off after the process finishes (ie dishwasher finishes), but this is also something that I have also looked into. I can't remember why I did it, but I cloned the repo several months ago, in order to achieve this & never got around to it. I also cannot remember why I wanted the feature at the time :-/

Many thanks for your hard and continuing work, and I welcome any way in which I can help you help me. John

GGW42 commented 3 years ago

I might be able to help you with this. The following is what I do with my Dishwasher and Washing Machine in home assistant + Octopus Agile. I use an Input Boolean as a master enable switch for both of these automations, and the Automation turns its own switch off, at the end so it isn't possible to accidentally wash the dishes twice.

I have deliberately stuck to just the Home Assistant Automation Wizard and a couple of input booleans. No YAML was required thought that might have made a few things a bit more logical.

The Octopus agile settings I use are these.

  run_devices:
  - energy_time: 0.5        #Max Energy usage time
    entity_id: dish_washer
    run_before: '08:00:00'
    run_time: 2.5           #total run time

 - energy_time: 0.5        #Max Energy usage time
    entity_id: washing_machine
    run_before: '08:00:00'
    run_time: 2.5         #total run time

image This is an image of my Dashboard for these settings. The Yellow Icon is the Dishwasher Input boolean enabled, waiting for the timeout at 03:30 in the morning <Daylight saving time, as shown on the middle icon in Zulu time> The Dishwasher and Washing machine are actually unavailable here, as they are off at the Switch on the wall, in my case they couldn't actually run unless they say "OFF".

Automation Dishwasher Timer (Mode:single)

TRIGGER
Triggered by Numeric State of “octopusagile.dish_washer”
Attribute “Start in” below 0.5

This is a limitation of the Automation wizard, only above or below is available as an option but that is ok since only “0” is below “0.5” so it triggers when expected. YAML could make this better.

Conditions
    State of “input_boolean.enable_dishwasher_timer” is “ON”

So only runs if the Input Boolean is turned on by you! Will try all other times and fail.

ACTIONS
    Action Type Device “Dish_Washer” “Turn on Dish Washer”
    Action Type Delay 02:28:00:000
    Action Type Device “Dish_Washer” “Turn off Dish Washer”
    Action Type Call Service “input_boolean.turn_off” “Dishwasher Timer”

So briefly, 4 separate actions here:- This turns on the Dishwasher Hardware switch. Followed by an admittedly long delay, but it doesn’t matter, the longer cycles take more time than the normal one I use and since the Automation is in Mode Single is can only run once anyway, I set this to roughly match the runtime. Then turns the Dishwasher Hardware switch off. Finally it turns off the Input Boolean "Dishwasher Timer" that you turned on to allow it to run in the first place.

Full YAML verson of the automation I use, in case something is not clear or I have missed something out, the ID's only apply to my system, as do the names but this might help.

id: '1616704387739'
alias: Dishwasher Timer
description: Activate Dishwasher via < octopusagile.dish_washer >
trigger:
  - platform: numeric_state
    entity_id: octopusagile.dish_washer
    attribute: start_in
    below: '0.5'
    for: '00:00:05'
condition:
  - condition: state
    entity_id: input_boolean.enable_dishwasher_timer
    state: 'on'
action:
  - type: turn_on
    device_id: 73d3f67d0564c5738c5d569952eaadc7
    entity_id: switch.dish_washer
    domain: switch
  - delay:
      hours: 2
      minutes: 28
      seconds: 0
      milliseconds: 0
  - type: turn_off
    device_id: 73d3f67d0564c5738c5d569952eaadc7
    entity_id: switch.dish_washer
    domain: switch
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.enable_dishwasher_timer
mode: single

Hope you find this useful.

GrandadEvans commented 2 years ago

Sorry, I didn't see that you'd replied. That is a great way of doing it, and one that I have been implementing over the past 15 minutes or so, thanks again for your great work. John

GGW42 commented 2 years ago

I had forgotten about this, it is several months ago now. Glad you liked it, it has been working well for me for about 18months or more.