Fix rule commands by properly URL-encoding special characters
- Changed from simple space replacement to full URL encoding using quote() - Rules contain # and = characters that must be encoded - # was being treated as URL fragment, truncating rule commands - Now encodes # as %23, = as %3D, spaces as %20, etc. - Fixes issue where rules weren't being applied correctly to devices
This commit is contained in:
parent
7f00bb8d7b
commit
137899cfc2
@ -165,8 +165,14 @@ class ConsoleSettingsManager:
|
||||
|
||||
time.sleep(0.5) # Brief delay between commands
|
||||
|
||||
# Send the actual command
|
||||
escaped_command = command.replace(' ', '%20')
|
||||
# Send the actual command - properly URL encode
|
||||
from urllib.parse import quote
|
||||
# Split command into param and value, then URL encode the value part
|
||||
parts = command.split(None, 1)
|
||||
if len(parts) == 2:
|
||||
escaped_command = parts[0] + '%20' + quote(parts[1], safe='')
|
||||
else:
|
||||
escaped_command = command.replace(' ', '%20')
|
||||
|
||||
result, success = retry_command(
|
||||
lambda: send_tasmota_command(device_ip, escaped_command, timeout=5, logger=self.logger),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user