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

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: 1197
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 32 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: 1197
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 32 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