From 137899cfc28ccbaba9134fd7d118161b003d919b Mon Sep 17 00:00:00 2001 From: Mike Geppert Date: Wed, 7 Jan 2026 20:14:58 -0600 Subject: [PATCH] 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 --- console_settings.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/console_settings.py b/console_settings.py index a2fb72f..376da2d 100644 --- a/console_settings.py +++ b/console_settings.py @@ -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),