jeffreykog / artnet-hue-entertainment

Near-realtime ArtNet control over Signify/Philips Hue lights using the new Hue Entertainment API
MIT License
41 stars 11 forks source link

Listening on all artnet universes #4

Open GavinDMXSetup opened 2 years ago

GavinDMXSetup commented 2 years ago

The recent suggested update to use a configuration file looks like a really good idea. If you do implement this, would it be possible to add the ArtNet Universe to the configuration file as well? This would solve the problem I mentioned before of my Hue lights responding to commands sent to control my DMX lights which are on a different universe. I use a 3 Showtec Net 2-3 interfaces on different Artnet universes. It seems it would be quite straight forward to implement by someone that knows what they are doing, unfortunately I don't have the skills to know how to do this correctly. I have just hacked the module called controller.js to ignore anything that isn't destined for Artnet universe 0. This works for my setup, but I know this isn't the correct way of implementing this. In case it helps, this is the change I made to the onSocketMessage method in controller.js

onSocketMessage(socketType, msg, rinfo) {
    const packet = protocol_1.decode(msg);
    if (!packet) {
        return;
    }
    if (packet instanceof protocol_1.ArtDmx) {
    if (packet.universe == 0) {     //GTB
          this.emit("dmx", packet);
    }                   //GTB
    else {              //GTB
    return;             //GTB
    }
    }
    else if (packet instanceof protocol_1.ArtPoll) {
        this.sendArtPollReply();
    }
    else if (packet instanceof protocol_1.ArtPollReply) {
    }
    else {
        console.log(packet.toString());
    }
}

It would be great if this came from the proposed configuration file and was implemented by someone who knows how to do this correctly.

Thanks.

UPDATE: After days of trying to understand what was going on and an hour after posting the message below, I finally figured out what was happening. I think it is just a matter of you not having got around to parsing the universe network yet. As you say, it's a work in progress. I've found a place to insert a couple of lines of code to make it ignore DMX data that's not for ArtNet universe 0. Everything is working as expected now. You've created a great project.

Thanks.

I think my problem is probably just because this project is still a work in progress, rather than a bug. But I thought I'd raise it anyway, just in case.

I've got 10 hue lights in my entertainment group and so far, they all seem to be working fine with my DMX software via the artnet-hue-entertainment script. The problems occur when I try and add proper DMX lights to another ArtNet universe. The artnet-hue-entertainment script appears to be listening to the data on all ArtNet Universes rather than just one.

My DMX lights are connected via an external Ethernet ArtNet to DMX interface. I've set a unicast IP address in my software for the interface and for the hue-entertainment controller, but this hasn't helped.

I've also tried moving my two DMX lights to different DMX addresses so they don't overlap with hue lights, even though they are on a different ArtNet universe. That helps a bit as it seems to stop data for the DMX lights going to the hue lights, but they are still affected by other data my control software sends out. If I completely disable the output to the ArtNet universe the DMX lights are attached to, then the hue lights work fine.

The hue lights respond no matter what universe I tell my controller they are on.

I don't know Javascript, but it looks as if at the higher level functions of the code an ArtNet network number isn't being configured, though at the lower levels it seems to be aware of the network parameter. I feel that by hard coding a line that says IF UNIVERSE == x THEN ... I'd get a temporary work around. Though I really don't know where to insert it without it potentially messing something else up.

As I said, I think this is most likely just something you haven't got around to implement yet.

Great piece of work, well done. It's been something I've been looking for ever since I found I wanted to expand my light system beyond what hue was capable to doing. Thanks for your efforts.

Gavin

jeffreykog commented 2 years ago

Thanks for your report. This is indeed still a work in progress project, but what you're reporting should not be too hard to fix. My idea is that the configuration file will contain a global universe option, which would solve your issue.