LinuxMCE Forums

General => Developers => Topic started by: guigolum on June 30, 2008, 06:52:24 pm

Title: knx, linuxmce, eib part, ... help?
Post by: guigolum 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
Title: Re: knx, linuxmce, eib part, ... help?
Post by: tschak909 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
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum 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.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari 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
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum 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?
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com 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 !
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum 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....
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum 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)
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com 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!
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on July 11, 2008, 12:29:42 am
http://ouaye.net/linknx/knxwebsim-0.4/js/common.js
http://ouaye.net/linknx/knxwebsim-0.4/js/cswitch.js
http://ouaye.net/linknx/knxwebsim-0.4/js/cdimmer.js
http://ouaye.net/linknx/knxwebsim-0.4/js/cthermostat.js
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum 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
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com 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
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com 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
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum 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
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com 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
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 15, 2008, 04:28:32 pm
well, i don't really understand how to use the sdk. i hope the installation won't require people to install parts of the programm too(i think it shouldnot, but well..)

trying to understand the dsk doc..

btw it seems the youngest version of the doc is
http://www.auto.tuwien.ac.at/~mkoegler/eib/sdkdoc-0.0.3.pdf ;)
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on July 15, 2008, 07:34:30 pm
have a look at the 7.7.2 section,
Quote
7.7.2. EIBD client library - C version
if you use the C langage

or
Quote
7.6. EIBnet/IP server front end . . . . . . . . . . . . . . . . . . . . . . . . . . 104
7.7. EIBD front end . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
7.7.1. Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
7.7.2. EIBD client library - C version . . . . . . . . . . . . . . . . . . . 111
7.7.3. EIBD client library - PHP version . . . . . . . . . . . . . . . . . . 114
7.7.4. EIBD client library - Java version . . . . . . . . . . . . . . . . . . 115
7.7.5. EIBD client library - other languages . . . . . . . . . . . . . . . . 116
7.7.6. Using the EIBD client library . . . . . . . . . . . . . . . . . . . . 116
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on July 15, 2008, 07:42:12 pm
C version use socket, php (experimental) use class (that look's easyer)

the 776 section explain pretty well the process to use !

Quote
EIBD implements for all control tra?c only up to layer 4. To interact with your EIB
devices, each application needs to implement the following things:


1. Converting numeric EIB address from/to strings

EIB has two di?erent address type, which are both 16 bit long: individual and
group addresses. Each device has an individual address. This address is mainly
usedformanagmentpurposesandisinsertedasfromaddressineachtelegrams. All
control tra?c is sent to a group address, for which di?erent devices are listening.
Forindividualaddresses, thestandard displayformatisa.b.c. a contains theupper
4 bits, b the follwing 4 bits and c the lower 8 bits (all values are unsigned).
For group addresses, the most common format is a/b/c. a contains the upper 5
bits, b the following 3 bits and c the lower 8 bits. An other format is a/b. In this
case a contains the upper 5 bits and b the lower 11 bits.


2. Decoding/Encoding of APDUs

For control tra?c, there are 3 important APDUs:
A GroupValue Write This APDU is used to update a group object (ie. switch a
lighton). TheformatisXXXX XX00 10VV VVVV (2bytes). Ifthedatatype
to transmit is between 1 and 6 bit longs, the lower 6 bits (V) contain the
value. If the value is 1 (or more) bytes long, all Vs are zero and the value is
appended after the two bytes.
A
GroupValue Read This APDU is sent, to tell a device, that it should send the
current values of the group object in a A GroupValue Response. The format
it XXXX XX00 00XX XXXX (2 bytes).
A GroupValue Response This APDU is used to answer a A GroupValue Read
request. The format is XXXX XX00 01VV VVVV (2 bytes). If the datatype
to transmit is between 1 and 6 bit longs, the lower 6 bits (V) contain the
value. If the value is 1 (or more) bytes long, all Vs are zero and the value is
appended after the two bytes.
All bits marked with X should be ignored, when decoding a APDU and set to
zero, when generating a APDU.

There are di?erent ways to use a EIBD connection. The rule is, that you can use one
connection only for one of the listed purposes:

• Query/poll the status of group addresses
Cache Read Sync any time you need a value. The
In this case, you call EIB
caching must be enabled in eibd. This can either be done by the -c command line
switch or by calling EIB Cache Enable at least once. You must serialize all calls
to EIB Cache Read Sync on one connection.
This method only works for status based group objects. To get correct results, the
group address should be readable and some device should sent an update telegram
on status changes.

• Send(receive) for one group address
In this case, you must first call EIBOpenT
Group to associate the connection with
the group address. The parameter write only must be set to true, if you don’t
want to receive telegrams.
You can call any time EIBSendAPDU (even not serialized) on the connection to
send an APDU.
To receive telegrams, you must call EIBGetAPDU Src. You must serialize all calls
to EIBGetAPDU Src on one connection.

• Send(receive) for all group addresses
In this case, you must first call EIBOpen GroupSocket. The parameter write only
must be set to true, if you don’t want to receive telegrams.
You can call any time EIBSendGroup (even not serialized) on the connection to
send an APDU.

Toreceivetelegrams(APDU),youmustcallEIBGetGroup Src. Youmustserialize
all calls to EIBGetGroup Src on one connection.
Each call has an corresponding asynchronous version. These functions split the call
in two parts: The name async function starts the processing. EIBComplete waits, until
the call has finished. Depending on the language there are di?erent ways to poll for the
completion.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 16, 2008, 07:45:39 am
well, well, thanx a lot..

one part of the doc i had not taken time to look at. looking at, incoming responses
Title: Re: knx, linuxmce, eib part, ... help?
Post by: jef2000 on July 17, 2008, 10:17:25 pm
Hi,

I just discovered this discussion thread and am also intersted in the topic (a solution for integrating home automation into media-center)
I'm not an LMCE user (at least not yet) so I don't understand all the internal details of it, but I'm the programmer of linknx ( http://sourceforge.net/projects/linknx/ ) and can perhaps help on some topics.

The EIB/KNX model is based on communication objects and group addresses. Each group address represent a functionality.  Each communication object is able to send its value to at most one group address., but can receive value from zero, one or more group addresses. So that's not always a one-to-one relationship. In addition, each communication object has a collection of flags telling if it can transmit it's value on the bus, must update it's internal value if a new one is received from the bus, or answer to a read request coming from the bus.

All this behavior is part of the KNX object model but EIBD only implements the lowest protocol layer (send and receive READ, WRITE and READ_RESPONSE telegrams for group addresses). To fully implement the object model, we need an additional layer. That's one of the reasons why I developped linknx.
Additionally to this, linknx handle the conversion from the binary data format. Every communication object is configured in linknx with a name, group address to send to ( and potential additional group addresses to receive from), communication flags and its data-type (for decoding bus binary format to understandable text values).

All the configuration, reading and writing of object values to/from the bus can be done by connecting to linknx on a known tcp port and send/receive commands in XML format.

I suppose that a DCE router could easily be interfaced to it, but I don't have a clear view of what commands this DCE router must be able to send / receive. What are the limits of LMCE concerning home automation, how is the configuration (group addresses, flags, ...) stored in LMCE

Regards,

Jean-françois
Title: Re: knx, linuxmce, eib part, ... help?
Post by: tschak909 on July 17, 2008, 10:25:03 pm
I would suggest reading the Programmers Guide on the wiki, especially in regards to DCE.

The whole system is very open-ended, but the basic logic modules for lighting, climate, and security do impose some high level logic.

EIB in the context of LinuxMCE is merely an interface layer, the DCE device needs to translate commands from a high level perspective, ON, OFF, etc.. to the appropriate commands to send out over the buss.

Addressing is not really a concern other than the devices to be controlled are children of the EIB interface, and it's the interface's responsibility to take the individual Port/Channel data fields, and make them useful in its own context.

All of the higher level aspects are taken care of by the Lighting Plugin, and there currently isn't much beyond zone and grouping abstractions, but even then, the lighting plugin will always separate the zone and grouping commands into their component parts to send to the interface.

-Thom
Title: Re: knx, linuxmce, eib part, ... help?
Post by: bulek on July 18, 2008, 10:05:35 am
Hi,

I just discovered this discussion thread and am also intersted in the topic (a solution for integrating home automation into media-center)
I'm not an LMCE user (at least not yet) so I don't understand all the internal details of it, but I'm the programmer of linknx ( http://sourceforge.net/projects/linknx/ ) and can perhaps help on some topics.

The EIB/KNX model is based on communication objects and group addresses. Each group address represent a functionality.  Each communication object is able to send its value to at most one group address., but can receive value from zero, one or more group addresses. So that's not always a one-to-one relationship. In addition, each communication object has a collection of flags telling if it can transmit it's value on the bus, must update it's internal value if a new one is received from the bus, or answer to a read request coming from the bus.

All this behavior is part of the KNX object model but EIBD only implements the lowest protocol layer (send and receive READ, WRITE and READ_RESPONSE telegrams for group addresses). To fully implement the object model, we need an additional layer. That's one of the reasons why I developped linknx.
Additionally to this, linknx handle the conversion from the binary data format. Every communication object is configured in linknx with a name, group address to send to ( and potential additional group addresses to receive from), communication flags and its data-type (for decoding bus binary format to understandable text values).

All the configuration, reading and writing of object values to/from the bus can be done by connecting to linknx on a known tcp port and send/receive commands in XML format.

I suppose that a DCE router could easily be interfaced to it, but I don't have a clear view of what commands this DCE router must be able to send / receive. What are the limits of LMCE concerning home automation, how is the configuration (group addresses, flags, ...) stored in LMCE

Regards,

Jean-françois

Hi,

Jeff... Nice to see you on this forums (I'm the one asking for using KnxWeb on another automation system and guess what, I'm LMCE user and my plans are tied to it)....

If I may propose, maybe it would be wise to separate EIB interface from linknx so we could be able to use linknx (and of course KnxWeb) also for all devices under LMCE... So I propose :
- to make proper wrapper for EIB (I'm not a programmer, but making full blown wrapper in Ruby would be much easier and more people could contribute)....

- and then try to connect linknx to LMCE  via another wrapper... In this way we could use knxweb (which is BTW great, easy expandable web-Ajax visualization) for virtuall all devices connected to LMCE (including media players, etc...). In this way KnxWeb could become interesting web interface to whole LMCE system.... I guess we could use EIB Address slot for LMCE ID instead for non-EIB devices... Is there any more info somewhere how linknx communicates with EIBD ?

Looking forward to any opinions....

regards,

Bulek.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on July 18, 2008, 02:35:57 pm
hy jeff,
yet, the eib interface can write to the bus!
For that you need, for example to a floorplan and drag n drop a standrad input... or what else on the plan. Then after (adding the eib interface and sensor, devices..) you have to affect the value for group adress...

have a look there:
http://wiki.linuxmce.org/index.php/EIB

By the way three possible interface as we said with guigolum:
1/ use low level communication with eibd
2/ use xml interface with project like linknx to be able to read value
3/ use all linknx function via a link to linknx webpages

however, the user interface of lmce is like linknx with object upon a house photo or a plan, then drag n drop devices!
So in fact we only need (at first) to use the read/write command!
Title: Re: knx, linuxmce, eib part, ... help?
Post by: jef2000 on July 18, 2008, 11:18:09 pm
Hi,

The first thing I don't understand very well about lmce is how the configuration made on webadmin interface is stored and transmitted to the DCE device connected to the bus.
Is it stored in a database, in files? Is it sent to the device via the DCE router or another mechanism, is this mechanism global or specific to each kind of DCE device. As I said in a previous post, linknx needs a configuration to tell it what are the EIB objects, their type, group addresses, flags .... All this can be loaded from a configuration file at linknx startup or configured dynamically using the TCP/XML protocol.

Do you think that this configuration step must be integrated in lmce or use a standalone configuration tool?

Once all the group objects are configured, the home automation plugin can use the object id's as port/channel to send commands to linknx using the DCE router.

Is there already a way to see the actual on/off state of lights in floorplans, or is it just pushbuttons to switch it on and off. Is there already a way to display also actual temperatures on the floorplan? I think I could write a DCE device without too much difficulty to be able to send and receive comands from/to the bus, but I would like to be sure that the plugins behind the DCE really have the functionalities I expect from a home automation visualization interface.

Do I need to have a PC with LMCE installed to be able to develop it, or can the development be done on a standard linux PC?

Regards,

Jean-François
Title: Re: knx, linuxmce, eib part, ... help?
Post by: jef2000 on July 19, 2008, 12:23:54 am
Hi,

I'm not a ruby expert, but the ruby GSD seems to be a very simple way to interface with linknx.
Suppose that linknx is configured correctly with all group objects and listening on TCP port 1028 (the default)

I think that something like this in section "#Process Receive Command For Child #384" would do the job:
Code: [Select]
cmdId           = cmd.id_                                   # Command ID: ON, OFF, SET LEVEL
cmdTo           = cmd.devidto_                              # Device ID in LinuxMCE
devPort         = device_.childdevices_[cmdTo].devdata_[12] # 12 contains a port/channel
childType       = device_.childdevices_[cmdTo].devtemplid_  # Template ID to know type of device: switch or dimmer

case cmdId
      when 192 #192 is ON                     
           command = '<write><object id="'+devPort+'" value="on"/></write>\n\4'           
      when 193 #193 is OFF                       
           command = '<write><object id="'+devPort+'" value="off"/></write>\n\4'
      when 184 #184 is Level of dimmer
           dim_level = cmd.params_[76]
           command = '<write><object id="'+devPort+'" value="'+dim_level+'"/></write>\n\4'                   
end

conn_.Send(command)

I'm not a ruby expert, so perhaps the single/double quotes are wrong but anybody knowing XML and ruby would be able to fix it.
Every command sent to linknx must be terminated by ASCII character 4 (EOT).

I'm not sure what is the range for the dim_level value, but linknx expect something between 0 and 255.

With the above code, the status returned by linknx is ignored, but in most case it will be <write status="success"/> so no need to worry, at least for a proof-of-concept implementation.

Only the sending of commands from lmce to linknx is supported in the above code, and only ON/OFF and dim value is supported, but let's first see if it works and then improve it.

To have it working, the port/channel of the switch device must be equal to the object ID configured in linknx. You'll also have to configure the GSD to connect via TCP on port 1028 (or whatever you configured in linknx config) on the host where linknx is running.

The base I used to write this code is here:
http://wiki.linuxmce.org/index.php/How_to_add_your_own_GSD_device

Regards,

Jean-François
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on July 20, 2008, 01:08:29 pm
hy i don't have internet,

to be quick, i think a webinterface in lmce admin website should be the best with the import of the ets group adress then a dropdown list to declare the device type. and a add buton that create the device in linknx and in lmce with the sql db.
have a look to the dcegen cmd in the wiki

another way should be to declare in linknx the devices, then declare it in lmce and use the linknx device number as value for group adress (try to add eib interface then child devices). once done we need to overoll the read / write function

yes lmce can dim, on off ...
Title: Re: knx, linuxmce, eib part, ... help?
Post by: jef2000 on July 20, 2008, 02:33:10 pm
Hi,

I understand that in lmce philosophy, all the linknx configuration must be done via the lmce admin interface and agree with it.
For the import of the ETS group address, can you tell me how you export it from ETS, what does the exported file look like? text file?
In linknx, the configuration of a communication object can be as simple as <object id="light_stairs" gad="1/1/5"/> or as complicated as <object id="light_stairs" gad="1/1/6" type="EIS6" init="persist" flags="crwtu">Stairs light<listener gad="1/1/206"/><listener gad="1/1/106"/></object>
Is it possible to store all this infomation in the lmce SQL db?

Perhaps I understood something wrong, but I was thinking that the dcegen command was not needed if I use GSD and ruby.
What does "overoll" mean?

Regards,

Jean-François

Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on July 20, 2008, 10:22:35 pm
ok,
i will send an ets file export tomorrow, for overoll it s a mistaque: inheritance sorry

for ruby code you are wright no need of dcegen, that only needed if we want to write ut in c, and it create db...
for storing info in db, i guess it s possible, why not

Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 21, 2008, 10:16:01 am
hmm..
(french) surcharger se dit overload(/french)

i hope someone will correct me if i am wrong


i don't see the interest in using lniknx

in lmce, peripherals attached to the eib are identified with a template number, for instance light switch on/off is device template #37

when the dcerouter's EIB peripheral starts up, it receives a config file with it (see src/Gen_Devices/EIBBase.h), that it parses and stores (see src/DCE/Command_Impl.h  :  DeviceData_Impl *m_pData stores the devices config).

so basically once it is started you just wait for a messsage(src/DCE/Message.h), and compare it with the templates names defined in src/pluto_main/Define_Device_Template.h "#define DEVICETEMPLATE_Light_Switch_onoff_CONST 37" for instance; and act according to their behaviour, and the order sent, and send corresponding events on the knx.
on the other side,you listen to the knx bus and throw events back to the dceRouter if they are handled by the devices witch config have been sent(basically, when you see a write on a switch lamp return_state group address, you just send a 'event_state_changed' to the  router, which should be hendled by the lighting plugin).


basically it's was we(i?) are supposed to do, because i am keeping segfaulting and i really don't understand..
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on July 21, 2008, 12:37:38 pm
I agree with you, however the link with linknx was simpliest, and for me, I needed the knx function, so I installed the linknx and make a link to linknx in order to have the read working !
Title: Re: knx, linuxmce, eib part, ... help?
Post by: jef2000 on July 21, 2008, 10:28:39 pm
Hi,

@guigolum:

The way KNX connection is currently implemented in lmce is something like a big hack in the KNX protocol definition. Basically, it shortcuts all the upper layers dfined by the protocol and force you to have a 1 to 1 matching between devices and EIB group addresses. It's enough for  basic functionalities but most "advanced" EIB configurations like the ones made by professionals will suffer from these restrictions.

Example: you have a staircase lighting that you can switch on using group address ga1. When the time is over, the actuator switch the light off and send the OFF information on another group address (say ga2). In the pushbuttons for this stairs light, I program ga1 as the main address and ga2 as the second one so that the status coming back on ga2 will update the state of the object and the next time you push it, it will know the light was off and turn it on again. Without this status feedback on ga2, the pushbutton doesn't know that the light was shutdown by the staircase timer of actuator and thus will think the light is still on and try to turn it off.
So if you have only one group-address by device, the status of the light will not update according to it's real state in the above case. That the kind of limitations we can avoid by using linknx.

Regards,

Jean-François

 
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 22, 2008, 09:12:37 am
you're right for the need in allowing more knx based protocol. be sure i am aware of the limitations of the lmce EIB.


however, i still don't see the interest in linknx:

giving a lamp another address (the state address group) is really not hard at all. you just go int the template in the webadmin, and instead of 6/0/1 your type 6/0/1|6/1/1 . then the config file is given both address

then, when your EIb part of lmce gets an order to the lamp it only reads "i need to send a COMMAND_POWER_ON " to the lamp, it gets its address(6/0/1) and then writes to the bus
on the other side, when the EIB part of lmce gets a telegram from the bus, is parses every peripheral it has been given the config, and according to that peripheral config, may send a message to the router (eg, when the lamp is switched on, it should send a EVENT_STATECHANGED 1 from the lamp DCE_id to the router. ). actually that is not yet the case, but it is really very easy to do(i had done it on the elder version of the source i had).
then one shall modify the LightingPlugin so that it recognizes the event from the lamp. the DCERouter actually doesn't keep the state of the devices in memory, but the plugins can: so you need to handle light events in the plugin, to 'centralize' them: thus the orbiter can ask the lighting plugin if the devices are switched on/off, or their %. and you may prevent the lightingplugin to listen to write orders on the lamp's order groupaddres, and instead make it hear the lamp's return groupaddress.


now, we only need to make the lightplugin handle return address instead of order address, and the lmce able to send/receive through knx. it is already able to make some discussion, but i have to let lmce communicate through other supports than com port(say, usb, ethernet, ..), plus let EIB send messages back(that one is VERY easy). for the 'other support', i am trying to implement eibd atm. but i have some matters with the source code atm..


so, maybe you could tell me how/what is linknx supposed to implement?
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on July 22, 2008, 12:22:51 pm
ok and in the case that the light don't switch off (error btw), the message is still send to other group adress !!
Title: Re: knx, linuxmce, eib part, ... help?
Post by: jef2000 on July 22, 2008, 02:20:38 pm
Hi,

Of course, if you add to lmce all that linknx could offer to it (storing the actual value, decoding binary messages coming from the bus, handle multiple group-adresses, ...) Then there is nothing more that linknx can offer. But If I understand correctly, the things you are speaking about are "not yet the case but would be really easy to do".
So my proposal was to have a quick solution based on GSD/ruby and linknx because it seems easy to do and doesn't need changes in lmce code. If nobody is interested in it, I'll put it in the fridge until I have a lmce core at home and decide at that time what's the best solution based on the alternatives that will be available then.

Good work,

Jean-François
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 22, 2008, 10:26:19 pm
now, we only need to make the lightplugin handle return address instead of order address, [...]
sorry, that's crap. All the KNX specifics must be encapsulated by the DCE device.

best regards,
Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 23, 2008, 09:18:08 am
what i see crap is that the plugin assumes that a lamp which has been sent the order 'set yourself on' is assumed to be set on 'on' mode. i mean, maybe the lamp is supposed to be put to 50%, not 100%, in case of a dimmable?

i propose that the plugin would try to understand if the lamp has more than one group address, and more than two in case of a dimmable. if not, it assumes the lamp to obey the message(so that non knx protocol could work). if yes, it drops off any order to write on that lamp, but instead considers the event 'EVENT_STATE_CHANGED' to know if/how to modify the lamp state.

or should the lighting plugin only listen to event from the lamp to the router, and anyhow assume the lamp has obeyed the order? then correct its state if it got a state_changed event?
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 23, 2008, 11:45:55 am
what i see crap is that the plugin assumes that a lamp which has been sent the order 'set yourself on' is assumed to be set on 'on' mode. i mean, maybe the lamp is supposed to be put to 50%, not 100%, in case of a dimmable?
therefore we have two light devices in lmce, a binary one and a dimmable.

Quote
i propose that the plugin would try to understand if the lamp has more than one group address, and more than two in case of a dimmable. if not, it assumes the lamp to obey the message(so that non knx protocol could work). if yes, it drops off any order to write on that lamp, but instead considers the event 'EVENT_STATE_CHANGED' to know if/how to modify the lamp state.
again, that is *crap*. The address specifics of every protocol _must_ be encapsulated in the dce device. Please look at the existing DCE interface devices to understand the concept.

Quote
or should the lighting plugin only listen to event from the lamp to the router, and anyhow assume the lamp has obeyed the order? then correct its state if it got a state_changed event?

hu? the lamp is your child device. Of course you have to send the proper events on state changes. The lighting plugin has handlers for that.

best regards,
Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 23, 2008, 12:07:06 pm
right, i consider DCEdevice like EIBdevice.. sorry.

i meant, that in the case of knx, it's not because a lamp has been sent the order to be 'on' that it is 'on' just after.

for instance, a dimmable lamp could be set to 75% when it receives a 'set on' command, instead of 100% - or even, return to the level it had before being switched off. or go to the level ordered by a sensor before. or.. well, i don't know, but behind a simple 'dimmable lamp' you can have some programmation already done.
you can even have lamp that could not be set under 10%, or for wich 'set off' means go from 20 to 5 in 5 min.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 29, 2008, 03:37:16 pm
hi

i'm proud to tell you i made something like the EIB but working with eibd.

it still isn't configurable, since i didn't touch the template. it gives the same things that gives the actual EIB, even if there seems to be some bugs still(maybe due to eibd itself ..)
actually i build it with the 710 branch's source, and took much fro the former EIB. to make it work you need to install the eibd:
http://www.auto.tuwien.ac.at/~mkoegler/index.php/eibdeb

thanx alot to hari who told me to use pthreads, i didn't know them before and.. well, they seem to work.

now i need to implement the real knx protocol, that is, listening from knx's lamps all the stuff to fire correct events. i need to change its template too, and then implement its configuration... but i don't know how to (i mean, i would need to use sqlcvs..)
how i am supposed to u/l the sources, btw?
the code is atm in 'debugging' mode; so the logs are VERY FULL. there is no more segfault atm, but it will for sure need more tests.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 29, 2008, 11:04:53 pm
cool, keep up your great work!

What exact device template changes are you thinking about?

best regards,
Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 30, 2008, 07:52:54 am
eibd needs to know what is the bus it uses to reach the knx:
eibd --help
(...)
supported URLs are:
ft12:/dev/ttySx
bcu1:/dev/eib
tpuart24:/dev/tpuartX
tpuart:/dev/tpuartX
ip:[multicast_addr[:port]]
ipt:router-ip[:dest-port[:src-port]]]
bcu1s:/dev/ttySx
tpuarts:/dev/ttySx
usb:[bus[:device[:config[:interface]]]]
(...)

atm i use eibd with ipt:192.168.80.130


i just need to fill the function
void EIB::getAway() in eib.cpp to modify string EIB.sgateway so that it gets the correct eibd format

so i would need:
either ppl to put the full line as arg,
or ppl to just fill the kind of connection to use, + the address
we could anyhow use the three, and modify sgateway according to what was filled. but i think the best would be to ask ppl to fill interface + address.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on July 30, 2008, 12:22:09 pm
hy gui,
please to hear you make a good job ;-)

Quote
now i need to implement the real knx protocol, that is, listening from knx's lamps all the stuff to fire correct events. i need to change its template too, and then implement its configuration... but i don't know how to (i mean, i would need to use sqlcvs..)
how i am supposed to u/l the sources, btw?
have a look there for checkin
http://wiki.linuxmce.org/index.php/SqlCVS

what do you mean by ppl ?
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on July 30, 2008, 02:33:36 pm
and here also:
sqlcvs webadmin that look nice
http://forum.linuxmce.org/index.php?topic=5758.msg34057#msg34057
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 30, 2008, 02:49:24 pm
"ppl" is normal linuxmce users.

when you install one dcedevice, you have to configure it. for eibd, you need to know how it connects to gateway. so users must enter either the fulla arg path to eibd, or the couple"bus/address"

and i can't u/l my sources on sqlcvs. only the sqltemplates. and i don't want to make things crash :/

i'm changing the EIB template now. then i will update my code to let users fill their configuration, and make some doc on my code. then i have to get newest templates in order to get a good knx implementation.(EVENT_Level_Changed ...)

then i should change the switch lamp, since it should not receive a COMMAND_SET_LEVEL when one tells it to be put to "on"..
anyhow, i still need to u/l my sources..
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on August 01, 2008, 12:56:02 am
ok, i remade the full code (but still used some part), to be able to make future changes more easy.

i still need to handle the sensors, but that's versy easy. and then, to test.. and make doc. the doc i am making should allow later changes in the templates, quite easily(made of how-to)

the installation is described in the README.txt

basically, i just need now to do some minor changes, then i will send a version to hari. hopping it will work on charon-merge, i have not been able to compile on it(sefgaults when loading getConfig() )


there still may be some bugs, such as memory lacks, i'm not used to map and vector use, plus the templates need to be done(several of them)


ps: i spent today 17H to rewrite the full code. but it was very funny! sure i liked this project!
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on August 01, 2008, 04:26:43 pm
sensors done( 1 min..) , READ command done(even if it doesn't exist in the sql), so that now when the EIB gets a connection, it asks to every child it owns it state

sending the file as a mantis bug report
http://mantis.linuxmce.org/view.php?id=4299

just untar the file, read the README
ther are some syntax errors with charon-merge source. need to put a m_ before each " mapParameterFind( "or smthg like this, not sure exactly about what has to be done.

i may work later on that, i think i got some issues yet(basically with eibd..)
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on August 01, 2008, 09:29:54 pm
nice to hear it, I'll have a look and I promised some cash for the guy who make the read command.
Just pm me paypal info, once I'll have the time to try I'll send you what you deserve
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on August 01, 2008, 09:57:27 pm
it was my "stage" so i didn't mean to be paid :)

plus, i am not sure if it works now. so i wouldn't want to get monney for something that may not work.

it works on 710 version(at least, mine). i need ppl to try to make it and use it on a charon-merge station. i can no more try it by myself, since i am in vaccancy and have no knx at home..
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on August 03, 2008, 12:09:50 pm
ok, so make it work... ;D
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on August 04, 2008, 09:48:40 am
i am in vacation now... and for 3 weeks.

i can't anymore try to compile/test. i keep thinking about what i could change(in the code), but it's just thoughts.
now i would need ppl to try to compile and test my program. all required is written in the README.. just need feedbacks to improve my work.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on August 04, 2008, 02:07:32 pm
ok, I will try!
thks
Title: Re: knx, linuxmce, eib part, ... help?
Post by: rages on September 05, 2008, 02:13:02 pm
Hi, I'm Italian KNX partner. Anyone try this new code in Linuxmce ? How I can try this ?   
Sorry for my english  :P
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hvac on September 06, 2008, 04:16:51 pm
and have no knx at home..

Hi,

do you need some devices / interface for online KNX tests ?
I can support ....

Regards
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on September 06, 2008, 05:47:25 pm
yeah, test devices would be great.

best regards,
Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hvac on September 06, 2008, 05:58:16 pm
Hello Hari,

in fact who needs devices: you or guigolum ? I mean where to send devices ?

Regards

George
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on September 07, 2008, 05:43:01 pm
i need device to work, but my boss should let me make some work more now. i just need to talk to him a bit, to work later. don't worry i have linuxmce, but i couldnt work in august(vacations)

i will post later.

rages: you should d/l the file i linked before, and then compile the source . actually it stil works only for the linuxmce 7.10, i need to be able to use the sources corectly and i think their was still some problmes with sources, wich didn't allow me to compile from next version's source. any how, i have had some thoughts in my vacations and i think i made really dirty programmer job, so i will surely rewrite parts of the code. when i have time, and fully fonctionnal material.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hvac on September 07, 2008, 06:01:17 pm
Hello guigolum,

OK ! when you will be ready, please let me know how we will proceed with devices to deliver.
I will wait

Regards
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on September 08, 2008, 11:00:07 pm
devices to deliver? hu?

well, i've decided to make a page on the wiki for an how-to install my EIB:
http://wiki.linuxmce.org/index.php/EIB(guigolum_version)
so that now i can modify the doc w/o having to change the full file.

later i will have to modify some other files too.

feel free to ask here or in the wiki discussion.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hvac on September 08, 2008, 11:08:35 pm
"and have no knx at home.."

....you wrote this - so I wanted to help, with delivery of some EIB devices for practical tests ....
I will read more carefully in future ...

Regards

George
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on September 09, 2008, 05:28:06 pm
i meant i was in vacations and thus could not work(i don't ever have a server to use for work). now i'm back to school, mickael can let me work and make improvments on lmce.

thank you however :) but if you want to help me, please try to use my program, and then tell me your feelings, and improvments i could do :)
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hvac on September 09, 2008, 09:15:58 pm
OK - I will give you our feedback - but this will be not sooner than in 1 month - I think. As we have quite big experience with EIB, but none with LinuxMCE, we are organizing Core, Media Directors, etc. for the moment.

Regards

George
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on September 09, 2008, 09:53:12 pm
in fact who needs devices: you or guigolum ? I mean where to send devices ?

I'd need a power supply (220V/50Hz), retardation coil, a bus conncetor with a FT1.2 rs232 interface and a few devices to test the driver on a test bench setup.
That would allow me to verify the new driver and integrate it into the trunk.

best regards,
Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hvac on September 11, 2008, 08:09:40 am
Hi,

where are you located (maybe address you can send me by mail or PM) ? And how long do you think you will need devices ?

Regards

George
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on September 11, 2008, 08:25:38 pm
where are you located (maybe address you can send me by mail or PM) ? And how long do you think you will need devices ?

i'm pretty busy so some weeks would be great. I won't install the stuff "in the wall", only arrange it on a testbed..

I'll pm you my contact details,

best regards,
hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: totallymaxed on September 11, 2008, 09:57:45 pm
where are you located (maybe address you can send me by mail or PM) ? And how long do you think you will need devices ?

i'm pretty busy so some weeks would be great. I won't install the stuff "in the wall", only arrange it on a testbed..

I'll pm you my contact details,

best regards,
hari

We have a working interface and driver in our test suite... we only have 5 x On/off devices, 2 x dimmer devices and a Thermostat. We are tidying up the integration with Web Admin and then will make it available.

Right now you need to know the port/channel no. for a device so the configuration does not auto-detect the devices on the bus... but if you know the port/channel no. then it works very well indeed. The driver if fully bi-directional so device data is reflected in for example the floorplan when its state changes and you can change the state of that device from the Orbiter.

We will commit this to the public svn over the weekend and do some docs for the Wiki.

All the best

Andrew
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on September 12, 2008, 04:01:44 pm
hum.. so basically i tryed to do some work that was already being done?

hmm :'(
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on September 12, 2008, 07:57:48 pm
dunno if the CHT driver uses eibd..

best regards,
Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on September 13, 2008, 11:35:13 pm
hum.. so basically i tryed to do some work that was already being done?

hmm :'(
exactly what is shitty on this collaboration!
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on September 13, 2008, 11:40:06 pm
We will commit this to the public svn over the weekend and do some docs for the Wiki.

All the best

Andrew
is it based on eibd ??
why did you not join guigolum, or at least communicates on this project? I guess there is many project on lmce that don't need everybody work on they own!

however it's another great news !
Title: Re: knx, linuxmce, eib part, ... help?
Post by: totallymaxed on September 14, 2008, 09:51:21 am
dunno if the CHT driver uses eibd..

best regards,
Hari

Hi Hari,

No we are not using eibd

Our code was written from scratch because a customer had a requirement for it. So we spent a few days writing it. Its almost all written in shell scripts with a small C app to speed up one function. It works nicely and is easy to support/change.

Anyway it will be up in the svn as soon as Radu has finished documenting it and tidying it up.

All the best

Andrew
Title: Re: knx, linuxmce, eib part, ... help?
Post by: totallymaxed on September 14, 2008, 10:00:22 am
We will commit this to the public svn over the weekend and do some docs for the Wiki.

All the best

Andrew
is it based on eibd ??
why did you not join guigolum, or at least communicates on this project? I guess there is many project on lmce that don't need everybody work on they own!

however it's another great news !

No its not based on eibd - see my response to Hari in this thread.

Well as I explained to Hari this was something we did for a customer project and therefore we needed to build it quickly. Also we wanted to test whether we could build something using shell scripts to extend the system in this way... so we tried it. It took a few days to test/debug. Originally we were not even sure whether we would make it publicly available. So for all those reasons, and probably 10 more, we did it the way we did.

All the best

Andrew

Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on September 14, 2008, 06:46:30 pm
ok,
and what are the interface upported ??
Quote
rs232 ft1.2
usb
ip router
regards

PS: could you email me the files, and doc you're are using at the momment, i need to show lmce with knx and I'm actually using http://sourceforge.net/projects/knxathome (with some change in orbiter)
thanks
Title: Re: knx, linuxmce, eib part, ... help?
Post by: totallymaxed on September 15, 2008, 03:11:04 pm
ok,
and what are the interface upported ??
Quote
rs232 ft1.2
usb
ip router
regards

PS: could you email me the files, and doc you're are using at the momment, i need to show lmce with knx and I'm actually using http://sourceforge.net/projects/knxathome (with some change in orbiter)
thanks

Hi ,

We currently have rs232 & usb working in our test setup. IP would be pretty easy to support too but its not there yet as our customer did not need it.

As soon as we have it ready for the svn I'll post an update here.

All the best

Andrew
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on September 15, 2008, 05:11:12 pm
ok, so great news for european community !

guigolum: your work are not useless ! I think making the project based on eibd should be, on a long term, easyest to maintain !
Title: Re: knx, linuxmce, eib part, ... help?
Post by: totallymaxed on September 15, 2008, 06:36:35 pm
hum.. so basically i tryed to do some work that was already being done?

hmm :'(

Well I guess so... but that can always happen. It doesn't mean your code is less valuable. We will post our code to the svn and then its up to the community whether they use it or not. We'll keep developing it and if others want to help with that that's great... but if they don't that's ok too.

Andrew
Title: Re: knx, linuxmce, eib part, ... help?
Post by: totallymaxed on September 16, 2008, 04:11:11 pm
Hi,

We have created a quick n dirty Wiki page about our bash-dce-knx code and how to install it on your Core as so many of you wanted it as quickly as possible ;-)

http://wiki.linuxmce.org/index.php/Bash_dce_knx (http://wiki.linuxmce.org/index.php/Bash_dce_knx)

The Wiki page is pretty complete and should give you enough info to install the package.

Enjoy!

Andrew/Radu
Title: Re: knx, linuxmce, eib part, ... help?
Post by: domotiqa.com on September 17, 2008, 08:54:47 am
let me say one things, great ! ::)
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on September 18, 2008, 05:52:50 pm
ok, i have several questions:

1) will you put the "shutters", "blinds" templates? actually, what templates your programm uses, and which of them do you add? i'd like to make my programm work on your specifications


2) how can i get sources of the next version lmce? i mean, i worked on the 7.10, but it seemed not to work with thelast version sources. there was some issues, or i didn't understand well, maybe. is the charon merge source compilable? i need to try and test my programm with the good sources :/
Title: Re: knx, linuxmce, eib part, ... help?
Post by: totallymaxed on September 18, 2008, 10:29:55 pm
ok, i have several questions:

1) will you put the "shutters", "blinds" templates? actually, what templates your programm uses, and which of them do you add? i'd like to make my programm work on your specifications


2) how can i get sources of the next version lmce? i mean, i worked on the 7.10, but it seemed not to work with thelast version sources. there was some issues, or i didn't understand well, maybe. is the charon merge source compilable? i need to try and test my programm with the good sources :/

Devices like 'Shutters' 'Blinds' etc will need to be added if you want them to behave correctly. We'll add some additional docs to the Wiki page to help you understand how to extend support to these types of devices.

For the new community svn try;

See http://wiki.linuxmce.org/index.php/Bash_dce_knx (http://wiki.linuxmce.org/index.php/Bash_dce_knx) for updated steps for using the new community svn.

Andrew
Title: Re: knx, linuxmce, eib part, ... help?
Post by: rages on October 15, 2008, 11:04:19 am
Hi,

I read the bash-dec-knx installation in the wiki, but when I write
"svn checkout http://svn.linuxmce.org/pluto/trunk/src/" or
"svn checkout http://svn.charonmedia.org/trunk/src/" it goes out me error.

Is there perhaps need of a permission to download?

the connection internet works because before I have download with the command
"wget http://diapub.com/files/bash-dce-knx.tgz"
Title: Re: knx, linuxmce, eib part, ... help?
Post by: totallymaxed on October 15, 2008, 12:03:54 pm
Hi,

I read the bash-dec-knx installation in the wiki, but when I write
"svn checkout http://svn.linuxmce.org/pluto/trunk/src/" or
"svn checkout http://svn.charonmedia.org/trunk/src/" it goes out me error.

Is there perhaps need of a permission to download?

the connection internet works because before I have download with the command
"wget http://diapub.com/files/bash-dce-knx.tgz"

Ooops my mistake... there was a typo in the path to the charanmedia trunk I posted here and on the Wiki. Sorry for that :-(

The correct command & path is as follows;
Code: [Select]
svn checkout http://svn.charonmedia.org/svn/trunk/ <return>

All the best

Andrew
Title: Re: knx, linuxmce, eib part, ... help?
Post by: rages on October 16, 2008, 06:43:31 pm
Thanks a lot Andrew.... to the next one  :P

Title: Re: knx, linuxmce, eib part, ... help?
Post by: rages on October 17, 2008, 01:49:28 pm
hi, you excuse but I have another problem...

I have succeeded in downloading with the command
"svn checkout http://svn.charonmedia.org/svn/trunk / "

footstep to the following command..  "Cp / usr / pluto / lib / * pluto / src / lib ", but it tells me that the directory "/ pluto / src / lib"  doesn't exist.


Title: Re: knx, linuxmce, eib part, ... help?
Post by: totallymaxed on October 17, 2008, 03:29:28 pm
hi, you excuse but I have another problem...

I have succeeded in downloading with the command
"svn checkout http://svn.charonmedia.org/svn/trunk / "

footstep to the following command..  "Cp / usr / pluto / lib / * pluto / src / lib ", but it tells me that the directory "/ pluto / src / lib"  doesn't exist.

When using the Charonmedia trunk the path must be changed for the destination directory as below;

cp /usr/pluto/lib/* trunk/src/lib <return>

All the best

Andrew


Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on May 24, 2009, 10:39:46 am
Heya guigolum,

dunno if you still read here but I was able to run your code with a few mods (stripped the eibd spawning thread and the getAway stuff). I'll test it and see how we can properly integrate it into 0810 over the next weeks.

best regards,
Hari
Title: New eibd based KNX driver
Post by: hari on May 24, 2009, 10:58:50 am
32bit binary replacement for 0810alpha is here: http://vt100.at/files/EIB-32bit-0810-binary

I'm running "eibd" on the core with the following command line (FT1.2 via usb/rs232 adapter in this example): eibd -i -R -S -T -D -u ft12:/dev/ttyUSB1

That allows to run ETS3 in parallel.

best regards,
Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: rages on May 26, 2009, 08:32:02 pm

what should I do with this binary file?

I have I said that I would have done tests, but certain aspects of linux still does not understand very well....

Emanuele
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 07, 2009, 04:03:33 pm
put it into the place of the old one.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 07, 2009, 04:04:07 pm
the float handling seems to be broken:
05   07/07/09 15:59:40.899      Set Temp Debug: value: 44.000000 <0xb67ffb90>
DEBUG: setting data from float: 44.000000
DEBUG: conversion: 19476 size: 2
DEBUG: converting ushort to float: 1.280000
DEBUG: conversion: 128 size: 2
05   07/07/09 15:59:40.899      Set Temp Payload: 1.280000 <0xb67ffb90>

br, Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: rages on July 07, 2009, 08:25:47 pm
ok my KNX works with linuxmce 8.10, but it is normal to read only when the orbiter is launched?
I use a FT1.2.

should not read every telegram that passes on the bus?

Rages
Title: Re: knx, linuxmce, eib part, ... help?
Post by: massabuntu on July 09, 2009, 06:23:51 pm
I think we could open a ticket, such as the dimming doesn't work too. :-\
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 09, 2009, 06:58:39 pm
don't forget thermostat :-)

the infrastructure in the driver is pretty much complete, we just need to fiddle a few bits and bytes. I hope I'll find the time to read into the specs soon. Any KNX wizards here that could give us some hints on EIS DPT?

br, Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 11, 2009, 10:16:32 pm
Ho my..
I took a look in my code, and am just .. well, I can't find the words. Sooo dirty.
May i try to modify it a bit? removing a big part of those macros..

I would need a way to compile on lmce however.(or i can develop w/o a dev environment, but can't ensure it will compile :p )

I received a mail telling me there was a bug with :
Quote
Here's the thing.
We notice a problem in dimming and floatpoint telegram. I explain... the "shortdata" (guessing is 1 bit boolean datatype) telegram works fine. In both direction, menaing the DCE > EIB > eibd > KNX chain works fine and the KNX > eibd > EIB > DCE too.

We have problem with "more than 1 bit datatype" value telegram.
I post two pair of example of Telegram sended One by EIB and one by ETS3.

1) ShortData - Switch ON a Lamp with adress 0/0/4 from 0.0.0 (wich is the pysical adress of eibd).

ETS3  ->  29 BC 00 00 00 04 E1 00 81
EIB     ->  29 BC 00 00 00 04 F1 00 81

Both of those working fine even there's a difference in the in the 7th byte.
Instead:
2) Set the value of the dimmer to 123 (50% in mce) from phy.adress 0.0.0 to 1/0/0 Value object of the dimmer.

ETS3  ->  29 BC 00 00 08 00 E2 00 80 7F
EIB     ->  29 BC 00 00 08 00 F2 00 80 00

The ETS one works, in fact we found the Level Value in the last byte (7F), the EIB one is broken, we didn't have (always 00) in the value Byte.

I think there's a problem in the function that Build the telegram.

Can u tell me where i can look for debugging? i looked in the 8.10 EIB-eibd source but i did'n found the problem.
"if my memory works fine", when sending a shortdata, a part of the bis are useless, but necessary to reach a given length(see CSMA/CD protocol, which requires the frames to be long enough to allow jamming repliance on an error).

i'd rather get the knx specifications for the second part though..

question:
what template did you use? "dimming lamp"?(if you don't understand my question, then i need to get a fresh look at lmce ^^ )
btw, does it work if you use shutters/blinders/drapes/thermostat template?

I didnt see any obvious bug(but my lack of using cpp templates and inheritance properly.. and my baaad english :p ), so it MAY be a bug from martin koegler's eibd.
what I actually did: I used another program(with the agreement from its creator), wich name is "eibd", and that translate telegrams to the port we use(such as usb, serial port..)
my programm only tells how lmce shall behave with that one program(it's a wrapper - and a weird one), both in emitting orders and in receiving datas. While emitting, on a dimming light, you have the following code in knxdevice.h:
Quote
class LightSwitchdimmable:public knxDevice
   {
      DEVICEHEADER( LightSwitchdimmable , 2, "\0\1" ) ;
      virtual Telegram *Command_On(){return createsTelegramFromAddress(1,0);};
      virtual Telegram *Command_Off(){return createsTelegramFromAddress(0,0);};
      virtual Telegram *Command_Set_Level(int level){return createcharTelegramFromAddress(level,1);};
   };
that means, a EIB lightswitchdimmable, when receiving the order "set_level' from lmce, will create a "char" telegram(that means, with a small data) with the data given inside, and send it to it's adress number "1"(so, the second one you fill in lmce administration pannel) with order "set".
the translation from lmce to the "knxdevice" (in my code) is made in function "EIB::ReceivedCommandForChild(args)" in file EIB.cpp, l113. Basically, what we do is:
- check if the device exists in lmce
- translate the data according to the order to send to this and the knxdevice we refer to. In the case of a set_lvl, the line 137 tells us we transalte the level in this way:"         int level= ((unsigned int)atoi(pMessage->m_mapParameters[COMMANDPARAMETER_Level_CONST].c_str())*255)/100;". that is, we use the parameter referenced by "COMMANDPARAMETER_Level_CONST" in the order sent, which is an int, and translate it from a % base ton a /255 base. maybe an error here, if the COMMANDPARAMETER_Level_CONST is not used in lmce.
so, what one should do is:
- add a spy to know if the data is well transfered(I mean, print the value of level on the logger on this line 137)
- if it works, print the ptel data after it is created, to see if it has a good shortdata. Actually, that is already done in the EIB log (/var/log/EIB ? can't remember), by the line 160 in EIB.cpp.
so, the code you may add is
Code: [Select]
LoggerWrapper::GetInstance()->Write(LV_STATUS, "  setlevel made lvl %i from data %s", level, pMessage->m_mapParameters[COMMANDPARAMETER_Level_CONST].c_str()); between l 137 and 138


btw there is an obvious leak in EIB.cpp, l 165. after "sendTelegram(ptel);", one should had "delete(ptel)" which is allocated on the stack


damn, this editing form is small..
Title: Re: knx, linuxmce, eib part, ... help?
Post by: massabuntu on July 12, 2009, 02:41:44 pm
In fact the fisrt thing i did was check if "data" contains the right value until the end, and actually it does. (is transformed to a 0 to 100 in a 0-255 scale in "EIB::ReceivedCommandForChild(args)" in file EIB.cpp, l113" and then goes to another function, i didn't remeber now which one,  but the data value is still correct".

For sure i have to clear myself the Knx Spec to a better understanding. But i suppose our problem is in the lenght of the telegram.

We know data is good but we see it is cutted off in the telegram, where the last byte is always "00".

For the compiling/testing i could help you if you doesn't have a lmce installed somewhere, but this way the thing could take muuucch time. Maybe in #irc we could make things faster.

I'm at your disposal.

Martino
Title: Re: knx, linuxmce, eib part, ... help?
Post by: massabuntu on July 14, 2009, 12:49:24 pm
YES! I saw  the problem and i found a way to fix it.

It's a little bit dirt beacuse it could don't work with other data type but now we know where we had the problem.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 16, 2009, 12:09:48 pm
may you explain me please?
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 16, 2009, 12:59:27 pm
http://svn.linuxmce.org/trac.cgi/changeset/22147
Title: Re: knx, linuxmce, eib part, ... help?
Post by: massabuntu on July 16, 2009, 01:03:41 pm
Look at http://svn.linuxmce.org/trac.cgi/attachment/ticket/278/Telegram.cpp

It's difficult to explain it in english but i try.
Look at
Code: [Select]
220 void Telegram::generate_head()
221 {
222         _data[2] = _data[0];
223         _data[0]=(_type>>8) & 0x3;
224
225         if(_type==EIBWRITE && _length==0)
226         {
227                 _data[1]=(_type & 0xff) | (_shortdata & 0x3f);
228         }else{
229                 _data[1]=_type & 0xff;
230         }
231 }
I added the row 222, because the 1 byte value was stored in data[0] and   after

Code: [Select]
_data[0]=(_type>>8) & 0x3;  we lost this value because data[0] become "0x00"

In  1 bit telegram (<6bit), our _length is 0,so we go on the if block, and data[1] become "0x80" in off case and "0x81" in the on case and the telegram total lengh is 9 byte (XX XX XX XX XX XX XX XX VV) VV could be 0x80 or 0x81.

In 1 byte telegram , we go on the else, our _data[1] become "0x80" but we need another byte to complete the Telegram ( That in >6 bit case is almost 1 byte longer than the <6 bit one)

So at the and we have a Telegram like:
XX XX XX XX XX XX XX XX 80 VV ( where VV is _data[2])

Sorry fer the raw explanation.

PS:Now the challenge is for the other DTP.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 16, 2009, 01:12:48 pm
added delete(ptel): http://svn.linuxmce.org/trac.cgi/changeset/22148
Title: Re: knx, linuxmce, eib part, ... help?
Post by: guigolum on July 16, 2009, 06:18:40 pm
:s i didnt even remember i had done that Telegram part...
(but now i remember i had some bad time translating the float value..)

well, thank you guy, i had not even tried to look in telegram.h/cpp.

what is the other problem now?
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 21, 2009, 11:34:57 pm
set temperature works after the following change:

Code: [Select]
Index: Telegram.cpp
===================================================================
--- Telegram.cpp (revision 22016)
+++ Telegram.cpp (working copy)
@@ -25,10 +25,10 @@
  if(_type==EIBREAD) return;
  _shortdata=0;
 
- _length=length=(length>MAXTELEGRAMDATALENGTH?MAXTELEGRAMDATALENGTH:length);
+ _length=length=(length>MAXTELEGRAMDATALENGTH-2?MAXTELEGRAMDATALENGTH-2:length);
  for(int i=0;i<length;i++)
  {
- _data[i]=data[i];
+ _data[i+2]=data[i];
  }
  generate_head();
 }
@@ -77,8 +77,8 @@
 
 int Telegram::getUserData(unsigned char *buffer, int maxsize) const
 {
- int leng=(maxsize<_length?maxsize:_length);
- for(int i =0;i<leng;i++) buffer[i]=_data[i];
+ int leng=(maxsize<_length-2?maxsize:_length-2);
+ for(int i =0;i<leng;i++) buffer[i]=_data[i+2];
  return leng;
 }
 
The generate_head was overwriting the first 2 byte of userdata..

br, Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 21, 2009, 11:42:40 pm
(this obsoletes the previous fix)
Title: Re: knx, linuxmce, eib part, ... help?
Post by: massabuntu on July 22, 2009, 09:22:40 pm
yeah, so let me understand, now we are ok with dimming and temp?

Later we have to discuss about the much higher number of KNX Object and the few who are handled by LinuxMCE.

Massabuntu.
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 22, 2009, 10:08:28 pm
yes, dimming and set temp works now. The actual implementation already handles multiple GA per device..

br, Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: hari on July 22, 2009, 10:10:26 pm
ah i forgot, my biggest problem at the moment is that I can't do the "bcuaddrtab -w 0" via ft12 on my interface. I get an error. Maybe the problem is that I never programmed a physical address into it (as I lack a second bcu).

br, Hari
Title: Re: knx, linuxmce, eib part, ... help?
Post by: massabuntu on July 22, 2009, 10:24:10 pm
To program the phys addr of  an interface u need another interface.

Well done for the implementation, tomorrow i'll update it on my core and i'll test some others telegram type.

Title: Re: knx, linuxmce, eib part, ... help?
Post by: rages on July 23, 2009, 06:38:41 pm
Hi,
   
If I understand what you mean martino, is not exact.
Simply connect the ets and write the address of the interface as local.
       
(if you want to how to give the address to a new virgin and without the other already programmed).

Emanuele