Closed 0dragosh closed 5 years ago
You should always call register(..)
regardless of whether it is the first call or not. Your structure should look somewhat like:
if os.path.isfile(config_file):
with open(config_file) as f:
store = json.load(f)
else:
store = {}
client.connect()
for status in client.register(store):
if status == WebOSClient.PROMPTED:
# **NOTE**: This will not happen if the store contains valid keys.
print("Please accept the connect on the TV!")
elif status == WebOSClient.REGISTERED:
print("Registration successful!")
# json.dump(store) back to the config_file here.
@supersaiyanmode Thanks, that solved it!
I'm attempting to register with the TV once, and then store the dict in a config.json. I can register and issue commands successfully on the first run. However, on the 2nd run of my script, it loads the
store
dict from the config file properly, but the tv does not execute any command whatsoever.My code looks something like this:
Any command issued does nothing.
Am I doing something wrong?
Thanks!