Author Topic: 1wire support  (Read 111887 times)

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
1wire support
« on: January 19, 2011, 11:12:15 am »
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 - http://www.agocontrol.com home automation

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: 1wire support
« Reply #1 on: January 19, 2011, 11:22:34 am »
hari,

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

Thank you for your dedication!

_if_

  • Guru
  • ****
  • Posts: 248
    • View Profile
Re: 1wire support
« Reply #2 on: January 19, 2011, 04:18:16 pm »
good job, thanks Hari!

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: 1wire support
« Reply #3 on: January 19, 2011, 04:54:11 pm »
are there packages in the package database now for owfs/any other deps?

-Thom

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: 1wire support
« Reply #4 on: January 19, 2011, 05:57:41 pm »
Thom,

just take a look at your packages list in web admin :p

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: 1wire support
« Reply #5 on: January 19, 2011, 06:46:15 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 - http://www.agocontrol.com home automation

DragonK

  • Guru
  • ****
  • Posts: 446
    • View Profile
Re: 1wire support
« Reply #6 on: January 19, 2011, 07:18:10 pm »
Stupid Question,

How do I get it on my core?

apt-get upgrade?

Karel

_if_

  • Guru
  • ****
  • Posts: 248
    • View Profile
Re: 1wire support
« Reply #7 on: January 19, 2011, 07:40:53 pm »
I guess as long as there are no packages in the database we need to install owfs manually, right?

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: 1wire support
« Reply #8 on: January 19, 2011, 07:48:51 pm »
yes, and after installing owfs, you need to do something like the following to compile the binary:
Code: [Select]
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 - http://www.agocontrol.com home automation

DragonK

  • Guru
  • ****
  • Posts: 446
    • View Profile
Re: 1wire support
« Reply #9 on: January 19, 2011, 08:00:08 pm »
Thanx Hari

DragonK

  • Guru
  • ****
  • Posts: 446
    • View Profile
Re: 1wire support
« Reply #10 on: January 19, 2011, 10:31:51 pm »
Hari,

I cant complete the install as per your instructions, I get stuck on the last step.
 
Code: [Select]
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

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: 1wire support
« Reply #11 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
rock your home - http://www.agocontrol.com home automation

DragonK

  • Guru
  • ****
  • Posts: 446
    • View Profile
Re: 1wire support
« Reply #12 on: January 20, 2011, 05:20:36 am »
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

  • Veteran
  • ***
  • Posts: 146
    • View Profile
Re: 1wire support
« Reply #13 on: January 20, 2011, 06:14:45 am »
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

  • Addicted
  • *
  • Posts: 674
    • View Profile
    • Techstyle UK Ltd.
Re: 1wire support
« Reply #14 on: January 20, 2011, 06:31:05 am »
Hari,

what was the adapter used to set up the template?  was it the RS232 or USB