laf / russound Goto Github PK
View Code? Open in Web Editor NEWRussound RNET Python module
License: GNU General Public License v3.0
Russound RNET Python module
License: GNU General Public License v3.0
Could you publish this package on Pypi, so it can be fetched without specifying the github URL?
Hi there,
When attempting to connect, I get the following error:
OSError: [WinError 10057] A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied
My code is pretty basic, just
import time
IP_ADDRESS = '192.168.1.60'
PORT = 9621
def main():
x = russound.Russound(IP_ADDRESS, PORT)
x.connect()
x.is_connected()
for zone in range (1,5):
x.set_power('1', zone, '1')
So basically verbatim the examples. Traceback:
File "file.py", line 16, in <module>
main()
File "file.py", line 12, in main
x.set_power('1', zone, '1')
File "C:\Users\user\PycharmProjects\russound\venv\lib\site-packages\russound\russound.py", line 82, in set_power
self.send_data(send_msg)
File "C:\Users\user\PycharmProjects\russound\venv\lib\site-packages\russound\russound.py", line 245, in send_data
self.sock.send(data)
OSError: [WinError 10057] A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no add
ress was supplied
Thanks!
Thank you everyone for writing and maintaining the Russound RNET interface. I am new to Home Assistant and have acquired some old Russound boxes. I have them linked in HA after modifying the media_payer.py in a custom_components sub folder to cope with multiple controllers. Everything works, however, I notice a significant lag for actions, specifically Power Off, on zones connected to my second controller. I think the issue is that the response message signature, built in function get_zone_info
, with this line:
resp_msg_signature = self.create_response_signature("04 02 00 @zz 07", zone)
assumes a controller id value of 00 and should be amended to be along these lines
resp_msg_signature = self.create_response_signature("70 @cc 00 7F 00 00 04 02 00 @zz 07", zone, controller)
to take into account the controller Id. And, obviously, with a knock on change required to
create_response_signature(self, string_message, zone)
to become something like (please forgive my Python):
`
def create_response_signature(self, string_message, zone, controller):
""" Basic helper function to keep code clean for defining a response message signature """
zz = ''
if zone is not None:
zz = hex(int(zone)-1).replace('0x', '') # RNET requires zone value to be zero based
string_message = string_message.replace('@zz', zz) # Replace zone parameter
cc = hex(int(controller)-1).replace('0x', '') # RNET requires controller value to be zero based
string_message = string_message.replace('@cc', cc) # Replace controller parameter
return string_message
`
Honestly, I'm guessing this as I'm actually not sure how to test my proposal. Can I just copy Russound.py in to my custom_components folder but then how do I reference that version from the your original one in media_player.py? I'm new to Python and still have a long learning curve to climb.
Many thanks Richard
I've managed to get a test setup and realised it was more complicated and have updated my issue, however, I douibt that my initial assertion is correct. Can anyone tell me how I can switch to debug mode/see the debug logger messages?
Hi! Thanks for this library, which I'm using via Home Assistant. While using it it I noticed the following things that needed to be addressed:
Home Assistant represents each Russound zone with an instance of a class periodically polls each zone zone status by calling the functions get_power/get_source/get_volume in russound.py, each call running on a different thread. The polling happens almost simultaneously for all zones, specially at startup. There was no synchronization mechanism on russound.py to ensure that one full call completes before a new request is written to the socket used to send the data to the serial gateway connected to the Russound device (I have a CAM6.6). The attached TCP stream capture (using wireshark) shows multiple message start delimiters being sent (F0's) at the same time, which the Russound device will interpret as an incorrect request.
The find_signature function returns even if the all the data needed for the response has not been received (the portion of the message that contains the signature has been received but the part that contains the actual values requested has not been received).
The Update method of RussoundRNETDevice on the Home Assistant file called russound_rnet.py calls get_power, get_source/get_volume functions in russound.py ; those three functions call the get_zone_info function, which translates into three identical requests to the Russound device with each call only using a different part of the response.
I have a new version of the russound.py file that addresses the above and add a bit more debugging info for multithreaded use. Would like get these changes pulled into the main line of code. Given that in order to address 3 a new version of russound_rnet.py is needed, I will also open a bug in HomeAssistant. Please feel free to contact me. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.