Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

home automation

Off-Topic discussions about science, technology, and non Debian specific topics.
Post Reply
Message
Author
Stian1979
Posts: 316
Joined: 2007-07-29 14:57

home automation

#1 Post by Stian1979 »

Im in the process to get some kinda smart management of my central heating.
I wish to fetch a list of spot prices of electrical power of the internet and fetch weather data and use this to estimate if I need to use electricity to heat up the water if the forcast dont show promisse of sunshine and try to boost the temperature when tje electricity is at it's chapest.
Im kinda curious what I should be running to do this.
Not planing a smart house thing, but a standalone energy management that controlls available energy.
Image
Debian Bullseye

arzgi
Posts: 1194
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: home automation

#2 Post by arzgi »

Obvious you need some scrictping to do that automation part. Also you have to check how elctricity is connected to your boiler, where would it be easiest to connect. Perhaps there are some wires you can utilize.

If you have programming experience, you probably have idea where to start. If not, i'd recommend python. It has libraries for many use, for example receiving data from net (urllib). And quite easy to learn the basics.

Closest what I have done is a python script that controls room air humidifier, and also measures the mold moisture of plants. Raspberry PI runs it, I have optically isolated relay to control the humidifier.

CwF
Global Moderator
Global Moderator
Posts: 2680
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: home automation

#3 Post by CwF »

Cool. I've been close to these things, a few projects in the past and a few ongoing. I still have moved none of it onto anything debian.

Anyway, there are gotchas. Look into using a 'vote' logic. This works best when there are more choices than you're considering maybe, like two power sources. Voting logic allows you to add intelligence and fudge factors like "I'm home" +1 vote. Avoid exact point choices, ie on/off at a set point, this can lead to 'hunting'. Also avoid indirect measure, like an internet source, it's unreliable.

Also, always consider the time lag. If you heat up the water on cheap power, how much dissipates until actual use. I've done heat/cooling load calculations to spec hvac (degree'd and 2 decades removed). The specifics you need to know for your central air are the coasting characteristics of the building, it's thermal mass, its air exchanges etc. For example if the house is concrete stucco like mine may have a maximum coast of close to twelve hours, a stick (wood) construction might coast for 4 hours,. Translated, the exterior temp effect is variable to construction type.

arzgi
Posts: 1194
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: home automation

#4 Post by arzgi »

Good points, but where would you get weather forecasts or electricity prices if not from the net?

Stian1979
Posts: 316
Joined: 2007-07-29 14:57

Re: home automation

#5 Post by Stian1979 »

Weatherforcast for the next 12-24 hours are quite "reliable"
I have a 250litre accumulator tank for heat storage for the central heating.
I wish to uae weather forcast to predict next days heat production from evacuated tubes.
Hours dayligh*temperature as analog values and with clouds as correction factors.
I get the spot kWh prices for the whole day from my electricity provider 14:00 hours the day before they take effect.
I could then estimate if i need some heat stored for early morning use or if production wont be enough.
The 6kW heating element has a input i had to latch to make it work so this can be removed to instead be controlled by an relay.
Simply using some wago or phoenix io modules. Get it to work trough modbus tcp/ip
I have experience with simens logo and some C in microcontrollers. Made a rotating encoder LED dimmer with an atmel once, buy thats the most advanced i ever did.
I have it quite clear how i want it to work, but getting the data, store it and use it is in this case alien to me. Absolutely way into deep water if I where to do it in C.
Thinking of something debian since im likely to find the packages I need.
Only problem is I got no idea what i need.
Image
Debian Bullseye

CwF
Global Moderator
Global Moderator
Posts: 2680
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: home automation

#6 Post by CwF »

yes, I understand common sense of the forecast, but I'm hedging on experience that you'll find it's close to irrelevant. There is a hell of lot more granularity needed. The forecast , and price, would need good error handling for out of bounds values. 24/7/365 at some point external data could be off or wrong so an error prone dependency. For price, I didn't think it varied beyond a published schedule?

The coasting characteristic means a local external measured temp will affect the interior in the future, hours or more away. So peak energy usage to correct isn't needed immediately upon measure, but coming up. In a way a local temp IS the forecast. A weather forecast doesn't have that detail. Personally, I wouldn't include it at all, just use local measure.

In some places the bill can be based on peak AmpHour usage and not total usage, more an industrial billing method. In those cases the logic includes a cap, so the AC needs to know the dishwasher is running...

arzgi
Posts: 1194
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: home automation

#7 Post by arzgi »

You have to some searching on your own. The microcontroller you have might be used, if you get the altering data to control it.

If used pymcu controller, but it's been sold out for years. Comparable to it for example https://www.tindie.com/products/loglow/ ... rod_search which can be programmed in many languages.

My knowledge of C is so light, I can't explain how to read data from net. Google may help, or wait if some with deeper knowledge responds.

CwF
Global Moderator
Global Moderator
Posts: 2680
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: home automation

#8 Post by CwF »

Stian1979 wrote:I have a 250litre accumulator tank for heat storage for the central heating.
I wish to uae weather forcast to predict next days heat production from evacuated tubes.
I cross posted and missed this, Ok I do understand then. It is relevant in your case to 'guess' ahead of any built in coasting. Really the coasting is the same idea, you are just adding extra storage. I have read up on an australian example storing sun heat for months. Yep, It's going to get complicated!

Don't have anything to add, I'll be listening for your solutions. As I said, I've yet to move anything like this to a debian based solution.

arzgi
Posts: 1194
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: home automation

#9 Post by arzgi »

Stian1979 wrote: Thinking of something debian since im likely to find the packages I need.
What I and CwF have written indicates you hardly find any package to do all that's required.

CwF
Global Moderator
Global Moderator
Posts: 2680
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: home automation

#10 Post by CwF »

maybe MPLAB -X

Stian1979
Posts: 316
Joined: 2007-07-29 14:57

Re: home automation

#11 Post by Stian1979 »

arzgi wrote:
Stian1979 wrote: Thinking of something debian since im likely to find the packages I need.
What I and CwF have written indicates you hardly find any package to do all that's required.

I don't expect something finished, but some librarys that let me use modbus to control IO's, read weatherdata and fetch the electricity prices of the net and atore in a CSV file.
Then some program would need to read the content in the CSV and write comands to the IO according to the logic.
I'm having an off the shelf xcomfort system that use local outside temperature and control the rooms according to demand. Not planing to tey imtegrate them into eachother.
Electricity prices
https://www.nordpoolgroup.com/Market-da ... view=table
Image
Debian Bullseye

Stian1979
Posts: 316
Joined: 2007-07-29 14:57

Re: home automation

#12 Post by Stian1979 »

CwF wrote:
Stian1979 wrote:I have a 250litre accumulator tank for heat storage for the central heating.
I wish to uae weather forcast to predict next days heat production from evacuated tubes.
I cross posted and missed this, Ok I do understand then. It is relevant in your case to 'guess' ahead of any built in coasting. Really the coasting is the same idea, you are just adding extra storage. I have read up on an australian example storing sun heat for months. Yep, It's going to get complicated!

Don't have anything to add, I'll be listening for your solutions. As I said, I've yet to move anything like this to a debian based solution.
I'm not storing for days. I expect only to top up for the first few hours of the day.
Not even having a sulution :(
Image
Debian Bullseye

trinidad
Posts: 297
Joined: 2016-08-04 14:58
Been thanked: 15 times

Re: home automation

#13 Post by trinidad »

To do what you are describing Numerical Control code (like M or G code) would be the easiest to work with once your instrumentation is qualified within it. Control Activity could then be tied to the data sources.

TC
You can't believe your eyes if your imagination is out of focus.

arzgi
Posts: 1194
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: home automation

#14 Post by arzgi »

There is libmodbus in Debian repos, don't know other than name of it.

You need anyhow some I/O card, I don't know if linux kernel supports any, or some microcontroller to drive electricity on. PC can not do it on its own.

To read values from net, you can use Debian, there are many options, but all I know require at least some programming.

Stian1979
Posts: 316
Joined: 2007-07-29 14:57

Re: home automation

#15 Post by Stian1979 »

arzgi wrote:Obvious you need some scrictping to do that automation part. Also you have to check how elctricity is connected to your boiler, where would it be easiest to connect. Perhaps there are some wires you can utilize.

If you have programming experience, you probably have idea where to start. If not, i'd recommend python. It has libraries for many use, for example receiving data from net (urllib). And quite easy to learn the basics.

Closest what I have done is a python script that controls room air humidifier, and also measures the mold moisture of plants. Raspberry PI runs it, I have optically isolated relay to control the humidifier.
I been looking on phyton. Actualy someone else has taken the trouble to fetch electricity prices of nordpools page.
Weatherdata is also done. Seams the bigest problem will be learning phyton.
Image
Debian Bullseye

Stian1979
Posts: 316
Joined: 2007-07-29 14:57

Re: home automation

#16 Post by Stian1979 »

arzgi wrote:There is libmodbus in Debian repos, don't know other than name of it.

You need anyhow some I/O card, I don't know if linux kernel supports any, or some microcontroller to drive electricity on. PC can not do it on its own.

To read values from net, you can use Debian, there are many options, but all I know require at least some programming.
Dont need linux suport for the IO card if it uses modbus. Modbus tcp uses standard cat cable.
So I just need an ethermet port and a IO module with a rj45 port that suports modbus ower ethernet.
So instal the librarys for modbus and learn to write modbus comands from phyton .
For me the hardware part is the easy part as I been in the automation field as service tech, but newer been this deep into the software part. Used to work with preconfigured systems.
Image
Debian Bullseye

arzgi
Posts: 1194
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: home automation

#17 Post by arzgi »

Thanks for clarifying. My knowing of modbus is from one course studied many years ago :o

One possible solution, requires some handwork, but the idea is that you can make a bash script after tuning.

Code: Select all

 # apt install wget html2text
Make some dir to your /home or to /tmp, change to it.

wget was easy to use years ago, but now most web pages use JavaScript, to tackle this, you need these options

Code: Select all

wget \
     --recursive \
     --no-clobber \
     --page-requisites \
     --html-extension \
     --convert-links \
     --restrict-file-names=windows \
     --domains example.com \
        www.example.com
Note the two last lines, includes web address and domain, which you have to change. This could also made to script, which could take web address as an option, I think you don't need many pages.

Locate the *.html file wget created, in this case to /tmp || ~/http://www.example.com dir. Just for example, i use here file.html

Code: Select all

htlm2text -o some_file  file.html
Now you need to extract the needed info from some_file. Use grep, cut, whatever standard tools.Rest depends what you want do with that info, save it to file or smth else.

arzgi
Posts: 1194
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: home automation

#18 Post by arzgi »

libmodbus5 is a C-library, you need to compile two short programs, one to pull the relay, other to reset.

https://www.libmodbus.org/documentation/

Seems quite understandable. You can call C-programs from bash script.

Post Reply