Helvar Router

dali
helvar
digidim
Tags: #<Tag:0x00007fe0579a1160> #<Tag:0x00007fe0579a0f30> #<Tag:0x00007fe0579a0c10>

(Angelos) #5

that’s some really good progress !

and I prefer TCP over UDP for such integrations

Now… all you need is: a developer who has a similar DALI system to start creating a Helvar binding :slight_smile:
(although I am sure that you can make it work with the existing TCP Binding)


(Ole) #6

Yes I made it work, but it produces some errors. But I can control the device and set the scenes. :slight_smile:

Sitemap:
Switch item=Dali label=“Dali” mappings=[ON=“ON”]
Switch item=Dali2 label=“Dali2” mappings=[ON=“ON”]
Switch item=Dali3 label=“Dali3” mappings=[OFF=“OFF”]

Items:
Switch Dali “Dali” {tcp=">[ON:192.168.1.230:50000:’>V:2,C:11,G:1,K:1,B:1,S:1,F:900#’]"}
Switch Dali2 “Dali 2” {tcp=">[ON:192.168.1.230:50000:’>V:2,C:11,G:1,K:1,B:1,S:3,F:900#’]"}
Switch Dali3 “Dali 16” {tcp=">[OFF:192.168.1.230:50000:’>V:2,C:11,G:1,K:1,B:1,S:16,F:900#’]"}

I’m not sure why, but you need the > in the string that is getting sent as well as in the beginning or it will not work.

08:43:41.265 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘Dali’ received command ON
08:43:41.759 [WARN ] [ding.tcp.protocol.internal.TCPBinding] - Cannot parse input >V:2,C:11,G:1,B:1,S:1,F:900# to match command ON on item Dali2
08:43:41.762 [WARN ] [ding.tcp.protocol.internal.TCPBinding] - Cannot parse input >V:2,C:11,G:1,B:1,S:1,F:900# to match command ON on item Dali
08:43:41.764 [WARN ] [ding.tcp.protocol.internal.TCPBinding] - Cannot parse input >V:2,C:11,G:1,B:1,S:1,F:900# to match command OFF on item Dali3

I’ve tried to create a mapping file with no luck.

default.map:

V:2,C:11,G:1,B:1,S:16,F:900#=ON
V:2,C:11,G:1,B:1,S:1,F:900#=ON
V:2,C:11,G:1,B:1,S:3,F:900#=OFF
ON=>V:2,C:11,G:1,K:1,B:1,S:1,F:900#
OFF=>V:2,C:11,G:1,K:1,B:1,S:16,F:900#


(Angelos) #7

try to escape it with \ (or \\) not sure if it will work…

Switch Dali "Dali" {tcp=">[ON:192.168.1.230:50000:\>V:2,C:11,G:1,K:1,B:1,S:1,F:900#`]"}


(Ole) #8

Nope does not work. Because i send ASCII characters Helvar will think that I am sending the \ character. But i think the problem is the reply from the server and not the transmission.
If i look at the error and use wireshark i see that it is the reply it’s complaining about.

Sending:

V:2,C:11,G:1,K:1,B:1,S:1,F:900#

Error:

V:2,C:11,G:1,B:1,S:1,F:900#

As you can see it is missing the “K:1” parameter in the string. When I analyze the transmission with wireshark i see that the string without the “K:1” parameter is the reply from the Dali router.

So i guess the problem is the handling of the response.


(Angelos) #9

My opinion:
No, it shouldn’t be. openHAB2 does not care about the response. It doesn’t expect it.
It just sends an ASCII string to a TCP destination (one way comms). You need to see (with wireshark) if the ASCII message originating from OH2 is the same as the one that you originated and succeeded before (using a bash script?)


(Ole) #10

Here is the same command using Packet sender:
As you can see #3 is the packet i send to the Dali router, #2,1 is the response from the router.


(Angelos) #11

the problem is the missing >

did you try to escape it with \ ?


(Ole) #12

I’ve tried this:

Produces an error:
Switch Dali “Dali” {tcp=">[ON:192.168.1.230:50000:’\>V:2,C:11,G:1,K:1,B:1,S:1,F:900#’]"}
Switch Dali “Dali” {tcp=">[ON:192.168.1.230:50000:\’>V:2,C:11,G:1,K:1,B:1,S:1,F:900#’]"}

No error but it does not work. I see in Wireshark that the message is wrong:
Switch Dali “Dali” {tcp=">[ON:192.168.1.230:50000:’\>V:2,C:11,G:1,K:1,B:1,S:1,F:900#’]"}
Switch Dali “Dali” {tcp=">[ON:192.168.1.230:50000:\’>V:2,C:11,G:1,K:1,B:1,S:1,F:900#’]"}


(Angelos) #13

try with double escape (or even triple)

Switch Dali "Dali" {tcp=">[ON:192.168.1.230:50000:'\\>V:2,C:11,G:1,K:1,B:1,S:1,F:900#']"}
Switch Dali "Dali" {tcp=">[ON:192.168.1.230:50000:'\\\>V:2,C:11,G:1,K:1,B:1,S:1,F:900#']"}

what is the diff between the first 2 lines and the bottom 2 lines in your post above?

Ps: When posting configs, use Code fences


(Ole) #14

I see the forums does not like the the fore slashes :stuck_out_tongue:

first line is there are 1 fore slash. Second line is 2 fore slashes.

first two lines have the quote before the slash. Second have the quote after the slash.


(Angelos) #15

(Ole) #16
Produces an error:
Switch Dali "Dali" {tcp=">[ON:192.168.1.230:50000:'\>V:2,C:11,G:1,K:1,B:1,S:1,F:900#']"}
Switch Dali "Dali" {tcp=">[ON:192.168.1.230:50000:\'>V:2,C:11,G:1,K:1,B:1,S:1,F:900#']"}

No error but it does not work. I see in Wireshark that the message is wrong:
Switch Dali "Dali" {tcp=">[ON:192.168.1.230:50000:'\\>V:2,C:11,G:1,K:1,B:1,S:1,F:900#']"}
Switch Dali "Dali" {tcp=">[ON:192.168.1.230:50000:\\'>V:2,C:11,G:1,K:1,B:1,S:1,F:900#']"}

(Angelos) #17

time for a triple escape ! :slight_smile:

Careful with the position of the single quotes (')


(Ole) #18

Why do you have the single quote outside of the ]? this gives me a error.

Switch Dali "Dali" {tcp=">[ON:192.168.1.230:50000:'\\>V:2,C:11,G:1,K:1,B:1,S:1,F:900#]'"}

By the way triple slashes does not work :stuck_out_tongue: the only way i get it to work is where it produses the parse input error :stuck_out_tongue:


(Angelos) #19

typo… I edited the post above :slight_smile:

ok… .let’s try another trick:

Switch Dali "Dali" {tcp=">[ON:192.168.1.230:50000:'MAP(ASCII.map)'"}

install MAP transformation and use: /etc/openhab2/transform/ASCII.map

ON=>V:2,C:11,G:1,K:1,B:1,S:1,F:900#

play with escape chars :slight_smile:


(Ole) #20

Ok, I got it to work.
Had to escape the : as well as the >

Sitemap:

		Switch item=Dali1 label="Dali 100%" mappings=[ON="100%"]
		Switch item=Dali2 label="Dali 50%" mappings=[ON="50%"]
		Switch item=Dali3 label="Dali 0%" mappings=[OFF="0%"]

Items:

Switch Dali1 "Dali 100%"     {tcp=">[ON:192.168.1.230:50000:'MAP(Dali1.map)']"}
Switch Dali2 "Dali 50%"      {tcp=">[ON:192.168.1.230:50000:'MAP(Dali2.map)']"}
Switch Dali3 "Dali 0%"       {tcp=">[OFF:192.168.1.230:50000:'MAP(Dali3.map)']"}

Dali1.map

ON=\>V\:2,C\:11,G\:1,K\:1,B\:1,S\:1,F\:900#
\>V\:2,C\:11,G\:1,B\:1,S\:1,F\:900#=ON
\>V\:2,C\:11,G\:1,B\:1,S\:3,F\:900#=ON
\>V\:2,C\:11,G\:1,B\:1,S\:16,F\:900#=OFF

Dali2.map

ON=\>V\:2,C\:11,G\:1,K\:1,B\:1,S\:3,F\:900#
\>V\:2,C\:11,G\:1,B\:1,S\:1,F\:900#=ON
\>V\:2,C\:11,G\:1,B\:1,S\:3,F\:900#=ON
\>V\:2,C\:11,G\:1,B\:1,S\:16,F\:900#=OFF

Dali3.map

OFF=\>V\:2,C\:11,G\:1,K\:1,B\:1,S\:16,F\:900#
\>V\:2,C\:11,G\:1,B\:1,S\:1,F\:900#=ON
\>V\:2,C\:11,G\:1,B\:1,S\:3,F\:900#=ON
\>V\:2,C\:11,G\:1,B\:1,S\:16,F\:900#=OFF

(Angelos) #21

good job dude!

it’s complex but it works :slight_smile:

Now for the next challenge: use a Dimmer Item Type and try to find a way to send a variable mapped command to set dynamically from 0% to 100% the light at the DALI endpoint :slight_smile:

By the way: Since you are not collecting the status from the DALI endpoint (not < incoming tcp), you don’t need the reverse maps (from … to ON etc)


(Ole) #22

Tried to get the dimmer to work with no luck :stuck_out_tongue:
I am having trouble with the binding only accepting ON OFF in the command parameter. If you use anything else it will return an error.
And you need to pass the dimmer value to the string that you are sending.
L:60 is the percentage 0-100% for the light value you wish to set. Here it is set to 60%

>V:1,C:13,G:17,L:60,F:9000#

Btw, you need to have the reverse maps or else it will produce the errors again. Here i removed the reverse maps from Dali1.map

15:01:57.470 [WARN ] [orm.AbstractFileTransformationService] - Could not transform '>V:2,C:11,G:1,B:1,S:1,F:900#' with the file 'Dali1.map' : Target value not found in map for '>V:2,C:11,G:1,B:1,S:1,F:900#'
15:01:57.473 [WARN ] [ding.tcp.protocol.internal.TCPBinding] - Cannot parse input >V:2,C:11,G:1,B:1,S:1,F:900# to match command 0 on item Dali_full

(Kenny S ) #23

Hey, i’m working with these controllers every day and would like to create a binding for them, there are tons more commands with you could use as to discover all of the groups/devices that excist on the controllers and also get feedback from the current states of each dali device individually. I’m not familiar with the openhab ecosystem so if anybody would care to help I would be willing to help out. I’ve got most of the discovery stuff ready in a node.js app, but as said I’dont really know how to transform this into a binding.

grts ,
Kenny


(Angelos) #24

Now you 2 guys need a binding developer who uses these DALI Routers to join your team and you have the right mix :slight_smile:

You can always start by reading https://www.openhab.org/docs/developer/contributing/contributing.html & checking the forum @ https://www.eclipse.org/forums/index.php?t=thread&frm_id=271 but it’s not easy… I know