Repository navigation
Releases: heatvent/control4_amp
Release list
v0.1.10 prefix fix
v0.1.09 fix prefix
def send_data(self, command):
"""Send data to Control4 Amp."""
# Adjusted sequence initialization and formatting
self.sequence = (self.sequence % 99) + 1 # Wrap around at 99 and start at 01
data = f'0gha{self.sequence:02d} {command}\r\n'
if self.transport:
self.transport.sendto(data.encode(), (self.ip, self.port))
_LOGGER.info("Sent command: %s to %s:%s", data, self.ip, self.port)
v0.1.08 udp communication fix
changed:
data = f'0gha{self.sequence:02d} {command}\r\n'
to:
data = f'0g00{self.sequence:02d} {command}\r\n'
v0.1.07 command prefix bugfix
changed
data = f'0g{self.sequence:02d}ha00 {command}\r\n'
to
data = f'0gha{self.sequence:02d} {command}\r\n'
v0.1.06 multiple amps
v0.1.05 fix to udp_communication.py
To resolve this, add the following import statement at the beginning of your udp_communication.py:
python
Copy code
from .const import DOMAIN
This import statement will bring the DOMAIN variable into the scope of udp_communication.py, allowing your handle_response method to use it without encountering a NameError. Ensure that this import is correct and that const.py is in the same directory as udp_communication.py and correctly contains the DOMAIN variable declaration.
v0.1.04: fixes to media_player.py
Replace this line:
python
Copy code
udp_comm = UDPCommunication(entry.data["ip_address"], entry.data["port"])
With this:
python
Copy code
udp_comm = UDPCommunication(hass, entry.data["ip_address"], entry.data["port"])
Make sure that the hass object is available in the scope where you're creating the UDPCommunication instance, which it should be since you're inside a Home Assistant setup function. This change should resolve the TypeError and help in creating the devices correctly.
udp_communication.py improvements
Key Changes:
Initialization with Home Assistant Context: Added Home Assistant's context to manage updates and communicate with the main thread.
Structured Command Handling: Added a method to handle incoming messages and dispatch updates to Home Assistant, using the dispatcher.
Command Sequence Handling: Incorporated a sequence counter to ensure command uniqueness, wrapping at 99 as specified.
Error Handling: Added robust error logging for troubleshooting.
Async Handling: Ensured proper use of asyncio for network communications.
config_flow.py improvements
config_flow.py improvements
Working Version
This is a current working version with responses from the amp and devices created.