Closed DrAhoss closed 2 years ago
Hello @DrAhoss , thanks for reporting this! Usually Connection reset by peer
means one of two things:
Thank you for your response @MrAsterisco! Regarding the first option, I downloaded the app on my MacBook but I have absolutely no idea what to do with it. I have to admit that I have almost no knowledge about the inner workings of networks and their protocols and stuff. Maybe you could give me some pointers in the direction I need to go, because I can't seem to find documentation for this app either.
As for the second tip, I have been thinking that too, maybe my Hisense h55a6100 is a bit 'special' in that matter. Is there a way to find the correct certificate somewhere online?
As a sidenote, I am able to use the RemoteNOW app on my iPhone to control the TV, but it has a 50/50 chance of not working. Sometimes it works after the TV is turned on and the app has been open for a while. At other times it works instantly, or not at all. But this lets me assume, that the TV accepts some kind of remote control protocol.
@DrAhoss sure, let's see if I can explain a little bit. The MQTT protocol is the method that the TV uses to communicate: you basically subscribe to a topic and receive messages on that. In very simple words: you ask the TV to tell you something and it will respond with that something.
With MQTT Explorer, after you connect to the TV, you should be able to observe all topics and basically sniff everything that's going on between the RemoteNOW app and the TV. So, after you created a new connection on MQTT Explorer and managed to connect successfully, just open the RemoteNOW app on your phone and start interacting with your TV. Before connecting, make sure that the TV is turned on.
In order to create a connection, just open the app, press the big yellow plus button and input the IP address of the TV. As port, use 36669
. You'll have to mess around with certificates and SSL configuration until you find the right one. Once you found the right one, make a note of it and we'll try to reproduce it in the plugin configuration.
Is there a way to find the correct certificate somewhere online?
Certificates were added later to this repo and they come from another repo that I don't own. My TV doesn't require certificates to connect, so I cannot test them out. I guess those certificates were extracted somehow, but I wouldn't know where to start, unfortunately.
As a sidenote, I am able to use the RemoteNOW app on my iPhone to control the TV, but it has a 50/50 chance of not working. Sometimes it works after the TV is turned on and the app has been open for a while. At other times it works instantly, or not at all.
This could mean a lot of things: the RemoteNOW app is very buggy, so it could be just that. But it could also mean that your network configuration isn't working properly or that your router is blocking something that the TV needs to work. I had a similar problem once, where I had to reset all my network appliances because something was blocking MQTT. Not sure if this applies to you, but if possible, I'd try isolating the TV on a very simple network and see if you still have issues with the app.
@DrAhoss, your TV either requires the certs, or not. TBH HiSense don't make that information publicly available. The certs are here: https://github.com/MrAsterisco/hisensetv/tree/master/cert
If you can use MQTT Explorer, and in that app, you don't need to supply certificates, then the app would look like this
and then as you use the RemoteNow app on your phone, you'll see the actions
If this is the case, then in the Homebridge configuration file, set the SSL configuration as per below
{ "platform": "HiSenseTV", "ifname": "ens33", "devices": [ { "id": "A unique identifier (such as your TV S/N)", "name": "A name to display in the Home app", "ipaddress": "Your TV IP address", "macaddress": "Your TV MAC Address", **"sslmode": "disabled", "sslcertificate": "", "sslprivatekey": ""** } ] }
and from your device, if trying to manually authorise, you would send the --no-ssl flag
python3.8 hisensetv.py
as an example, here my tv Ip is 192.168.1.32 so the command would be
python3.8 hisensetv.py 192.168.1.32 --authorize --ifname eth0 --no-ssl
Again, in my case, because my TV needs SSL, I am returned a connection timeout
However my TV requires SSL, and so in MQTT Explorer, I load the certs by following this and then I am able to view/access.
Similarly, from my rPi, it is the same so I can access it passing in the certificates from a location I've dumped them on my device - the path doesn't matter as long as you specify it
you can read more about our hijinks from last year here: https://github.com/MrAsterisco/homebridge-hisense-tv/issues/3
For what it's worth, I ended up forking my own version of cmd4-hisenseTv that works as well as this, since I'm using cmd4 for my airconditioning system and home alarm system anyway it made a bit more sense to pile them into the same into the same plugin from a maintenance perspective.
https://github.com/ryanshand/cmd4-HisenseTV
Good luck
@ryanshand thanks for your input, your screenshots are way better than my lengthy text!
Thank you both @MrAsterisco and @ryanshand. I have had success with the mqtt explorer connection. I can listen for the actions between the RemoteNOW app and the TV. I have set it up without encryption so I assume that I shouldn't need the certificates, right? If I use --no-ssl it gives me this timeout error:
pi@homebridge:/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin $ python3.9 hisensetv.py 192.168.1.150 --authorize --ifname wlan0 --no-ssl
[2022-01-18 18:56:15,668] [INFO ] No SSL context specified.
Traceback (most recent call last):
File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/__init__.py", line 208, in _wait_for_response
return self._queue[topic].get(block=True, timeout=self.timeout)
File "/usr/lib/python3.9/queue.py", line 179, in get
raise Empty
_queue.Empty
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv.py", line 6, in <module>
__main__.main()
File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/__main__.py", line 130, in main
tv.start_authorization()
File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/__init__.py", line 56, in wrapper
return func(self, *args, **kwargs)
File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/__init__.py", line 633, in start_authorization
self._wait_for_response(topic=self._our_topic)
File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/__init__.py", line 210, in _wait_for_response
raise HisenseTvTimeoutError(
hisensetv.HisenseTvTimeoutError: failed to recieve a response in 10.000s
While typing this I was still trying stuff and realised that I can use the --get sources call when I add --no-ssl. So that must mean that my tv doesn't need or want the certificates. But why does it timeout when I do --authorize --no-ssl?
Anyways, with that still unsolved I had just realised that all of the red error-messages in the homebridge log stopped appearing. It stated that the tv is running and I needed to add the tv in the home app. I did that and it seems to work, however I can only turn it on/off and select the sources. (Maybe that's all it is supposed to do) This is very confusing to me, because the authorization never went trough and I never entered any kind of code that should've appeared on the tv screen.
Maybe there is something wrong still or it just magically started working. Maybe you guys got an idea still?
Thank you!
You can only authorize once, I also get a timeout because I’m already authorized.
The fact you can get sources means it’s working.
This plugin only allows you to switch inputs and power on/off
Thanks Ryan
Sent from my iPhone
On 19 Jan 2022, at 2:14 am, DrAhoss @.***> wrote:
Thank you both @MrAsterisco and @ryanshand. I have had success with the mqtt explorer connection. I can listen for the actions between the RemoteNOW app and the TV. I have set it up without encryption so I assume that I shouldn't need the certificates, right? If I use --no-ssl it gives me this timeout error: @.***:/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin $ python3.9 hisensetv.py 192.168.1.150 --authorize --ifname wlan0 --no-ssl [2022-01-18 18:56:15,668] [INFO ] No SSL context specified. Traceback (most recent call last): File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/init.py", line 208, in _wait_for_response return self._queue[topic].get(block=True, timeout=self.timeout) File "/usr/lib/python3.9/queue.py", line 179, in get raise Empty _queue.Empty
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv.py", line 6, in main.main() File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/main.py", line 130, in main tv.start_authorization() File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/init.py", line 56, in wrapper return func(self, *args, **kwargs) File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/init.py", line 633, in start_authorization self._wait_for_response(topic=self._our_topic) File "/usr/local/lib/node_modules/homebridge-hisense-tv-remotenow/bin/hisensetv/init.py", line 210, in _wait_for_response raise HisenseTvTimeoutError( hisensetv.HisenseTvTimeoutError: failed to recieve a response in 10.000s`
While typing this I was still trying stuff and realised that I can use the --get sources call when I add --no-ssl. So that must mean that my tv doesn't need or want the certificates. But why does it timeout when I do --authorize --no-ssl?
Anyways, with that still unsolved I had just realised that all of the red error-messages in the homebridge log stopped appearing. It stated that the tv is running and I needed to add the tv in the home app. I did that and it seems to work, however I can only turn it on/off and select the sources. (Maybe that's all it is supposed to do) This is very confusing to me, because the authorization never went trough and I never entered any kind of code that should've appeared on the tv screen.
Maybe there is something wrong still or it just magically started working. Maybe you guys got an idea still?
Thank you!
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.
Alright, seems like everything has been cleared up, thank you all for the great help! Closing this now.
Hey Ryan,
I posted in the issues in the other repo newAM/Hisensetv around these settings. For my tv (U9G) I have to disable validate certificate in order for MQTT-Explorer to connect to the tv. Do you know if its possible to have that functionality in the python script for this and the other project?
On 18 Jan 2022, at 9:35 pm, ryanshand @.***> wrote:
@DrAhoss, your TV either requires the certs, or not. TBH HiSense don't make that information publicly available. The certs are here: https://github.com/MrAsterisco/hisensetv/tree/master/cert
If you can use MQTT Explorer, and in that app, you don't need to supply certificates, then the app would look like this
and then as you use the RemoteNow app on your phone, you'll see the actions
If this is the case, then in the Homebridge configuration file, set the SSL configuration as per below
{ "platform": "HiSenseTV", "ifname": "ens33", "devices": [ { "id": "A unique identifier (such as your TV S/N)", "name": "A name to display in the Home app", "ipaddress": "Your TV IP address", "macaddress": "Your TV MAC Address", "sslmode": "disabled", "sslcertificate": "", "sslprivatekey": "" } ] }
and from your device, if trying to manually authorise, you would send the --no-ssl flag
python3.8 hisensetv.py
--authorize --ifname --no-ssl as an example, here my tv Ip is 192.168.1.32 so the command would be
python3.8 hisensetv.py 192.168.1.32 --authorize --ifname eth0 --no-ssl
Again, in my case, because my TV needs SSL, I am returned a connection timeout
However my TV requires SSL, and so in MQTT Explorer, I load the certs by following this and then I am able to view/access.
Similarly, from my rPi, it is the same so I can access it passing in the certificates from a location I've dumped them on my device - the path doesn't matter as long as you specify it
you can read more about our hijinks from last year here:
3
For what it's worth, I ended up forking my own version of cmd4-hisenseTv that works as well as this, since I'm using cmd4 for my airconditioning system and home alarm system anyway it made a bit more sense to pile them into the same into the same plugin from a maintenance perspective.
https://github.com/ryanshand/cmd4-HisenseTV
Good luck
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.
@DrAhoss it's great to hear that you finally managed to make it work!
This plugin only allows you to switch inputs and power on/off
This is not true 😊 The plugin also adds a remote for your TV, which allows you to change channel, control the volume and more, as if you were doing that with your actual TV remote. You can access the Remote via Control Centre: if you don't see it there, you might need to enable it from Settings > Control Centre, by dragging "Apple TV Remote" into the list of "Included Controls".
I posted in the issues in the other repo newAM/Hisensetv around these settings.
Hey @gjlamb , let's try to keep issues separated from each other. 😊 Yours is a different issue that we're tracking on the other conversation. Could you add there the link to the issue you opened on newAM/Hisensetv?
I have installed the plugin, then installed paho-mqtt. Now I am trying to pair the tv to my Raspberry Pi Zero 2 running Homebridge with the command:
python3.9 hisensetv.py 192.168.1.XXX --authorize --ifname wlan0
But this throws the error:
ConnectionResetError: [Errno 104] Connection reset by peer
Here's the log:
I have read all of the other issues, including the solved ones, maybe there's an issue with the ssl certificates? Not sure what to do though.
Environment: