You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi... I'm running a C4 EA1 OS 3.4 and my first test.py to test the controller to list all devices, I get this error:
Exception has occurred: BadCredentials
{"C4ErrorResponse":{"code":401,"details":"Permission denied Bad credentials","message":"Permission denied","subCode":0}}
File "C:\tmp\C4\2\a.py", line 14, in
asyncio.run(account.getAccountBearerToken())
pyControl4.error_handling.BadCredentials: {"C4ErrorResponse":{"code":401,"details":"Permission denied Bad credentials","message":"Permission denied","subCode":0}}
I'm using root users on python... password is correct (I changed it to t0talc0ntr0l4! since its lower than 40 letters.
asyncio.run(account.getAccountBearerToken()) is where I get error.
Is there something that needs to be configured in addition to username, password and ip? Is there a C4 drive needed to use this code?
I'm using the basic code... here it's:
from pyControl4.account import C4Account
from pyControl4.director import C4Director
from pyControl4.light import C4Light
import asyncio
import json
username = "root"
password = "t0talc0ntr0l4!"
ip = "192.168.1.23" # Substitua pelo endereço IP do seu Control4 Director
"""Authenticate with Control4 account"""
account = C4Account(username, password)
asyncio.run(account.getAccountBearerToken())
"""Get and print controller name"""
accountControllers = asyncio.run(account.getAccountControllers())
print(accountControllers["controllerCommonName"])
"""Get bearer token to communicate with controller locally"""
director_bearer_token = asyncio.run(
account.getDirectorBearerToken(accountControllers["controllerCommonName"])
)["token"]
"""Create new C4Director instance"""
director = C4Director(ip, director_bearer_token)
"""Print all devices on the controller"""
print(asyncio.run(director.getAllItemInfo()))
"""Create new C4Light instance"""
light = C4Light(director, 253)
"""Ramp light level to 10% over 10000ms"""
asyncio.run(light.rampToLevel(10, 10000))
"""Print state of light"""
print(asyncio.run(light.getState()))
The text was updated successfully, but these errors were encountered:
your account credentials are needed, not the credentials for the controller, so whatever you use to log in to the control4 app is what you should have instead of root and total control.
hi... I'm running a C4 EA1 OS 3.4 and my first test.py to test the controller to list all devices, I get this error:
Exception has occurred: BadCredentials
{"C4ErrorResponse":{"code":401,"details":"Permission denied Bad credentials","message":"Permission denied","subCode":0}}
File "C:\tmp\C4\2\a.py", line 14, in
asyncio.run(account.getAccountBearerToken())
pyControl4.error_handling.BadCredentials: {"C4ErrorResponse":{"code":401,"details":"Permission denied Bad credentials","message":"Permission denied","subCode":0}}
I'm using root users on python... password is correct (I changed it to t0talc0ntr0l4! since its lower than 40 letters.
asyncio.run(account.getAccountBearerToken()) is where I get error.
Is there something that needs to be configured in addition to username, password and ip? Is there a C4 drive needed to use this code?
I'm using the basic code... here it's:
from pyControl4.account import C4Account
from pyControl4.director import C4Director
from pyControl4.light import C4Light
import asyncio
import json
username = "root"
password = "t0talc0ntr0l4!"
ip = "192.168.1.23" # Substitua pelo endereço IP do seu Control4 Director
"""Authenticate with Control4 account"""
account = C4Account(username, password)
asyncio.run(account.getAccountBearerToken())
"""Get and print controller name"""
accountControllers = asyncio.run(account.getAccountControllers())
print(accountControllers["controllerCommonName"])
"""Get bearer token to communicate with controller locally"""
director_bearer_token = asyncio.run(
account.getDirectorBearerToken(accountControllers["controllerCommonName"])
)["token"]
"""Create new C4Director instance"""
director = C4Director(ip, director_bearer_token)
"""Print all devices on the controller"""
print(asyncio.run(director.getAllItemInfo()))
"""Create new C4Light instance"""
light = C4Light(director, 253)
"""Ramp light level to 10% over 10000ms"""
asyncio.run(light.rampToLevel(10, 10000))
"""Print state of light"""
print(asyncio.run(light.getState()))
The text was updated successfully, but these errors were encountered: