sciencegey / python_artnet

Easy-to-use python receiver for artnet
MIT License
3 stars 0 forks source link

Not receiving any DMX data #4

Open jmjohnn opened 4 months ago

jmjohnn commented 4 months ago

Hey there, sorry if this is the wrong place to ask for help :(

I'm trying to pull DMX information from my DJ decks via Art-Net to control some lights, but unfortunately I can't grab any packets containing DMX data. With debug on, this is the only output I get:

poll! b'Art-Net\x00' b'\x00!' 10 10 10 1 b'6\x19' b'14' 0 0 43981 0 48 b'\xf0\x7f' b'python_artnet\x00\x00\x00\x00\x00' b'python_artnet\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' 1 128 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 b'\x00\x00\x00' 0 b'\xaa' b'\xbb' b'\xcc' b'\xdd' b'\xee' b'\xff' 0 0 0 0 0 13 192 0 b'\x00\x00\x00\x00\x00\x00' 0 44 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' sent!

This output repeats over and over with none of the bytes changing at all.

Python-artnet is indeed showing up as an interface on my DJ decks, so obviously something is communicating back and forth, but I can't seem to get any data other than what's above. Any help or insight would be super appreciated as I'm super unfamiliar with Art-Net and maybe you might have an idea of what's going on :( Thank you!

sciencegey commented 4 months ago

The output you're seeing there is the packet that the program sends so that other devices on the network know it exists (hence why it's showing up in your software).

It sounds like you're either not sending data, or sending it (or listening) to the wrong universe. Can you provide some more details about what you're trying to send from, and include the code (or at least the relevant parts) that you're trying to use to receive art-net data?

jmjohnn commented 4 months ago

Thanks for the reply! I'm using the example receiver code.

import time
import sys
import python_artnet as Artnet

debug = True

# What DMX channels we want to listen to
dmxChannels = [1,2,3,4,5,6,7]

### ArtNet Config ###
artnetBindIp = "0.0.0.0"
artnetUniverse = 0

### Art-Net Setup ###
# Sets debug in Art-Net module.
# Creates Artnet socket on the selected IP and Port
artNet = Artnet.Artnet(artnetBindIp, DEBUG=debug)

while True:
    try:
        # Gets whatever the last Art-Net packet we received is
        artNetPacket = artNet.readPacket()
        print("Looked for packet.")
        # Make sure we actually *have* a packet
        if artNetPacket is not None and artNetPacket.data is not None:
            print("We have da packet")
            # Checks to see if the current packet is for the specified DMX Universe
            if artNetPacket.universe == artnetUniverse:
                # Stores the packet data array
                dmxPacket = artNetPacket.data

                # Then print out the data from each channel
                print("Received data: ", end="")
                for i in dmxChannels:
                    # Lists in python start at 0, so to access a specific DMX channel you have to subtract one
                    print(dmxPacket[i-1], end=" ")

                # Print a newline so things look nice :)
                print("")

        time.sleep(0.1)

    except KeyboardInterrupt:
        break

# Close the various connections cleanly so nothing explodes :)
artNet.close()
sys.exit()

My Denon SC Live 4 is broadcasting art-net data through the built-in SoundSwitch program on the OS, but I'm not super sure what address it broadcasts to. I tried 0.0.0.0 since the comment in the code says that is "all interfaces" but maybe that doesn't mean what I think that means haha. If I try the IPv4 address of the Denon unit in the code, Python says OSError: [WinError 10049] The requested address is not valid in its context

Thanks for the help, I really appreciate it!

sciencegey commented 3 months ago

artnetBindIp = "0.0.0.0" indicates which address the receiver should listen on (for example, if you have a computer with multiple interfaces, you can select which one in connected to the Art-Net network). Unless you know you need that, you can just leave it as 0.0.0.0 :)

You need to make sure your controller (or whatever device is sending the Art-Net data) is : a) Connected to the same network as the PC you're running the receiver on and b) Is on the same IP subnet at the PC you're running the receiver on (for example, if your PC is at 192.168.1.x, then the controller also needs to be on 192.168.1.x. By default, Art-Net uses 2.x.x.x, so you'll need to check the configuration on the controller to make sure it's getting the correct IP address)

You could try using another program (such as ArtNetView, QLC+, or DMX Workshop) to see if they can receive the data correctly from the controller; this'll help to see where the issue is.