Thanks for all this!! Youre awesome! Since YAML is easily changed to JSON, Im going to try and write my config in yaml. I have the rest_command.yaml as well, which definitely simplified things. I think a table lookup with the different codes would work, but it might be overcomplicating the issue in my case since I only have 1 vizio. In your case, you might be able to simplify it further, but it sounds like it works for you already and fixing what aint broke is probably ill-advised.
Again, I appreciate all youve done so far. I have a lot of code to write still, but this is a great start!! You made my understanding so much better, and I have really enjoyed coding this!