I believe my question is similar to the one here:
Here’s what I’ve done so far:
Under Tools → Actions → Generic Events, I have created a data source that receives TCP strings
Under Generic Events, I have created a generic event that watches for a string that contains “johntest” sent to the previously created data source
Under Rules, I have created a rule that creates a Log Entry when the previously created generic event is triggered.
I have executed a short python program that sends the string ‘xxjohntestyyy’ in a TCP data packet to the data source defined above.
I observe that a log entry was created.
So far, so good…
Now, instead of creating a log entry, I want my Rule Action to be "Set to show
I note that when I select the option, I get two choices. “Use devices from metadata” and “Select devices”.
Obviously, this rule will me more flexible if I can pass the desired device in metadata.
But where does this metadata come from? As far as I can tell, the only place would be from the string passed in the TCP data packet.
Am I wrong about this?
If I am wrong about this, where does the metadata come from?
If I am not wrong about this, how do I format the string in the data packet to identify what camera I want to show on the Smart Wall?
I suspect it might have something to do with the information I get when I Ctrl-Click on the camera preview under the device tree that looks like this:
ID = ED96863F-ABDA-444C-8AC8-60EABE117F72
Edge = A3EF6F2D-51F2-48B0-BA78-EBA65BB3AA0F
But I don’t know for sure and even if it was, how does that need to be encoded in the string?
If you could help with this, I’d really appreciate it.
Also, I note that the next Rule - Set to show text ‘’ only allows hard coded message in the rule definition. If it were possible to pass the desired text message via the string in the TCP packet that initiates the Generic Event, that would be much more flexible.
For what it’s worth, here is the previously mentioned Python program:
import socket
def send_tcp_packet():
# Server details
server_ip = '###.###.###.###'
server_port = 1238
# Data to be sent
data = 'xxjohntestyy'
# Create a socket object
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
# Connect to the server
client_socket.connect((server_ip, server_port))
# Send the data
client_socket.send(data.encode())
# Receive and print the response
response = client_socket.recv(1024).decode()
print("Response received:", response)
except ConnectionRefusedError:
print("Connection refused. Make sure the server is running.")
finally:
# Close the socket
client_socket.close()
# Call the function to send the TCP packet
send_tcp_packet()