Open Jibun-no-Kage opened 1 month ago
So reviewing more of the code examples, i.e. tally-str.py. I can adapt the code from tally-str, to my needs to generate the applicable MQTT messages I want to send to my tally status receiver device, i.e. phone app, etc.
However, I still have one question... So the BMD API has no event driven mechanism its self? I did not seem to find such in the BMD API... but I am not very conversant with BMD API. You always, in some way, have to poll the ATEM switcher for status? Looking at your code examples. The 'events.py' example suggests that there is some type of event mechanism native to the BMD API? But the resulting data structure passed to the OnReceive call back seems limited? Cannot see any source status information returned?
So if I use the 'events.py' code logic to capture an event, OnReceive callback, say a program change, then I would have to use some of the code from tally-str.py, to get the state of the given source desired? Then in turn generate the applicable MQTT message. Is this the most efficient method? I want to get the source state for a single source, but I don't want to generate all the network traffic a polling methodology generates. Is there a way I can extract the source state, from what is returned to the OnReceive call back? Looking at the raw data returned it does not seem obvious that tally state is returned as part of the data OnReceive gets, or am I wrong about this?
Basically I just want to see when a given source, say 3, is on air or on standby or not. My current understanding is OnReceive will get an event say for program change or preview change, but I then have to request the source state as additional coding.
Question: Is there a defined event for when a switcher tally status changes? Is this comparable to the OnReceive event in the events.py examples?
I am thinking of, if possible, to integrate PyATEMMAX with MQTT messaging, so as events trigger on the ATEM, I can forward to downlevel devices. For example, a tally change on a given ATEM, parse that and generate MQTT messages to any devices listening for said message.
We have a need for our remote team, elsewhere in the location for example, to know the tally state of a given ATEM. We created small microcontrollers that update status screens, showing the current ATEM tally status. This uses the REST API from PyATEMAPI project, which uses PyATEMMax. It works, but constant query of the REST API generates a lot of traffic, when what would be more effective or efficient would be a even driven model rather than a polling model. But realize if the BMD ATEM SDK does not have a type of even driven model, this could get complex. But then I saw the OnReceive stub in the events.py example, and wondered if this was such, ATEM event driven scenario?