Websocket failing to complete AdvSS send/receive 'testing' message #1412
-
I am trying to interface a python program that will set AdvSS variables (not sure this is even possible, but it sure would be nice). I am sending a CallVendorRequest with vendorName: AdvancedSceneSwitcher, requestType: AdvancedSceneSwitcherMessage, and requestData: {'message': 'testing'} (which matches a Bitfocus Companion example). OBS WebSocket confirms success, but the AdvancedSceneSwitcherEvent is not emitted, and variable 'Set' actions do not work. I have verified variable names, macro activity, and OBS WebSocket settings. What is the precise requestData structure expected by AdvancedSceneSwitcherMessage for setting variables and triggering macros externally, and are there any specific ASS plugin settings required for this to function? My first time posting here, and I'll try to attach the test program here. Thanks for any help, OBS 31.0.3 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
I can receive it just fine using your testing script: Is anything being received at all?
Your understanding of the connection of events and requests might not be quite correct. Events are messages sent out by OBS when something happens, which you are subscribed to. You can trigger I hope that helps clear things up! |
Beta Was this translation helpful? Give feedback.
-
Thanks very much for your reply. My mistake was in my monitoring macro, I used "if Websocket Scene Switcher Event was received" instead of "if Websocket Scene Switcher Request was received". Once I changed "Event" to "Request", then my macro triggers and the data is received. Would you please explain what the "Scene Switcher Event" is and how it is used? I also wish I have a convenient way to set the values of many AdvSS variables. In my use-case, I am using 24 variables to determine when to monitor cameras for each hour of the day. I am using JSON read from a file now and then having 24 individual variables read the content of that that file and then search for the JSON key to get the associated value. I also have other variables that determine what camera is used each hour. Any suggestion on how to set 24 variables "rec00" through "rec23"? I was hoping there might be an interface to address and set the value of each variable directly. |
Beta Was this translation helpful? Give feedback.
-
The difference between requests and events is the "direction" of the communication. When which is applicable depends on the scenario.
Unfortunately, I can't really give concrete advice as I don't fully understand what you are trying to achieve. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response. Wow! This is exactly what I spent hours trying to find. I am so embarrassed ... I thought I had researched all the documentation, discussion, blogs, etc and I totally missed this link on scripting between OBS and AdvSS. In fact, I was under the impression that OBS only supported a very old version of Python and had convinced myself that OBS would not work with the recent versions of python (3.13.2 in my case). But now you have pointed me to your example on Scripting using wonderful helper functions. This is exactly what I was hoping existed but failed to find. This will greatly simplify what I am trying to do, and I had your example running in less than 10 minutes. The context for all of this is not the many people using your hard work for sharing gaming videos. For me, I have built a system to stream video of an Osprey nest for the USFS in Silverthorne, CO. I volunteered to do this project but insisted using a solar-powered camera to avoid the risk of it being a lightning rod after many years of designing and deploying cell towers for the US military and civilian emergency response teams. I am convinced this is one of the very first such cameras in the world that is not running POE or huge expensive solar panels to do the same. I am under $300 for 4K camera, NVR, and an old donated laptop. Unfortunately, the mount on the solar panel failed and it has moved to a position that makes it <40% efficient; so, I am unable to stream live video for more than about 4-5 hours per day (vs 8-10+) that I had shown could be done with a prototype). This failure has forced me to create and change the recording schedule based on current battery level, solar power being received for the last few minutes, and predicted weather forecast. When it is not prudent to show a live stream, AdvSS automatically these external inputs to switch from Live stream to showing prior recordings or some interesting video clips that previously manually created. That is why I am constantly monitoring and changing the camera live view, recordings, etc. All this is done with a complex FSM (over 150+ macros and about 60 states, each representing a state transition) using AdvSS macros and the entire systen has been running autonomously since April (a few new features here and there, but it has been rock solid with virtually no human interaction). My plans for next year are to add at least one more camera and use some complex machine learning based on our local weather patterns. (May also deploy some trailhead cameras to monitor parking availability.) Anyone can check the Osprey videos at FDRD.org. This has been a fun project for an old Bell Labs engineer who grew up using C on a Vax 11/780 and one of the pioneers using C++. And it has been fun to write in JS and Python, and thank goodness for AI helping this old dog learn some new tricks. All this is done as a volunteer and someday I will put it all up on github for others to use and improve. I apologize for such a long response, but I want you to know that your AdvSS is bringing many smiles to the so many people visiting our national forests and its wildlife. We are planning to share the most interesting videos captured this season to hundreds of local school children. Just a bit of paying it forward to make life more interesting and educating more about the world around us. Again, thanks for responding to me and pointing me to a very pertinent example. |
Beta Was this translation helpful? Give feedback.
I can receive it just fine using your testing script:
Is anything being received at all?
Are the connection details (password / port) correct? (In case you are running multiple instances of OBS)
Your understanding of the connection of events…