Why can't I see the "other" heartbeat messages from Python?

I am sending heartbeat messages from a companion computer (an Arduino board relaying Mavlink messages through the FC’s TELEM2 port). I can see these from the MAV Inspector in Mission Planner under compid=195. However I can’t see them from a Python script running in MP. The script only detects the HEARTBEAT messages from the primary component (compid=1).

I am missing something… what is it?

Here’s what I am doing in Python:

# Subscribe to HEARTBEAT messages
MAV.OnPacketReceived += PacketHandler

def PacketHandler(o, message):
    try:
        if message.msgid == MAVLink.MAVLINK_MSG_ID.HEARTBEAT:
            print "HEARTBEAT: " + str(message.sysid) + " " + str(message.compid)
            print dir(message)
    except Exception as inst:
        print inst

Any thoughts as to what might be wrong above?

I think I figured it out. The msgid that I was testing against was incorrect. It needs to be:

if message.msgid == MAVLink.MAVLINK_MSG_ID.HEARTBEAT.value__:

instead of:

if message.msgid == MAVLink.MAVLINK_MSG_ID.HEARTBEAT:

Long sigh… you gotta love Python… :frowning: