Artnet DMX module

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

Vorheriges Thema - Nächstes Thema

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);
   }