I was using successfully with 8/2023 HA version I think, but after some updates, not sure which one, on 2023.10.5 now, I can’t get a trigger payload read correctly anymore.
I was using these 2 examples. This would use the first 6 characters in the payload, which I don’t get due to it being 0-7, but it worked. The second one, same thing, but for characters 19 if the 3 spaces are not included through 26, so again confused why I had to use 27, but after trial and error, this is what worked, but neither one of these pulls anything from the payload, but I see it in MQTT. Has something changed that broke this?
I’m not seeing anything different in the way python slicing works.
[0:7] gets the first 7 items from an iterable (string, list, dict, etc). Assuming it’s a string that has less than 7 characters, [0:7] will return the entire string (or nothing if it’s an empty string).
[19:27] will report nothing if the string has less than 19 characters.
Post a few examples of the contents of trigger.payload.
[0:7] was doing the first 6 and 19:27 was working for the one below before it wasn’t. I was using the first 6 to use that number to set volume on an application, but now it returns nothing so even if I don’t use the PipeWire one which was a condition so the automation didn’t run unnecessarily, it still doesn’t work either, which told me something must’ve changed, as they both worked before.