Code: Select all
import indigo
# Device ID for the Dayton DAX88 media player
DEVICE_ID = 1737882882
# Variable IDs for source and volume
VOLUME_VARIABLE_ID = 1208421489
SOURCE_VARIABLE_ID = 1416651045
indigo.server.log("Script started: Preparing to update the Dayton device.")
# Step 1: Retrieve the current volume variable value
try:
indigo.server.log("Retrieving volume variable...")
volume_variable = indigo.variables[VOLUME_VARIABLE_ID]
volume_value = int(volume_variable.value) # Convert volume to integer (assumed 0–100 scale)
indigo.server.log(f"Volume variable retrieved: {volume_value}")
except Exception as e:
indigo.server.log(f"Error retrieving or parsing volume variable: {e}", isError=True)
# Step 2: Retrieve the current source variable value
try:
indigo.server.log("Retrieving source variable...")
source_variable = indigo.variables[SOURCE_VARIABLE_ID]
source_value = source_variable.value # Assume source is stored as a string
indigo.server.log(f"Source variable retrieved: {source_value}")
except Exception as e:
indigo.server.log(f"Error retrieving or parsing source variable: {e}", isError=True)
# Step 3: Adjust the volume using an Indigo-supported action
try:
indigo.server.log(f"Setting volume to {volume_value}% for device ID {DEVICE_ID}...")
# Replace "setVolume" with the exact method name for your device
indigo.device.executeAction("setVolume", deviceId=DEVICE_ID, props={"volume": volume_value})
indigo.server.log(f"Volume successfully set to {volume_value}% for device ID {DEVICE_ID}.")
except Exception as e:
indigo.server.log(f"Error setting volume: {e}", isError=True)
# Step 4: Adjust the source using an Indigo-supported action
try:
indigo.server.log(f"Setting source to '{source_value}' for device ID {DEVICE_ID}...")
# Replace "setInputSource" with the exact method name for your device
indigo.device.executeAction("setInputSource", deviceId=DEVICE_ID, props={"source": source_value})
indigo.server.log(f"Source successfully set to '{source_value}' for device ID {DEVICE_ID}.")
except Exception as e:
indigo.server.log(f"Error setting source: {e}", isError=True)
indigo.server.log("Script completed.")Code: Select all
Script Script started: Preparing to update the Dayton device.
Script Retrieving volume variable...
Script Volume variable retrieved: 60
Script Retrieving source variable...
Script Source variable retrieved: 1
Script Setting volume to 60% for device ID 1737882882...
Script Error Error setting volume: 'DeviceCmds' object has no attribute 'executeAction'
Script Setting source to '1' for device ID 1737882882...
Script Error Error setting source: 'DeviceCmds' object has no attribute 'executeAction'
Script Script completed.Any thoughts would be appreciated!The persistent mention of "DeviceCmds" suggests that the Indigo scripting engine is automatically associating the DEVICE_ID (1737882882) with its internal representation of a media player device, known as a "DeviceCmds" object. This is not hidden in the script but is part of how Indigo identifies and manages devices internally. Essentially, Indigo assigns certain methods and properties to device objects based on their device type, and "DeviceCmds" is the base class for managing devices.
Here’s what this means:
"DeviceCmds" Object: This indicates that the device you’re trying to control is recognized as a standard Indigo device, but the methods being called (executeAction, updateStateOnServer) are not applicable to this particular class of device.
Unsupported Actions: The error is specifically telling you that "DeviceCmds" doesn't have the executeAction or updateStateOnServer methods available for use. This is because these methods are either specific to other device types or are not implemented for your Dayton device.