Fixed the send variables not being updated

This commit is contained in:
Adam 2025-04-01 22:39:31 +01:00
parent 57a53ff569
commit 7b5fd68a52

View File

@ -62,6 +62,26 @@ class RSIClient:
logging.info("✅ RSI Client Stopped")
print("✅ RSI Client Stopped")
def update_send_variable(self, name, value):
print(f"[DEBUG] update_send_variable called with: {name} = {value}")
if "." in name:
parent, child = name.split(".", 1)
if parent in self.send_variables and isinstance(self.send_variables[parent], dict):
self.send_variables[parent][child] = value
print(f"[DEBUG] Current send_variables: {dict(self.send_variables)}")
return f"✅ Updated {name} to {value}"
else:
return f"❌ Variable '{name}' not found or not structured correctly"
else:
if name in self.send_variables:
self.send_variables[name] = value
return f"✅ Updated {name} to {value}"
print(f"[DEBUG] EStr value after update: {self.send_variables.get('EStr')}")
print(f"[DEBUG] Current send_variables: {dict(self.send_variables)}")
else:
return f"❌ Variable '{name}' not found in send_variables"
if __name__ == "__main__":
config_file = "RSI_EthernetConfig.xml"
client = RSIClient(config_file)