stephenmhall / PiHeating

python code for Raspberry Pi Heating control
3 stars 2 forks source link

Why like this #6

Open asantaga opened 6 years ago

asantaga commented 6 years ago

Hey Stephen

After a long break I finally got around to forking your code (via twistedsanity) and I have a couple of questions

  1. Why do you generate a static file for the website? The only reason I can think of doing this is to reduce the load on querying the MaxCube, but the code is kinda hard to read. Im not a python programmer (more java/node) but this looks like a strange thing to do.. that said it will perform nicely.. Just wondering why you did it this way

  2. I noticed you store initialization variables AND runtime data in variables.txt.. Why? I would have thought an init.properties file and a seperate runtime data file would be better.. or store it in the local DB... Curious to why

otherwise thanks for the head start!

stephenmhall commented 6 years ago

Hi there, glad someone is still getting good use from this.

The answer to both questions is probably lack of knowledge on my part, I taught myself Python to solve a work problem and went from simple command line data retreival to my MAX Heating system which has to be the most complex code I have written, over a few years. And because I code with my sidekicks google and stackoverflow everything just sort of evolves :) The code I wrote for work was translated from Ruby and it used static file web pages so that is what I knew, I should have used a framework like Django or Flask but never got round to it cos it worked and it was only for myself at the beginning so readability was not an issue. The only thing I can say is I tried to keep the web page creation text in order in the script, so as you move down it should match what ends up on the page.

Odd things like why is the request handler script called webtest.py? Originally it had an actual UI on a small screen but I thought a web interface would be more usefull and did some "testing" and it stuck.

Same with the variables, I had a working store in the variables.txt file so when I needed to add extra stuff it just went in there. In the beginning it wasn't even split up into different Python scripts just one long page of text.

So the code probably evolved to the current state over a year. Untill I got fed up of my MAX cube occasionally wiping all stored valves and thermostats leaving the house freezing on Christmas eve, and got a Honeywell system :)

If you need me to try and explain something feel free to keep messaging.

asantaga commented 6 years ago

Hi Stephen,

Thanks for your response, and nice to know the reasons. I too am a python noob, but Ive done looots of Java,JavaScript etc so im happy with most things..

Ive forked your project (via twistedsanity) as he added some docker container code.. Not sure I'll be using that , I dont think its needed but Im happy to be proven wrong :-)

I plan to deploy the code as is, it works after all, to the boiler sometime this weekend , but I do have a bunch of enhancements I plan to do to the code, (added them as issues on my repo) as reminders..

One question..

Your rules for tuning the boiler on/off depends on

How well did this work in real life?

stephenmhall commented 6 years ago

That is one of the 2 areas where the Max system plus my code is much better than the Honeywell, the fact you can see the exact percentage each radiator is open, and you can see when the boiler is burning. I spent a while watching how the radiators operated and the temperatures in the rooms.

From memory by the time the room was about 1 degree colder than the setpoint the radiators would be down to 60% and with just 1 open there was plenty of risidual heat to get it past the setpoint, so you could shut off the boiler, same with the 2 at 60% the radiators would go to 35% i think at 0.5 deg below setpoint and the risidual heat got it past. In the summer, Scotland that is so 18deg is very warm :) some days the boiler would only be on twice, first from 6am to about 9am to get the bedrooms and living room up to temp then it would be off all day untill it was time to heat up the bedrooms again for going to bed. maybe there would be some 15 minute bursts just to edge it back up past the setpoints. I had the temps set between 24 and 17, old folks in the house so needs to be quite toasty.

I had MAX radiators in 2 upstairs bedrooms and the bathroom and 3 radiators downstairs where it is sort of 3 rooms but not divided by doors, so the middle and the extension room were treated as one by the system and the other room was on its own. Most of the day the oldies were in the Extension connected to the dining room and then moved to the other end at about 10pm to watch the big telly, so through the day I was only heating the 2 combined rooms then switched to heating the telly room and the bedrooms at 9:30 ish.

Hope that helps, There is some trial and error and observation to find the best settings, thats why I put them in the settings webpage so they are easily changed.

It will be interesting to see what you do with the code

asantaga commented 6 years ago

thanks,

The last one I didnt twig until later, ie "total sum of open valve % > 120%", I thought it was sum of "radiators" , ie 5/10 radiators and was puzzled to see numbers of 8 !

As for controlling the boiler I've wired it all up to an old PI B (v1), and a couple of LEDs.. And it works nicely.

(see image https://photos.app.goo.gl/u9domRHr618rBf3d2)

Ive created a list of issues in my repo, if you can have a quick glance and pass any comments that would be good.

Finally, I bought a 10A relay board from amazon, uk seller but it ended up coming from China :-( but it looks ok.. From my plumber he recommended turning the boiler on/off via the motorized valve.. Given the entire circuit is on a 3A fuse Im guessing at most there will be 1A@240VAC passing there.. so even if the chinese skimped its overrate.. Any advice here?

twistedsanity commented 6 years ago

Mine is very wip so please beware, although have it currently running in docker quite nicely, which for my purposes is very handy.

On 25 Jan 2018 13:09, "Angelo" notifications@github.com wrote:

Hi Stephen,

Thanks for your response, and nice to know the reasons. I too am a python noob, but Ive done looots of Java,JavaScript etc so im happy with most things..

Ive forked your project (via twistedsanity) as he added some docker container code.. Not sure I'll be using that , I dont think its needed but Im happy to be proven wrong :-)

I plan to deploy the code as is, it works after all, to the boiler sometime this weekend , but I do have a bunch of enhancements I plan to do to the code, (added them as issues on my repo) as reminders..

One question..

Your rules for tuning the boiler on/off depends on

  • 1 Radiator must be > 78%
  • 2 Radiators must be > 60% or total sum of open valve % > 120%

How well did this work in real life?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stephenmhall/PiHeating/issues/6#issuecomment-360461571, or mute the thread https://github.com/notifications/unsubscribe-auth/AEAoytaW6rjvvQX3SPRtsKN5eVA-xRKlks5tOHyjgaJpZM4RpbmM .