Open thefrenchmatt opened 8 years ago
It's currently possible to keep the connection open and send multiple control messages. I don't see how the MAC address helps here. What is your use case here?
Yes but as soon as the tv or server is turned off, access is requested again. This does not happen for DNLA servers or a mobile devices (incl. Apps started from those). So I'm looking for a way to pass the MAC Adress and home-automation.io uses your work, so I guessed best to ask you (:
Hmm. It doesn't request for the access again after rebooting on the models I have tested. But different models may behave differently.
Should sending the MAC address fix this? I would be happy to fix the behavior, but I cannot test it myself. Feel free to play with the source code and please send me a pull request if you get it working better.
My skills are not that advanced but I will surely try comparing your code with the link I initially attached.
I get this error: when I run the program. I called samsungct as follows:
samsungctl --host 192.168.1.6 --name samsungctl KEY_MUTE
Traceback (most recent call last): File "/usr/local/bin/samsungctl", line 9, in <module> load_entry_point('samsungctl==0.5.1', 'console_scripts', 'samsungctl')() File "/usr/local/lib/python2.7/dist-packages/samsungctl/__main__.py", line 99, in main with Remote(config) as remote: File "/usr/local/lib/python2.7/dist-packages/samsungctl/remote.py", line 38, in __init__ self._read_response(True) File "/usr/local/lib/python2.7/dist-packages/samsungctl/remote.py", line 70, in _read_response tv_name_len = int.from_bytes(header[1:3],
My conf is as follows: { "name": "samsungctl", "description": "PC", "id": "", "port": 55000, "timeout": 0}
@jviyer You need to use Python 3. E.g. pip3 install samsungctl
Thanks a lot ! That was the issue.
On Monday, August 8, 2016 2:11 AM, Lauri Niskanen <notifications@github.com> wrote:
@jviyer You need to use Python 3. E.g. pip3 install samsungctl— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@Ape Thanks for an amazing lib. I have faced the re-authorization issue as well. Having the MAC address in the request seems to solve the issue. I have modified the remote_legacy.py code to include mac address, like so
` payload = b"\x64\x00" \
One would also need to append the config to include "mac":
, "mac":"00-AB-11-11-11-11"`PS: very new to github. I tried a few times but wasn't sure how to use the pull request
i have created a pull request with the changes now
Cheers!
@Upas Thanks for the pull request #24. Does it matter what is inserted as the MAC address? Should it be the PC or TV address?
I apologize. I might have gotten too excited to have found a fix. But in retrospect no additions are needed, the additional "mac" item can be left out. This can still be made to work with just the 3 parameters in the string serialize.
Some findings i have made from testing on my TV are listed below. Based on your existing payload string: `payload = b"\x64\x00" \
So i guess the short is - a little clean up of naming of the payload components and the example should clear this up for all the folks having re-auth issues.
I have modified payload in remote_legacy.py as follows: `payload = b"\x64\x00" \
and config like so: { "ip": "192.168.0.2013", # ideally should be the IP of the device, but you can use anything "mac": "mac:address:1", "name": "Python Remote1",
"host": "192.168.0.101",
"port": 55000,
"method": "legacy",
"timeout": 0
}
Setting "mac" and "ip" solved my problem with re-authentication on every restart on my UN40F5500 TV.
BTW @Ape thanks so much on lib, I'm using it on https://github.com/pedrinho/samsung_remote
How to solve this re-authentication problem using websockets method instead of legacy ?
Dear @Ape ,
based on this library, home-assistant.io requests a new connection each time but it seems some models should be able to remember the host based on MAC address.
Could you be so kind as to add an optional conf variable for it?
I found a practical example that may help here : http://deneb.homedns.org/things/?p=232