Artnet DMX module

Begonnen von zevnik, 17 Januar 2014, 00:54:32

Vorheriges Thema - Nächstes Thema

zevnik

Hi all,

if anyone is interested, I've written a very basic Artnet module for FHEM, which works well with Ulrich Radig's artnet and dmx modules. You can download it from http://code.google.com/p/fhem-artnet/

Now I have two questions:
1. I wanted to control my artnet with homematic wandsender via notify, but for every click I get two notifies in fhem. I solved this with ignoring any commands within 600ms after a successful command received. Is this OK?
2. I want to implement dimming functionality in my module. This means I need to change artnet values at least 25 times per second. I wanted to start a separate thread for this, but my Perl on Synology doesn't support threads. Is there any other recommended way of doing this in fhem?

Thanks.

rudolfkoenig

1. Check the events more carefully, and change the notify regexp, to only match one of them.
2. Try to use InternalTimer, and if it is not enaugh, then BlockingCall

zevnik

#2
@rudolfkoenig: thanks, InternalTimer works as a charm, I always thought, I cannot use it for sth, which needs to be run every 0.04 seconds:)

One more questions. I guess this artnet module might benefit also other users. What all do I need to do, to get it in the main branch?


I need to correct myself: on my synology, this InternalTimer doesnt work fast enough, to dim lights smoothly. Do you think BlockingCall would solve the issue?

rudolfkoenig

I can check it in the contrib directory if you wish.

If the module is documented, and you are ready to support it for some time, then it should be part of the fhem/FHEM directory, which is automatically distributed with the update command. You should send me your sourceforge account in this case, and I'll give you write-permission to the SVN.

rudolfkoenig

ZitatDo you think BlockingCall would solve the issue?

Not sure about it. BlockingCall creates a separate process, so "longrunning" notifies/modules wouldn't block your task. OTOH it may be that you simply cannot execute your code 25 times per second on the Synology, and you either have to optimize it, or choose a faster/compiled language.

There is an apptime command which may help you in searching for the bottleneck.

zevnik

Hi,

I've just redone it for blocking call and now dimming works on synology too, it is fast enough, it manages to refresh data also with 50Hz. Thank you for your help.

I'd like to contribute sth back to the community, so yes, I am willing to support the module, and if possible, get your feedback regarding the documentation and coding style.

File can be found here: http://code.google.com/p/fhem-artnet/source/browse/trunk/20_ARTNET.pm




rudolfkoenig

Please send me your sourcefource account.

Some feedback to your module:
- presetting attributes by a module is wrong: the user should have the ability to leave them empty, and the default value should be specified in the module in the AttrVal() call.
- setting attributes in Initialize is doubly wrong: attributes belong to an instance, and not (yet?) to a module, in Initialize you do not have the name of the instance.
- setting attributes in NotifyFn is even more wrong: the user has no chance in ever changing it.
- by setting $hash->{NOTIFYDEV} in DefineFn to global you will be only called for global changes (this is a new feature to avoid unnecessary calls).
- DefineFn: did I mention that setting attributes by the module is wrong?
- GetFn is not yet finished, and CUL should be changed.
- when returning the set/get error message, you can specify optional widgets (dropdown/slider/etc) for FHEMWEB, see http://fhem.de/commandref.html#webCmd for details

zevnik

Thank you for your feedback, so basically I just need to stay away from setting attributes everywhere:)

One more question. I would like to redo artnet so that it will consist of two parts, artnet (as iodevice) and artnet_fixture as a light or other device connected via this ioidevice.

I've defined these in artnet:
# Provider
$hash->{ReadFn}  = "ARTNET_Read";
$hash->{WriteFn}  = "ARTNET_Write";
  $hash->{Clients} = ":ARTNET_FIXTURE:";


and in fixtures i call
ZitatAssignIoPort($hash);

but I can't seem to find, how to communicate between modules (when calling set function in fixture, how does this get transfered to artnet write function).

thanks.

rudolfkoenig

The FHEM two-level model:

- the physical module opens the device, and its ReadFn is called after the global select reports, that data is available.
- on Windows select does not work for devices not connected via TCP, here is a ReadyFn function necessary, which polls the device 10 times a second, and returns true if data is available.
- ReadFn makes sure, that a message is complete and correct, and calls the global Dispatch() with one message
- Dispatch() searches for a matching logical module (by checking $hash->{Clients} or $hash->{MatchList} in the physical module, and $hash->{Match} in all matching logical modules), and calls the ParseFn of the logical module
- ParseFn parses the data, sets all readings via the readings*Update functions, and returns the name of the logical device. When the readings*Update functions are called by ParseFn called by Dispatch, no event triggering is done, contrary to calling them directly (without Dispatch on the call stack).
- Dispatch triggers the event-handling for the device returned by ParseFn.

The IODev entry (assigned by AssignIoPort) is only relevant when sending messages, and is evaluated by the IOWrite call, which should be used in the logical device. This is the other way (logical -> physical).

If there is no direct communication between the logical and the physical module (e.g. calling functions directly, checking $hash entries, etc), then you can stack modules (e.g. for routers like RFR) or use FHEM2FHEM:RAW to connect two FHEM installations.

zevnik

Rudolf hi,

after the flu and other processes I am back at working on the artnet module.
And I have one further question:
-I have one physical module which connects to artnet and has all the channel states available,
-then I have logical modules which controll the states of channels on physical module
--one logical module will be RGB (so I can use RGB color picker)
--other module is plain dimmer.

Both of these logical modules are using basically the same functions, they differ only in some definitions. How do I make an "abstract" module, which is then extended by these specific implementations? One idea is to have this "common methods" available in physical module.

Is there a similar implementation already somewhere in the code?

rudolfkoenig

ZitatOne idea is to have this "common methods" available in physical module.
Go ahead, this sounds reasonable.

ZitatIs there a similar implementation already somewhere in the code?
Not that I am aware of.

Try to avoid calling functions beside "Dispatch()" and "IOWrite()" for communication between the logical and the physical module, else you loose the ability to use FHEM2FHEM in RAW mode with autocreate and set ability.
Data from Dispatch() called by the physical module is passed to the ParseFn() of the logical module, and data from IOWrite() called by the logical module is passed to the WriteFn() of the phyiscal module.

justme1968

i'm not sure if this is what you mean by similar but maybe a look at the withings, netatmo, swap and hue modules gives you a few ideas that are applicable to your concept also.

the whitings and netatmo modules operate each in 3 different modes where one is the 'physical' and the others are the 'logical' module level. and they share a lot of code.

the swap module can be extender by more specialized swap modules that will overwrite parts of the module hash in the initialize function but reuse nearly all of the define, parse and dispatch code and extend the set and get functions with callbacks that are called from the general swap module.

one more option is to use only one module for your two clients and have a model or subtype attribute to switch between the colorpcker and dimmer incarnations. in the hue module a subtype of switch, dimmer or colordimmer switches the behavior of the device between a simple on/off switch a 1 channel dimmer and the full color enabled version.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

zevnik

@justme1968: great. I totaly forgot about subType. That's what I am implementing.

But currently I am stuck with dispatch from physical module.
I am dispatching within SetFn (since artnet isn't returning its state):

#ARTNET_FIXTURE - logical client
sub ARTNET_FIXTURE_Parse($$) {
my ( $hash, $msg ) = @_;

Log3 undef, 3, "Got msg " . $msg;

my @ret = (0);
return @ret;
}



#ARTNET - physical master
my %addvals;
my $msg = "ARTNET " . $state;
Dispatch($hash, $msg, \%addvals); # we send message to our logical devices


Problems I have with dispatch:
- I keep getting "artnet: Unknown code ARTNET 1414170000, help me!" (ARTNET 1414170000 is message I am sending)
- which means my artnet cannot find clients, I tried setting $hash->{Clients} = ":ARTNET_FIXTURE:" without success,
- by manually setting my $shash = $defs{'argb'} dispatch gets to ARTNET_FIXTURE but it produces the same error (help me!)
- from the code I think it is checking the return value from parse call (!int(@ret)), but I believe it never even comes to the code, since I don't get anything in my log.

Any help is appreciated :)

justme1968

if the parse function did accept a dispatched message it should return a bin empty list with the devices the message was intendet for. then the dispatch loop over all devices will succesfully stop.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

zevnik

I am little fresh with perl&fhem, so I apologize for beeing noob.

1. how do I tell ARTNET which clients are bound to it (there can be multiple ARTNET devices, so probobaly when FIXTURE connects, it should fill ARTNET->{Clients} list with something, but with what?).
2. then ARTNET sends Dispatch(self, "message", <unknown parameter?>),
3. dispatch goes through ARTNET->{Clients} and calls ParseFn function of FIXTURE
4. and then FIXTURE's ParseFn should return bin empty list? so it should return "@ret = (); return @ret" ?

I think I am missing something very obvious, or just still too fresh with fhem.

rudolfkoenig

1)
In the first round Dispatch() checks each $physicalmodule->{Clients}, if the coresponding $logicalmodule->{Match} matches the raw message. But in order to check this, $logicalmodule must be loaded.

If none of the already loaded modules feels responsible for a message, then the $physicalmodule->{MatchList} is examined. If an entry is matched here, then the corresponding (logical) module is loaded, and fed with the raw message.

For a simple Clients/MatchList example see the 00_ZWDongle.pm, and 10_ZWave.pm for a simple Match entry.
A lot more complex example is 00_CUL.pm with its clients.

2) the third parameter is a hash of additional readings for the logical device like RSSI.
3) correct, see above.
4) ParseFn should return the name (or list of names) of FHEM-Instances affected by the raw message. Or undef in the unlikely case that Match matches, but the module is not responsible. Or "UNDEFINED <define-data>" if the instance is not yet defined, but it could be created by autocreate.

macmattes

hallo bekomme das Modul nicht geladen, weil presets fehlen.
gibt's da nen trick?

Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 153, near "}) "
Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 154, near "}) "
Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 178, near "};"

zevnik

@macmattes: Ich habe jetzt meine Produktionversion aufgelladen. Kanst du noch einmal probieren?

Ob es geht noch immer nicht, dann sende mir bitte deine define line.

macmattes

hallo geht noch nicht

define artnet ARTNET 172.16.1.207 1,2,3,4,5,6

2014.04.26 13:33:12 0: Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 146, near "}) "
Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 147, near "}) "
Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 170, near "};"

zevnik

Wann passiert das?
Ist das beim senden des "artnet next" Kommando oder beim definieren des artnet?

zevnik

Noch eine Idee, kannst du die ARTNET.save File löschen (in FHEM/log)?

macmattes

Hallo der Fehler kommt direkt nach dem definieren in der set funktion,
wenn ich die genannten Zeilen auskommentiere, und einen Eintrag davon ändere. dann lässt sich dass Modul laden aber kein Preset speichern.
#$setOptions{ "preset_load:" . join(",", sort keys $hash->{PRESETS}) } = 0;   
#$setOptions{ "preset_remove:" . join(",", sort keys $hash->{PRESETS}) } = 0;
my @scenePresets = sort keys $hash->{PRESETS};  ->  my @scenePresets = "1,2,3"
einfach nur um dem futter zu geben.

die ARTNET.save hab ich nirgends gefunden weder im FHEM ordner noch im Log ordner, bei mir /var/log/fhem/

dass Modul versucht Presets zu laden die es noch nicht gibt, ich hatte zwischdurch mal dass Glück ein Presetsatz anzulegen, dann hab ich fhem gesichert und alles wieder zurückgeändert, beim laden kam der Fehler dann wieder.
wird die Artnet.save als Presetablage benutzt?

vielleicht hilft es ja einen Presetsatz beim definieren anzulegen? mit fiktiven werten.

zevnik

Genau so. ARTNET.save ist ein ablage für ARTNET Szenen (die kann mit next und prev rotieren).

So sieht mein ARTNET.save file. Es soll in die gleiche Mape wie fhem.save sein.
Ich will suche für die Fehler, aber bei mir, es funktioniert auch ohne ARTNET.save file.

Ich will ein Paar log werten noch eingeben und wenn Sie Zeit haben noch einmall probieren?

macmattes

hallo

hab die ARTNET.save mal nach /var/log/fhem/ und /usr/share/fhem/ kopieert, aber da lädt sich noch nichts, ich muss zu hause mal ins log schauen was genau passiert, melde mich dann wieder
wäre schon cool wenn ich dass Modul ans laufen bekomme

macmattes

hallo

define artnet ARTNET 172.16.1.207 1,2,3,4,5,6
Cannot load module ARTNET
reload 20_ARTNET
Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 146, near "}) "
Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 147, near "}) "
Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 170, near "};"

ARTNET.save hab ich mehreren Ordnern probiert /var/log/fhem /usr/share/fhem usr/share/fhem/FHEM

anscheinend findet artnet die Datei nicht?
die rechte sind jeweils immer die selben wie für alle anderen Dateien

zevnik

Ich habe neue Version auf google code eingeladen. Habe ein Paar debug Infos eingelegt. Kanst du Artnet noch einmal definieren und senden debug log?

macmattes

#26
hi

hat leider nicht geholfen
das Modul lädt gar nicht erst

Error:Modul 20_ARTNET deactivated:
Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 172, near "}) "
Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 173, near "}) "
Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 197, near "};"
Type of arg 1 to keys must be hash or array (not hash element) at /usr/share/fhem/FHEM/20_ARTNET.pm line 472, near "}) "

habe auch fhem mal in ein Debuglog umgeleitet, da kommt aber nichts an.


zevnik

Was für eine Version des Perl benutzen Sie? Wenn <5.14, dann sehe ich warum.
Ich habe nocheinmal eine neue Version auf google aufgeladen.

macmattes

ah so,
hatte noch perl 5.12 am laufen versuche es jetzt mal mit 5.18

macmattes


macmattes

r7 hat folgende Fehler ich werde jetzt mal alle anderen Versionen probieren
perl ist jetzt 5.18 mit json, er lädt auch die ARTNET.save


Global symbol "$modules" requires explicit package name at /usr/share/fhem/FHEM/20_ARTNET.pm line 472.
syntax error at /usr/share/fhem/FHEM/20_ARTNET.pm line 472, near "$modules{ARTNET_FIXTURE"
syntax error at /usr/share/fhem/FHEM/20_ARTNET.pm line 472, near "}) "
Global symbol "$devName" requires explicit package name at /usr/share/fhem/FHEM/20_ARTNET.pm line 473.
syntax error at /usr/share/fhem/FHEM/20_ARTNET.pm line 475, near "}"
Global symbol "$state" requires explicit package name at /usr/share/fhem/FHEM/20_ARTNET.pm line 477.
Can't use global @_ in "my" at /usr/share/fhem/FHEM/20_ARTNET.pm line 482, near "= @_"
Can't use global @_ in "my" at /usr/share/fhem/FHEM/20_ARTNET.pm line 492, near "= @_"
syntax error at /usr/share/fhem/FHEM/20_ARTNET.pm line 497, near "}"
Can't use global @_ in "my" at /usr/share/fhem/FHEM/20_ARTNET.pm line 502, near "= @_"
/usr/share/fhem/FHEM/20_ARTNET.pm has too many errors.

macmattes

r4 r5 r6 laden problemlos, aber jetzt hab ich ein Problem, dass mir fhem stirbt wenn ich sinne Preset lade oder speichere, oder wenn ich on oder off setzen will
ich muss mal weiter testen

macmattes

welche perl Module sind denn erforderlich?
hab diese hier gefunden:
Data::Dumper
Time::HiRes
JSON
???
beim laden/speichern der Savedatei oder beim on/off/toggle stürzt Fhem komplett ab, im log ist dazu aber nichts zu finden
habe jetzt r6

zevnik

Hallo,

was für eine Hardware Platform benutzen Sie?
Ich habe jetzt Modul auf Windows7 + Perl5.18 und auf Synology Linux + Perl5.8.6 mit default Settings und es funktioniert auf beiden Systemen problemloss.

Beim abstürzen, bekommen Sie etwas in Console?
Habe auch eine neue Version aufgeladen.

@rudolf: haben Sie noch eine Idee was können wir probieren?

macmattes

hallo
bei mir läuft fhem auf osx 10.9 server mit jetzt perl5.18 und postgres 9.3 für dblog aus dem macports paketen, ,

kurios war, dass es sich nach dem upgrade auf Perl 5.18 definieren liess, die Channelwerte liessen sich einstellen, ich konnte einen preset erstellen und laden.
fhem gesichert, neu gestartet, und dann kamen die abstürze.
es wir auch nichts geloggt wenn fhem stirbt, auch nicht mit "fhem.pl > /var/log/fhem/debug.log"
ich hatte mal einen merkwürdigen log eintrag , etwas wie DEBUG: near $VAR1 "} , hab das aber nicht im Modul finden können, wird dann wohl nicht dazu gehören.
hatte auch erst im Modul gesehen dass ich einige CPAN Module nachladen musste, obwohl das Modul ohne meckern geladen wurde,
vielleicht fehlen da welche oder funktionieren nicht richtig?
zbsp json?

macmattes

#35
so hab jetzt r8 drauf, stürzt nicht ab, lädt den preset, speichern geht,
sieht bis jetzt gut aus

finde die presets noch nicht in der ARTNET.save? wann werden die da reingeschrieben? im modul sehe ich sie schon.

melde mich wenn ich wieder zu hause bin

rudolfkoenig

Zitat@rudolf: haben Sie noch eine Idee was können wir probieren?

I'm not exactly sure what the problem is but:
- keys %$hash->{PRESETS} should be written as keys %{$hash->{PRESETS}}
- "Log3 undef,..." should be replaced with "Log3 $hash,..."
- I can save/restart without problems, but after loading I get a
ZitatUse of uninitialized value $decoded in concatenation (.) or string at ./FHEM/20_ARTNET.pm line 524.
Needless to say, that I do not have an ARTNET device, and the content of the log/ARTNET.dd.save file is
#Wed Apr 30 07:19:08 2014
undef


This is with the current (v8?) version.

zevnik

I've changed code as per @rudolfkoenig suggestions.  I haven't tested the code without json support, I've copied the loading/saving part of presets from lightscene module.

@macmattes: so you're saying the code works now for you? The presets are saved when you click "save config".

macmattes

hi the code from today r9 is a little bit wrong;
line 107 and 483 needs a little change  ->  ARTNET_Save($hash);
now it works , perfect, i will try now the functions.
in fhem i miss now the color picker ?!  i see only the defined name  then the channelstatestring and on/off
if i click on this channelstatestring i get only a bulb symbol, i mean there was an color picker in the past, right?

what is levels and channels for?
i want to control my 3 led strands with each 20 pixels on a ethersex with artnet/ws2801 module.

i have some further ideas:
i use artnet with broadcasting on x.x.x.255 with different universes for each ethersex. therefore i can control all of them with on software (pixel controller), with virtual panels, maybe you can split your module into the socket/io part and a led/pixel module based on this socket. then it should be possible to use some different universes at once, where it is possible to use the same panel/univers more then once in one network. (spome aniels shows the same copied)
hope it will be possible to wrap some channels as pixel, then you need to define only 170 pixel / instead of 512 channels (in my case thats 60 pixels instead of 180 channels)

your module is a very good work , and a needful extension for fhem. thanks, hope you can work further on it.
it will help to reduce the used shell scripts for controlling light equipment

sorry for my bad englisch

zevnik

Thanks for your correction. My production fhem computer is currently dead, so I am not testing the version much, just trying to get a build which would be useful :)

"attr artnet rgb" should give you rgb picker in frontend (@rudolfkoenig: I am not sure, if there is a default for this to have it display colorpicker without defining attribute).

channels is set value for each channel, syntax is: <channel>:<value>,<channel>:<value>, .... so you can change named channel to a named value.
levels was my first artnet setter implementation, there you define channel values in order as they were defined
example:
define artnet ARTNET 10.0.0.1 1,3,4,2
"set levels 10,20,30,40" is equivalent to:
"set channels 1:10,3:20,4:30,2:40

I have artnet and artnet_fixture already in development, but needs some polishing before making it alpha :)
Fixture defines a subset of artnet channels as a virtual device and there you can define it as a colordimmer, where you get a colorpicker for this fixture. I hope this is someting you are looking for.

macmattes

hi, there was something missing on initialize

after   FHEM_colorpickerInit();

     $attr{$hash->{NAME}}{webCmd} = AttrVal($hash->{NAME}, "webCmd", $defaults{webCmd});
     $attr{$hash->{NAME}}{dimDuration} = AttrVal($hash->{NAME}, "dimDuration", $defaults{dimDuration});
     $attr{$hash->{NAME}}{frequency} = AttrVal($hash->{NAME}, "frequency", $defaults{frequency});

now attr can be defined as before also the color picker is working,
as i found the color picker works only on 3 defined channels (1,2,3 or 30,31,21 .... ) not for the whole 180 or x channels , it may need to define the count of channels per pixel (3rgb 4rgbw 5rgbww...) and maybe the order of them rgb bgr or other.)
is it possible for you to extend the color picker for all channels with the simple rgb order for the first?

justme1968

there is a short post about the colorpicker and how to integrate it in the wiki.

the colorpicker currently is ohne for rgb. not rgbw or rgbww.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

zevnik

As per @rudolfkoenig suggestion I removed all definitions of attributes, maybe I removed too many :), I guess you've figured it out, that you need to define artnet channels in RGB order if you want colorpicker to work correctly (first listed channel is red, then blue and last green).

One thing I wasnt able to integrate is after reloading the page, colorpicker shows FFFFFFF again and not the set color.

I will make my artnet_fixture module, which wil support this kind of configuration (multiple RGB). But you will have to define all the channels anyway:)

So you'd like to define a device with 3x60 channels (RGBx60), and then control them with one color picker? So all of them will have the same color?
How many universes are you using? Currently artnet is fixed to universe 0. You'd need to define one artnet module per universe (per physical device). And fixture is then virtual device, which consists of subchannels of the artnet module.

macmattes

>>So you'd like to define a device with 3x60 channels (RGBx60), and then control them with one color picker? So all of them will have the same color?
Yes you are right, i use 60 pixels as roof light at my terrace, it would be good to define the color of all pixels at once with the color picker.

i use currently 3 universes, one for the terrace, a second for window christmas lights in the sleeping room and the next is planned for the bathroom roof lightening. more will follow.
till now i controlled them with pixelcontroller -> ola (open lightening) -> art net broadcast on 172.16.1.255
on your fhem module i use currently the ip of the terrace ethersex , because of the broadcast on 255 seems not work.
but if you want to drive different devices with different ip's, then you need to broadcast, because you can't open the same network port for different ARTNET defines. that's the reason for my request to split the ip part from the led driver code.
then it should be possible to use one base module to broadcast different universes, which will be driven by multiple defines each with one universe.
hope this will be possible in the future

macmattes

for the first , this does his job :-)

   } elsif ($arg eq "rgb") {
      $arg = "levels";
      my @rgb = ( $a[2] =~ m/../g ); # split string every two characters
      
      my @newRgb;      
      foreach (@rgb) {
         push(@newRgb, hex($_));      
      }
      my @data;
      foreach (@{$hash->{channels}}) {
         push(@data, @newRgb);         
      }
      #$a[2] = join(",", @newRgb);
      $a[2] = join(",", @data);
   }

macmattes

hi
it looks like a little bit buggy, because, the presets are lost sometimes. i do not know why.
and also the module lost the attributes:
  artnet: unknown attribute frequency. Type 'attr artnet ?' for a detailed list.

hmmm?

sebi87

Can I conterol different RGB channels independent?

zevnik

Zitat von: sebi87 am 10 Mai 2014, 09:31:59
Can I conterol different RGB channels independent?
Yes you can. You can control each of the 512 channels independately. If you use just 3 channels for RGB, then you can also use the new collorpicker.

zevnik

Zitat von: macmattes am 04 Mai 2014, 09:28:06
hi
it looks like a little bit buggy, because, the presets are lost sometimes. i do not know why.
and also the module lost the attributes:
  artnet: unknown attribute frequency. Type 'attr artnet ?' for a detailed list.

hmmm?

I am sorry to hear that. I just hate it, when it works for me and it doesn't work for you. I've never lost presets so far, do you have json support installed? I haven't played with attributes, but will try to check it this weekend and publish a virtual artnet devices module.

macmattes

Hi
sorry for my late answer, i was busy.

the current  software state is not a big problem for me. don't know why the presets are lost.
i do not use the preset function at the moment, only the random mode triggered by a at timer , or the color picker to set the color of all pixels of my terrace.
in this case a good piece of software, and it does his job
hope i can test your further releases.

zevnik

I love the presets, so I can switch between them on a normal rocker switch (or having presets rotated by a timer :)).
If you have chance and check if you have json support enabled, it would help me a bit.

ext23

Hi,

did anybody know if it is possible to read out the current channel values out of the Art-Net Node? So currently I use the DMX4All USB Controller and with it, its possible so read out the current values. So if you use more that one tool for DMX Control it is much easier to syncronize the channel state between the tools. But I plan to switch to ArtNet Node (http://www.ulrichradig.de/home/index.php/avr/dmx-avr-artnetnode)
Please correct me if I'm wrong, for my understanding with ArtNet you can only send the complete frame with all channels instead of a single channel. So If I want to change only channel 10 then I need to know all values of the other channels too to create the frame to sent. Isn't it?

BR
Daniel
HM, KNX, FS20, 1-Wire, PanStamp, AVR-NET-IO, EM1000EM, PCA301, EC3000, HM-LAN, CUL868, RFXtrx433, LGW, DMX @Ubuntu-Server (Hauptsystem) & Raspberry Pi (Satellit)

zevnik

Zitat von: ext23 am 08 September 2014, 10:39:23
Hi,

did anybody know if it is possible to read out the current channel values out of the Art-Net Node? So currently I use the DMX4All USB Controller and with it, its possible so read out the current values. So if you use more that one tool for DMX Control it is much easier to syncronize the channel state between the tools. But I plan to switch to ArtNet Node (http://www.ulrichradig.de/home/index.php/avr/dmx-avr-artnetnode)
Please correct me if I'm wrong, for my understanding with ArtNet you can only send the complete frame with all channels instead of a single channel. So If I want to change only channel 10 then I need to know all values of the other channels too to create the frame to sent. Isn't it?

BR
Daniel

I was looking for a simillar answer. I would like to know the state of DMX channels on the ARTnet side (synching data between multiple controllers), but I couldn't find any command in the spec (http://www.artisticlicence.com/WebSiteMaster/User%20Guides/art-net.pdf), so my FHEM would show current state, even if my lights were controlled by other controllers.

My idea was, to ask Ulrich Radig to implement non standard extension and broadcast DMX state back to the network (Maybe by sending ArtDmx message with its state to a different Universe).

Alternatively, I'll make FHEM listen to artnet messages and correct its internal state to match the transmitted data.

ext23

OK, I also read the spec and didn't found anything ;-)

So asking Ulrich for an quick and dirty implemation could be a solution but that means that all have to use the special ArtNet Node from Ulrich and no other one from another vendor :-(

Dump the network for that information is an interesting way but will only works in not switched networks.

In meantime I'll try to write an own FHEM module for my Mini-USB-DMX Controller. I don't know how as there are only limited informations available for writing a module but OK, I'll try it ;-)

BR
Daniel
HM, KNX, FS20, 1-Wire, PanStamp, AVR-NET-IO, EM1000EM, PCA301, EC3000, HM-LAN, CUL868, RFXtrx433, LGW, DMX @Ubuntu-Server (Hauptsystem) & Raspberry Pi (Satellit)

zevnik

Zitat von: ext23 am 08 September 2014, 15:18:10
OK, I also read the spec and didn't found anything ;-)

So asking Ulrich for an quick and dirty implemation could be a solution but that means that all have to use the special ArtNet Node from Ulrich and no other one from another vendor :-(

Dump the network for that information is an interesting way but will only works in not switched networks.

In meantime I'll try to write an own FHEM module for my Mini-USB-DMX Controller. I don't know how as there are only limited informations available for writing a module but OK, I'll try it ;-)

BR
Daniel

rudolfkoenig is very helpful in answering any questions regarding modules. If it is of any help, you can always take my first artnet module and explore from there, or upgrade it with your ideas.

One other sollution is also, that you don't control DMX_ARTNET node directly, but make an artnet gateway in fhem, which would listen on universe 0 and retransmit data to universe 1 (where your dmxartnet is listening), and then on universe 0 in fhem, you have all the control data your controllers are sending, and then you can decide how to logically merge them. EG.: you know, that channels 1,2,3 belong to RGB in kitchen, 4,5,6 belong to RGB in living room. If you receive only data for channels 4,5,6 (1,2,3 have value of zero), you merge that data with existing kitchen values and retransmit them.

If there will be any other active developer on artnet, we might get some actual work done. At the moment, I am too busy with my regular work to have any time for developing artnet module (not mentioning my lack of knowledge of perl and fhem).

justme1968

there is a page about module development in the wiki: http://www.fhemwiki.de/wiki/DevelopmentModuleIntro. some information about colors on the fhem side is here: http://www.fhemwiki.de/wiki/Colorand a little bit about fhem and dmx is also here: http://www.fhemwiki.de/wiki/DMXControl.

as them is not a realtime system and should not constantly process huge amounts of data i think fhem itself should not send and receive the complete dmx stream(s) but control a daemon/gateway/whatever that should be as independend as possible and only receive control data from them. preferably there is even an small abstraction layer that would make the fhem module in depend of the actual dmx hardware/controller used.

  andre
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

Elektron

Hello,

I've tried the modul and get the following Error-Message:
     2014.10.04 16:49:47 1: reload: Error:Modul 20_ARTNET deactivated:
     Excessively long <> operator at ./FHEM/20_ARTNET.pm line 144.

    2014.10.04 16:49:48 0: Excessively long <> operator at ./FHEM/20_ARTNET.pm line 144.

Any Tip for me what I'm Doing wrong?

with kind regards
Michael

zevnik

Hi,

could you please provide me with your define statement and the environment where you're running the fhem (OS, perl version)

Elektron

Hi Zeldi,

Thankyou for your fast reply
I've found the reason. I've downloadet die 20_Artnet.pm via wget.
But when i opened the .pm-File I saw that i've downloaded the html-Page and not the PM.

Sorry for the false alarm.

Michael

Elektron

Hi,

After the first problem is solved, nowi'm back with the next question...
I want to use the module with the ola-demon. Has anyone tried this bevor?

Wen I try to connect i get the message in the logfile "error opening socket: Adress already in unse"

Michael

Elektron

Hi Zeldi,

Today i've done some more test.
After some Wireshark and tcpdump analysis I've got it work but only when OLA and FHEM are not on the same Device!
When OLA and FHEM are running on the same Device (RaspberryPi in my Case) i get the Error Message.
Independet on what IP-Address I use. (127.0.0.1 or the "real" IP)

Any sugestions how I could get it work?
I think FHEM and OLA on the same Device with a simple FTDI-RS485 Interface should be a cheap solution...

With kind regards
Michael

zevnik

Hi,

artnet client by default opens UDP socket on local port 6454 (which is supposed to be in standard), but I can change it, so you can test it (or you can change it in line 324).

Elektron

Hi,

you are right, when i woke up this morning i thought the Problem is that source- an destination-Port are the same.
And the destination-Port as allready used by the olad.

Thank you for your Support!
Michael

Elektron

Hi,

I've changed the Source-Port in Line 324 and now it works fine.
With the usage of OLAD the FHEM-ARTNET-Module is compatible with nearly all DMX-Interfaces including simple FTDI-Interfaces.
If I find some time I'll write an Wiki-Artikle...

Thank you for your Help!
Mochael

zevnik

Hi,

can you just clarify: OLA daemon's purpose is controlling the lights via DMX. DMX are sent over RS485, which connected locally on the machine? And it's feed is artnet, that's why you are using my ARTNET module? Great to hear that.

So you are connecting to localhost OLA listener? I'll make a change in the code, to find next available port if 6454 is busy.

Can you just please describe your usage scenario? Because I have a plan of dividing the module into virtula/physical part, so you could define multiple autonomous lights (fixtures) which are then controlled be the same artnet physical interface. Which means you can use standard RGB or white dimmer options available already in FHEM.

But since, I don't need that option that much, development is ofcourse very slow:)

Elektron

Hi Zeldi,

Im using olad www.opendmx.net to send DMX-Telegrams over a simple FTDI-Based USB-RS485-Adapter.
OLA supports many different DMX Interfaces an use Artnet as Input...
FHEM and OLAD are running on an RaspberryPI.
Via DMX I control 2 LED-Par64 spots. 6-Channel (RGB, brightnes, strobe).

I also want to control later some WS2801 via the SPI-Interface of the Raspberry-PI

Michael

macmattes

Hi Zeldi

i have added the Universe Option
as already said i use different artnet->ws2801 modules each with an other ip and different universes,

i have one request. i use > 100 channels , therefore it will be good to disable the channelstate string in the webview

oldicke

Hi,

please can help one?
when it comes to German

oldicke

define ArtNet0 ARTNET 1.0.0.200 0

geht leider bei mir nicht,bekomme immer die meldung

wrong syntax: define <name> ARTNET ip[:port] universe comma_separated_channels

was mach ich falsch?

ext23

Da fehlen doch noch die Kanäle...
HM, KNX, FS20, 1-Wire, PanStamp, AVR-NET-IO, EM1000EM, PCA301, EC3000, HM-LAN, CUL868, RFXtrx433, LGW, DMX @Ubuntu-Server (Hauptsystem) & Raspberry Pi (Satellit)

zevnik

Zitat von: oldicke am 05 Mai 2015, 14:13:03
define ArtNet0 ARTNET 1.0.0.200 0

geht leider bei mir nicht,bekomme immer die meldung

wrong syntax: define <name> ARTNET ip[:port] universe comma_separated_channels

was mach ich falsch?


define ArtNet0 ARTNET 1.0.0.200 0  1,2,3,4

für die aktive Kanäle die du brauchst.

zevnik

Zitat von: macmattes am 29 November 2014, 21:27:57
Hi Zeldi

i have added the Universe Option
as already said i use different artnet->ws2801 modules each with an other ip and different universes,

i have one request. i use > 100 channels , therefore it will be good to disable the channelstate string in the webview

Maybe I finally find some time to improve the module. And also take your suggestion into account.

oldicke

#72
Zitat von: zeldi am 06 Mai 2015, 12:00:39

define ArtNet0 ARTNET 1.0.0.200 0  1,2,3,4

für die aktive Kanäle die du brauchst.

habe denn noch die meldung

wrong syntax: define <name> ARTNET ip[:port] universe comma_separated_channels

omg

jetzt geht es mit: define ArtNet ARTNET 192.168.178.13:6454 0 1,2,3

muss ich für jede Universe ein "defin ArtNet" anlegen?
und wie kann ich 150 leds gleich zeitig steuern?  :-\ (ws2812) strips

zevnik

Ich denke ich weiss wo liegt ein problem:
meine originäle version hat ein Syntax von:  define ArtNet ARTNET 192.168.178.13:6454 1,2,3 (ohne universe)
patch von @macmates Syntax ist: define ArtNet ARTNET 192.168.178.13 0 1,2,3 (mit universe)

Wie 100 artnet Modules steuren? Hm..., Artnet module ist zurzeit ein 1:1 interface zum Artnet device.
Kan ws2812 LEDs auf eine Broadcastaddresse zuhören?

Ich denke diese Kombination könnte funktionieren:
led1:universe=0:channel=1,2,3
led2:unverse=0:channel=4,5,6
led3:universe=0:channel=7,8,9
define ArtNet ARTNET 192.168.178.255 1,2,3,4,5,6,7,8,9

oldicke

#74
Hallo,

habe eine andere Lösung gefunden.

ich habe 4 led rgb streifen. für jeden rgb streifen eine Universe, da meine ArtNet-box nicht RGB macht habe ich sie
in GRB angeben müssen.

define initialUsbCheck notify global:INITIALIZED usb create
define ArtNet1 ARTNET 192.168.178.13:6454 1 1,0,2
define ArtNet2 ARTNET 192.168.178.13:6454 2 1,0,2
define ArtNet3 ARTNET 192.168.178.13:6454 3 1,0,2
define ArtNet0 ARTNET 192.168.178.13:6454 0 1,0,2


so kann ich jeden Streifen einzeln ansteuern. (ws2812b) aber immer nur ein Kanal (0,1,2)= 1 led.
jede weitere led ein Kanal mit z.B. (3,4,5). Ist sehr aufwendig. :(

gibt es eine andere Lösung ?

zevnik

Also, wie möchtest du die Streifen steueren?

oldicke

#76
Zitat von: zeldi am 07 Mai 2015, 23:24:30
Also, wie möchtest du die Streifen steueren?

hi Zeldi

I want to roam with Android control. (app "NetIO")
do not know what is possible.

nibblerrick

Hi,

I am new in FHEM but interested to integrate DMX fixtures. I haven't an overview about this in FHEM till now, but I try to get one. Therefore I asked in the german section here http://forum.fhem.de/index.php/topic,39717.0.html but no answer so far (yeah, I have to wai a bit more, was yesterday).

But in this thread you are presenting the Artnetmodul, and I will try it, if tomorrow an Artnetinterface is delivered.
In the Code at google there are, if I realize that correctly, the last changes a year ago. So either the module is abandoned or it is stable.
Can you tell something about that? The other thing I found is here https://github.com/fdemmer/fhem-artdmx - so this seems to be  different module, but also for Artnet. Or is it the same or one based on the other?
Would be great, if things can get cleared up a bit.

Thanks

Elektron

Hallo Oldicke,

Hast Du zu dem Thema schon etwas Neues?
Wie steuerst Du die Stripes? Per FHEM?

Vielen Dank und Grüße Michael


Zitat von: oldicke am 07 Mai 2015, 22:17:48
Hallo,

habe eine andere Lösung gefunden.

ich habe 4 led rgb streifen. für jeden rgb streifen eine Universe, da meine ArtNet-box nicht RGB macht habe ich sie
in GRB angeben müssen.

define initialUsbCheck notify global:INITIALIZED usb create
define ArtNet1 ARTNET 192.168.178.13:6454 1 1,0,2
define ArtNet2 ARTNET 192.168.178.13:6454 2 1,0,2
define ArtNet3 ARTNET 192.168.178.13:6454 3 1,0,2
define ArtNet0 ARTNET 192.168.178.13:6454 0 1,0,2


so kann ich jeden Streifen einzeln ansteuern. (ws2812b) aber immer nur ein Kanal (0,1,2)= 1 led.
jede weitere led ein Kanal mit z.B. (3,4,5). Ist sehr aufwendig. :(

gibt es eine andere Lösung ?

Niel

#79
Hallo zusammen!

Ich habe mal dieses Modul ausprobiert und es würde für mich ausreichen, aber:

Es sendet genau ein DMX-Universe aus, beim nächsten set kommt "Error opening socket: Die Adresse wird bereits verwendet..."

Weitere set-Befehle werden mit "Artnet0 dim process is still running" geloggt. Es erfolgt keine Ausgabe mehr.

Der Socket wird vermutlich durch das Modul selbst geöffnet, daher funktioniert die erste Ausgabe.

Danach erkennt es vermutlich nicht, dass es selbst den Port noch geöffnet hat oder er wurde nicht geschlossen.

Hat jemand einen Hinweis, woran das liegen könnte?

Danke und Grüße

Niel


Edit:

Kaum fügt man ein "reuse => 1" in den Socket mit ein funktioniert es.

Niel

Next Problem:

The readings are named: Chan_000, Chan_001, ...

But Chan_000 is DMX-Channel 1, Chan_001 is DMX-Channel 2, ...

Is there a way to fix it?

Greetings

Niel

maiknms

Hallo Niel,

ich nutze das Modul auch und mit FHEM 5.7 läuft es . Mit FHEM 5.8 habe ich die selben Fehlermeldungen.
Wo genau fügst Du "reuse => 1" in der 20_ARTNET.pm ein ?
Würde das Modul gerne mit deiner Modifikation für FHEM 5.8 nutzen.

Gruß

Maik