Author Topic: knx, linuxmce, eib part, ... help?  (Read 22666 times)

guigolum

  • Regular Poster
  • **
  • Posts: 40
    • View Profile
knx, linuxmce, eib part, ... help?
« on: June 30, 2008, 06:52:24 pm »
EDIT: now working on implementing knx through eibd in linuxmce.
so making a dcedevice to communicate with eibd

old message:


hi

i would like to implement more the knx protocol:
a device on the knx bus is supposed to have a couple adress: one to receive order, one to send back state.

i suppose it is only a matter of translation, but i 'd like to have some help on where in the code is the adress storage coded? and btw, any advise that could help me..

thanx
« Last Edit: July 11, 2008, 10:09:14 am by guigolum »

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5501
  • DOES work for LinuxMCE.
    • View Profile
Re: knx, linuxmce, eib part, ... help?
« Reply #1 on: June 30, 2008, 09:20:29 pm »
DCE Devices have Device Data. These are merely variables that are defined in the database (so that the DCE Router knows the parameter and its type), and in the source code generated by DCEGen. There are examples for getting and setting device data in every DCE device's comments.

If you look at other home automation drivers, you will notice the main driver, which is the interface...and in the device tree, there are children for each device to control.. the Port/Channel device data field is often defined in the device template for this, and allows the programmer to store address associations for use inside the driver.

-Thom

guigolum

  • Regular Poster
  • **
  • Posts: 40
    • View Profile
Re: knx, linuxmce, eib part, ... help?
« Reply #2 on: July 01, 2008, 01:37:47 am »
hum, i think i didn't explain properly:

in the knx protocol, a peripheral plugged on the bus can have several adress to obey, and one adress when he is required his states

an example:
let's say i have an adress for "switch all lights off' in linuxmce, meaning only linuxmce can switch ALL lights off at once. this adress is '1'.
so, when linuxmce wants to switch off the lights, it sends the 'set 0' on the bus to the adress 1
then let's take A light. it is commanded to be switch on/off by a button in the room. thus it has to obey the adress '2' of the bus, meaning the button sends 'set 0' or 'set 1' on the bus to switch the light on/off. however, the light should not send back its state to either '1' or '2' adress, but to a third adress (let's say '3'), in order linuxmce and the button ton know exactly which peripheral is in state 0/1

that's what i am supposed to implement: give to knx peripherals in linuxmce an adress to send order, and an adress to get state.


but may you tell what dcedevice code could i read to understand further informations on linuxmce cdedevice communication protocole?
i am not sure i understand what you say.. tell me if i am right:
- you have some settings in linuxmce database to understand what kind of peripheral it is
- the driver provides functions needed by linuxmce, and so his core code is genererated by dcegen.
- when linuxmce loads up, it loads the driver files listed in its database, like any librairy, to get the required functions

then there are some things i don't understand.. trying to think of it, then i'll write them



PS: btw guy, thanks for your help.

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2421
    • View Profile
    • ago control
Re: knx, linuxmce, eib part, ... help?
« Reply #3 on: July 01, 2008, 06:24:06 pm »
i'd assume the device 3 is a FT1.2 interface. Do you see the knx telegram going to device 2 on device 3? If yes, it's easy to send a dce message to update the device state in lmce. If not, you have to implement some polling mechanism to fetch the light state every now and then.
best regards,
Hari
rock your home - http://www.agocontrol.com home automation

guigolum

  • Regular Poster
  • **
  • Posts: 40
    • View Profile
Re: knx, linuxmce, eib part, ... help?
« Reply #4 on: July 02, 2008, 08:53:24 am »
hi
i looked for knx specs after irc and actually the specs are not free to get.

so, i asked my boss:
- the READ command is a way to ask the state of a knx device. the telegram is defined in the knx protocol, part transmission
- there is no special thing to do when you plug a device,and it doesn't do anything special. it is just connected to the bus and waiting for orders/events to receive/send
- so basically you need when your linumce starts to send a READ to EACH knxdevice you are supposed to control, to get its value - and actually any time you plug another one, or need to ensure yourself the state of the device
- there is no broadcast in knx.each adress (say A/B/C) means one logical group, even if the last part is 0 or 255

so, the READ part of the EIB is very important because it ensures your linuxmce network is fuctionnal since the start

i don't understand how may the EIB part of the system work without it?

domotiqa.com

  • Guru
  • ****
  • Posts: 206
    • View Profile
    • home automation
Re: knx, linuxmce, eib part, ... help?
« Reply #5 on: July 02, 2008, 03:20:43 pm »
hy,

I guess that lmce as the group adress setup, for each device, after what, it just send telegram with the group adress, the type and the value (plus more parameters, I have a doc on it). After what, each knx device is listen, if there is a match between his group adress and the telegram group adress the telegram is for him, so it's changing it's value, and so the state... same process for each device!

In fact each knx device are independant excepted the group adress they are dealing with. SO I guess it's the reason why that's working with the write function!

For the read function, I thing that the best is to ask for state for each group adress setup in lmce !
http://www.domotiqa.com - home automation

guigolum

  • Regular Poster
  • **
  • Posts: 40
    • View Profile
Re: knx, linuxmce, eib part, ... help?
« Reply #6 on: July 02, 2008, 04:07:35 pm »
it's exactly what i think i have to do:

send a READ command on the knx bus to each group the linuxmce is supposed to manage

but the COMMAND_READ is not implemented in the EIB code, and i don't know how to call it at the startup of linuxmce. i think it is in the config, but can't remember where tschak909 told me it was....

guigolum

  • Regular Poster
  • **
  • Posts: 40
    • View Profile
Re: knx, linuxmce, eib part, ... help?
« Reply #7 on: July 08, 2008, 11:36:32 am »
i think i understand better now, and some matters i think i have to solve(maybe i'm false and these points have actually been solved):

1) EIB does only accept some sensors as an event comand. for instance it just doesnt handle message on the bus from lamps: when a lamp sends back a WRITE(meaning it has been set to the value of write), EIB doesn't understand that. changing the code so that EIB sends a write to the lamp on DCE changes the value of the lamp in DCE memory, but is a bad solution(see below)

2) there is no yet couple parameter for sending/listening, for a lamp. a lamp being sent a write command should answer with a write command on its answer group address. it could be modified in the templates in webadmin, but then i don't know how to make it be seen as a sensor, which it actually is.
3) in the security plugin, a lighting group's device can't send an event to the dce(it isn't allowed). i don't know if it could be changed.

the matter with sending a write request to the child through DCE will lead in the child sending another WRITE in answer .. so it keeps on.

the matter with having only one address to listen is that a child can listen several address group to obey to. so if a button send a write request to one address that is not the one the child is represented with, the DCE wo'nt get any information

4) the dce router assumes messages are received: if i unplug a part of the EIB bus, then order DCE to put the lamp on, it will put i on (when the order has not been received)


when i have solved that, i can make EIB understand the responses of the lamp(responses to the READ command that is needed to be sent at the start of the EIB)
« Last Edit: July 08, 2008, 11:39:23 am by guigolum »

domotiqa.com

  • Guru
  • ****
  • Posts: 206
    • View Profile
    • home automation
Re: knx, linuxmce, eib part, ... help?
« Reply #8 on: July 11, 2008, 12:13:28 am »
hy guigolum,

ok for your explanation, however, what about the update process??
- send a read to each eib device each min., sec. ??? should be simpliest
- working by listen to the bus for each message with group address, and have a sql table with link between device adress and group adress ? maybe an import in lmce of the ets group adress (that we can export from an ETS project) declared in order to fill the sql table adress device/group
- I'd like to know how linknx work, maybe the simpliest is to create a dce device that make interface from linknx to lmce !
interacting with linknx
http://linknx.wiki.sourceforge.net/Interacting+with+Linknx

I dont know if i'm very clear, let me know!
« Last Edit: July 11, 2008, 12:31:29 am by domotiqa.com »
http://www.domotiqa.com - home automation


guigolum

  • Regular Poster
  • **
  • Posts: 40
    • View Profile
Re: knx, linuxmce, eib part, ... help?
« Reply #10 on: July 11, 2008, 10:00:02 am »
domotiqua, i'll answer later. just for the read command to EIB, it's useless, the knx elements are supposed to send their value when it has been changed. and anyhow, w/o an event handler to manage the modifications, it's useless: whatever the EIB sends to the DCER, if it is not in the security plugin, atm it is just not handled. not sure about that, though.. i need to know the events the LightinginPlugin can handle.


working on EIBd now.(my boss agrees)
keeping save from irc, just in case i need:

Quote
<MrTuttle> guigolum, and eibd supports plenty of devices, additionally you can connect with ETS3 to EIBD to do setup
[09:23] <guigolum> i don't know ETS3
[09:24] <MrTuttle> the freebus guys are working on a free implementation
[09:24] <MrTuttle> guigolum, until then you can use any installer software that supports IP/EIBNET
[09:25] <guigolum> i just don't understand the meaning of your sentence. i am working atm on the EIB part of the code. should i stop, and start working on another one?
[09:25] <guigolum> i mean, is another version of the EIB dce device being built , so i should work on it instead of the older EIB
[09:26] <MrTuttle> guigolum, no
[09:26] <MrTuttle> guigolum, to configure EIB you need some ETS3 software)
[09:26] <MrTuttle> guigolum, the freebus guys are working on a free ETS3 installer software
[09:27] <MrTuttle> guigolum, if we would use eibd in our dce device, any ets3 software could also attach to the BUS _while_ the DCE device is running
[09:27] <guigolum> to configure the programm EIb, the devices on EIB(children), the event/command you can send to/through EIB?
[09:27] <MrTuttle> and you can connect over IP
[09:27] <guigolum> ok, you mean u need a DCE device interacting with the EIBD
[09:28] <MrTuttle> guigolum, i'm no EIB expert, but you use ETS3 to program the devices, BCUs, whatever
[09:28] <MrTuttle> guigolum, exactly
[09:28] <-- atomic__ has left this server (Read error: 110 (Connection timed out)).
[09:28] <MrTuttle> guigolum, our actual device, that you are working on, does not use EIBD
[09:28] <guigolum> i know that
[09:28] <guigolum> it's a full block program
[09:29] <guigolum> ok, so. i should learn how to make a base DCE peripheral
[09:29] <MrTuttle> guigolum, thats very easy
[09:29] <guigolum> then, how to handle sockets(i'm a newb..)
[09:29] <MrTuttle> guigolum, i'm just writing an alternative zwave driver
[09:29] <guigolum> then, implement dce/eib translatin(with events)
[09:30] <MrTuttle> guigolum, what i did, i just regenerated the existing DCE device from the database with DCEGen
[09:30] <MrTuttle> guigolum, and then filled my code in
[09:30] <guigolum> ok
[09:30] <MrTuttle> guigolum, so we can swap the old and the new driver, they use both device template #1754
[09:30] <guigolum> .. very good then
[09:30] <MrTuttle> guigolum, when you DCEGen the EIB device, you get a STUB project
[09:30] <guigolum> may i copypasta that on the forum?
[09:30] <MrTuttle> guigolum, with all commands
[09:31] <MrTuttle> guigolum, why not?
[09:31] <guigolum> MrTuttle: STUB project, then..?
[09:32] <guigolum> u got some links to me?
[09:32] <MrTuttle> guigolum, the DCEGen gives you an empty project
[09:32] <MrTuttle> guigolum, you just have to fill the commands that are put in there from the database
[09:32] <guigolum> the dcegen in the webadmin?
[09:32] <MrTuttle> guigolum, no, there is a tool DCEGen
[09:32] <guigolum> ok
[09:32] <MrTuttle> guigolum, like sql2cpp
[09:32] <MrTuttle> guigolum, i'll search a link for you
[09:32] <guigolum> i din't yet use sqlcvs, sql2cpp nor dcegen
[09:33] <MrTuttle> guigolum, http://forum.linuxmce.org/index.php?topic=3675.0
[09:33] <guigolum> thanx
[09:39] <guigolum> MrTuttle: shall i create a devicetemplate (i think so..) ? and then fill it with the EIB commands(READ and WRITE) ?
[09:39] <guigolum> .. doorbell
[09:39] <guigolum> w8 i make some verification
[09:39] <MrTuttle> guigolum, i would just DCEGen the existing template
[09:39] <MrTuttle> guigolum, it has read and write, just fill them
[09:40] <guigolum> ok./ i suppose i can get the goal and parameters of both commands in the webadmin
[09:49] <guigolum> ok, my boss agrees with EIBD

domotiqa.com

  • Guru
  • ****
  • Posts: 206
    • View Profile
    • home automation
Re: knx, linuxmce, eib part, ... help?
« Reply #11 on: July 11, 2008, 06:08:26 pm »
here is a good example of template edit, based on another one for example
http://wiki.linuxmce.org/index.php/Marantz_SR_5600

and eibd sdk
http://www.auto.tuwien.ac.at/~mkoegler/eib/sdkdoc-0.0.2.pdf
« Last Edit: July 11, 2008, 06:32:50 pm by domotiqa.com »
http://www.domotiqa.com - home automation

domotiqa.com

  • Guru
  • ****
  • Posts: 206
    • View Profile
    • home automation
Re: knx, linuxmce, eib part, ... help?
« Reply #12 on: July 11, 2008, 06:16:32 pm »
in fact ets work as bellow:
- select device you are using in your house/building...
- define adress for each eib device
    1.2.21 for exemple for the device 21 in line 2 in zone 1

- define group adress that are in fact link between each device
        for example a light has got a % value (for dimming) and a bin value (for on/off), but there is plenty of different value..
        and a switch has got a bin value for pressing

so you can asign a group adress for lighting the device light with the swith buton by linkink their bin value in the group adress
http://www.domotiqa.com - home automation

guigolum

  • Regular Poster
  • **
  • Posts: 40
    • View Profile
Re: knx, linuxmce, eib part, ... help?
« Reply #13 on: July 15, 2008, 12:04:31 pm »
errata: see at the bottom

that is already done. i don't need to change the eibdevices templates(well, i'll do some more later), atm only the EIB DCE template needs to implement the eibd.

as hari told me, i only need to regen the EIB template, i order it to be usable instead of the former one,  but then fill the code with command translation/sending using the eibds instead of the old librairy, which actually worked(not on all devices..) but was supposed to be used on a com port, when eibd can work on any EIB peripheral.

i sent a mail to mkoegler, asking for help on the eibd. i think i need to use it through sockets, but not sure actually(i could use system(command") too.. but it seems weird to me); plus, i need to understand how to receive the mesages sniffed by eibd on the bus.

(don't see this post as a disagreement, but more as a post-it for me to remember later what i shall do. btw thanks for the eib doc, i didn't manage to get it - but i'm not sure it could help me, since the eibd is advised not to be used as a daemon)

errata: i am actually dumbass, i can use the bcu SDK in the eib part. it's what it is supposed to do actually.. i still feel more ashamed..
so, now, using the BCU sdk in the eib DCE device
« Last Edit: July 15, 2008, 01:27:39 pm by guigolum »

domotiqa.com

  • Guru
  • ****
  • Posts: 206
    • View Profile
    • home automation
Re: knx, linuxmce, eib part, ... help?
« Reply #14 on: July 15, 2008, 04:05:34 pm »
hy,
I think you are on the best proper way to implement!

However, I think the simpliest should be to use linknx with xml/http interface that look very very basic !
Doesn't it look simple:
http://linknx.wiki.sourceforge.net/Interacting+with+Linknx

However, the best is to interract with the bcu sdk I agree
Good luck
http://www.domotiqa.com - home automation