markgdev / home-assistant_OctopusAgile

Octopus Agile custom component for Home Assistant
Apache License 2.0
86 stars 33 forks source link

Instructions missing information #18

Closed gck303 closed 3 years ago

gck303 commented 4 years ago

Firstly, what a superb piece of code. I can see that there is an open issue with needing to add the serial number, MPN etc. I hit this issue and got it working.

How do I connect the new octpous.hotwater entity to an automation, which will turn on the actual device? The instructions are missing this bit of info. Sorry if it obvious, or something I should already know. Eg, does the enity get set with a 'on'/'off' state as the octopus plugin changes the devices status according to the time rules?

I don't and am stuck! A bit of extra info in the instructions would be very helpful.

Thanks, George

octopusagile.octopushotwater 2020-06-07T03:30:00Z start_time: 2020-06-07T03:30:00Z start_in: 8 end_in: 9 rate: 2.4255

markgdev commented 4 years ago

Hi George,

It looks like you’ve setup your hot water under run_devices? I haven’t set them up for automation so far, I’ve been using them as indicators for the best time to run things like the dishwasher or washing machine which for me are manual.

I think the “timers” are what you’re looking for, you give the entity name and a few details like how many slots you want it in for and it’ll run the home assistant.turn_on/off service for that entity at the cheapest times. There is an example in the readme, where I run my water heater for 5 hours each day and it has to run for at least an hour overnight and another hour during the day which is specified in the requirements. If you just want it to run at the cheapest possible time then leave the requirements empty. The timers get stored in octopusagile.timers when the update_timers service runs (at 1900 each day) and then each half hour the half_hour service runs and decides what to turn on/off.

Currently there is no way to ask timers for a block of time in one go but I have an issue open for that, just need to find the time to implement it.

I hope that helps? I will admit that I’m not the best at documentation, things make much more sense in my head than they do on paper so if you have any ideas on how I can improve it please feel free to either update it yourself or let me know!

Cheers, Mark

gck303 commented 4 years ago

We have an ASHP, which runs for about 50 minutes. The way the heat pump works is that you actually need it for a full 1 hour block of time as it spends the first 10 minutes of a heating cycle actually turning on and getting the system running and upto full output. It is not at all like an immersion heater which is upto power in an instant.

What it also needs is an adjustment factor to take into account the cooling of a hot water tank. Each hour it is warm it looses c. 5% of its energy (should be configurable). So, the cost of the energy is not quite simply the hourly cost. You need to consider when it is needed, multiplied it by 1.05^number of hours. For example, if you want it at 9am, then you need 1.05 units @ 8am, 1.1025 @ 7am, 1.157625 @ 6am, 1.2155 @ 5am etc.

I also need the large block of time to charge an EV. The car charger rather crudely turns on/off using a contactor and Sonoff lightswitch. And the car does not like being turned on/off mid-charging without any warning. Ideally here I would have some way of integrating the amount of charge needed (which is already in HA) and adjusting the number of hours needed.

markgdev commented 4 years ago

Ok so adding blocks of time to the timers is what you need for sure.

For the EV I think maybe a service to request a new timer to be created in the same way that they get created from the config yaml but with the yaml passed to the service, then you could call that at whatever time you wanted to make the decision over how long you needed, what do you think?

The heat pump might work the same way possibly? Or maybe just need the block of time? I’m quite interested in this as have been thinking of getting one. Is the extra calculation because the tank is smaller than what I have with an immersion? We have a 250l tank at the moment, and don’t tend to worry about heat loss. I can’t quite get my head around how to take that into account at the moment...

gck303 commented 4 years ago

Sounds about right. My knowledge of HA is not quite there to confirm one way or the other, though.

We heat a 250L tank to 48 degrees. But, the tank is horizontally in a loft, which increases the heat loss. The reason for having the tank so cool are multiple:

markgdev commented 3 years ago

I think this is covered by #1, going to close to clean up but link back to as there is some really useful info in here to help determine how that works.