News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu

1wire support

Started by hari, January 19, 2011, 11:12:15 AM

Previous topic - Next topic

hari

Hi Folks,

I did write a DCE device for the owfs 1wire driver. Device Template #2161. The code is here: http://svn.linuxmce.org/trac.cgi/browser/branches/LinuxMCE-0810/src/OneWire/

Just create "Multilevel Sensor" Childs and put the 1wire ID into the port/channel field. The DCE device will store the last measurement and only send events when things have changed. Only temperature sensors supported atm:

35   01/19/11 11:11:30.628      Temperature for 28.B3795602000: 25.62 <0xb78c9b70>
35   01/19/11 11:11:30.628      Old temperature for 28.B3795602000: 25.56 <0xb78c9b70>
07   01/19/11 11:11:30.629      Received Message from 233 (1wire temp / ) to -1001 (unknown / ), type 2 id 25 Event:Temperature Changed, retry none, parameters: <0xb2cfdb70>
07   01/19/11 11:11:30.629        Parameter 30(Value): 25.62 <0xb2cfdb70>

br Hari
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

Marie.O

hari,

you should change your description to LinuxMCE HA Device Driver God :)

Thank you for your dedication!
If I helped you, feel free to buy me a coffee: [url="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES"]https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES[/url]

_if_


tschak909

are there packages in the package database now for owfs/any other deps?

-Thom

Marie.O

Thom,

just take a look at your packages list in web admin :p
If I helped you, feel free to buy me a coffee: [url="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES"]https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES[/url]

hari

Quote from: tschak909 on January 19, 2011, 04:54:11 PM
are there packages in the package database now for owfs/any other deps?

-Thom

no.. I was quite busy with the code and did not yet care to do that administrative task...

br Hari
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

DragonK

Stupid Question,

How do I get it on my core?

apt-get upgrade?

Karel

_if_

I guess as long as there are no packages in the database we need to install owfs manually, right?

hari

yes, and after installing owfs, you need to do something like the following to compile the binary:

sudo -i
cd /usr/src/
svn co http://svn.linuxmce.org/svn/branches/LinuxMCE-0810/src LinuxMCE-0810/src
cp /usr/pluto/lib/* LinuxMCE-0810/src/lib
cd LinuxMCE-0810/src/OneWire
make bin
cp OneWire /usr/pluto/bin


br Hari
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

DragonK


DragonK

Hari,

I cant complete the install as per your instructions, I get stuck on the last step.

dcerouter_1011060:/usr/src/LinuxMCE-0810/src/OneWire# make bin
g++ -c -I.. -I../DCE -I/usr/include/mysql -DKDE_LMCE -DDEBUG -DTHREAD_LOG -DLOG_ALL_QUERIES -I/opt/owfs/include  -Wall -fPIC -ggdb3  Main.cpp -o Main.o
In file included from ../db_wrapper/db_wrapper.h:112,
                 from ../PlutoUtils/DBHelper.h:23,
                 from ../pluto_main/Database_pluto_main.h:3,
                 from ../pluto_main/Table_Device.h:21,
                 from ../DCE/DeviceData_Router.h:25,
                 from ../DCE/DCERouter.h:28,
                 from Main.cpp:18:
../db_wrapper/db_wrapper_mysql.h:7:25: error: mysql/mysql.h: No such file or directory
In file included from ../db_wrapper/db_wrapper.h:112,
                 from ../PlutoUtils/DBHelper.h:23,
                 from ../pluto_main/Database_pluto_main.h:3,
                 from ../pluto_main/Table_Device.h:21,
                 from ../DCE/DeviceData_Router.h:25,
                 from ../DCE/DCERouter.h:28,
                 from Main.cpp:18:
../db_wrapper/db_wrapper_mysql.h:17: error: expected constructor, destructor, or type conversion before â*â token
In file included from ../pluto_main/Database_pluto_main.h:3,
                 from ../pluto_main/Table_Device.h:21,
                 from ../DCE/DeviceData_Router.h:25,
                 from ../DCE/DCERouter.h:28,
                 from Main.cpp:18:
../PlutoUtils/DBHelper.h:36: error: ISO C++ forbids declaration of âMYSQL_RESâ with no type
../PlutoUtils/DBHelper.h:36: error: expected â;â before â*â token
../PlutoUtils/DBHelper.h: In constructor âPlutoSqlResult::PlutoSqlResult()â:
../PlutoUtils/DBHelper.h:37: error: class âPlutoSqlResultâ does not have any field named ârâ
../PlutoUtils/DBHelper.h: In member function âvoid PlutoSqlResult::ClearResults()â:
../PlutoUtils/DBHelper.h:44: error: ârâ was not declared in this scope
../PlutoUtils/DBHelper.h:46: error: âmysql_free_resultâ was not declared in this scope
../PlutoUtils/DBHelper.h: At global scope:
../PlutoUtils/DBHelper.h:64: error: ISO C++ forbids declaration of âMYSQLâ with no type
../PlutoUtils/DBHelper.h:64: error: expected â;â before â*â token
../PlutoUtils/DBHelper.h:164: error: âMYSQLâ has not been declared
../PlutoUtils/DBHelper.h:180: error: ISO C++ forbids declaration of âMYSQL_RESâ with no type
../PlutoUtils/DBHelper.h:180: error: expected â;â before â*â token
Main.cpp:253: error: expected `;' at end of input
Main.cpp:253: error: expected `}' at end of input
../PlutoUtils/DBHelper.h: In constructor âDBHelper::DBHelper()â:
../PlutoUtils/DBHelper.h:74: error: âm_pDBâ was not declared in this scope
../PlutoUtils/DBHelper.h: In constructor âDBHelper::DBHelper(std::string, std::string, std::string, std::string, int)â:
../PlutoUtils/DBHelper.h:97: error: âm_pDBâ was not declared in this scope
../PlutoUtils/DBHelper.h: In destructor âvirtual DBHelper::~DBHelper()â:
../PlutoUtils/DBHelper.h:111: error: âm_pDBâ was not declared in this scope
../PlutoUtils/DBHelper.h:112: error: âmysql_closeâ was not declared in this scope
../PlutoUtils/DBHelper.h:113: error: âm_pDBâ was not declared in this scope
../PlutoUtils/DBHelper.h: In member function âbool DBHelper::DBConnect(bool)â:
../PlutoUtils/DBHelper.h:133: error: âm_pDBâ was not declared in this scope
../PlutoUtils/DBHelper.h:137: error: âmysql_closeâ was not declared in this scope
../PlutoUtils/DBHelper.h:140: error: âm_pDBâ was not declared in this scope
../PlutoUtils/DBHelper.h:142: error: âdb_wrapper_initâ was not declared in this scope
../PlutoUtils/DBHelper.h:151: error: âm_pDBâ was not declared in this scope
../PlutoUtils/DBHelper.h:151: error: âmysql_real_connectâ was not declared in this scope
../PlutoUtils/DBHelper.h:154: error: âmysql_errorâ was not declared in this scope
../PlutoUtils/DBHelper.h: In member function âvoid DBHelper::SetConnection(int*)â:
../PlutoUtils/DBHelper.h:166: error: âm_pDBâ was not declared in this scope
../PlutoUtils/DBHelper.h: In member function âstd::string DBHelper::md5(std::string)â:
../PlutoUtils/DBHelper.h:173: error: âMYSQL_ROWâ was not declared in this scope
../PlutoUtils/DBHelper.h:173: error: expected `;' before ârowâ
../PlutoUtils/DBHelper.h:174: error: âclass PlutoSqlResultâ has no member named ârâ
../PlutoUtils/DBHelper.h:174: error: âdb_wrapper_query_resultâ was not declared in this scope
../PlutoUtils/DBHelper.h:174: error: ârowâ was not declared in this scope
../PlutoUtils/DBHelper.h:174: error: âclass PlutoSqlResultâ has no member named ârâ
../PlutoUtils/DBHelper.h:174: error: âmysql_fetch_rowâ was not declared in this scope
../PlutoUtils/DBHelper.h:177: error: ârowâ was not declared in this scope
../PlutoUtils/DBHelper.h: At global scope:
../PlutoUtils/DBHelper.h:178: error: expected unqualified-id at end of input
make: *** [Main.o] Error 1
dcerouter_1011060:/usr/src/LinuxMCE-0810/src/OneWire#


Thanx
Karel

hari

you need to install mysql devel headers (iirc "apt-get install libmysqlclient-dev" or something like that)

br Hari
rock your home - [url="http://www.agocontrol.com"]http://www.agocontrol.com[/url] home automation

DragonK

Quote from: hari on January 19, 2011, 10:54:10 PM
you need to install mysql devel headers (iirc "apt-get install libmysqlclient-dev" or something like that)

br Hari

Thanx Hari.

That was it.

Kezza

Hi DragonK, Can you update the wiki page once up and running with the instructions on how to get working and maybe list equipment etc? http://wiki.linuxmce.org/index.php/1-Wire

I've got some stuff on order from www.hobby-boards.com so should get that in the next few weeks and I can update also.


Cheers,

Techstyle

Hari,

what was the adapter used to set up the template?  was it the RS232 or USB
Techstyle UK Ltd
[url=http://www.techstyleuk.co.uk]http://www.techstyleuk.co.uk[/url]

Techstyle US Inc.
[url=http://www.techstyleus.com]http://www.techstyleus.com[/url]