sehaas / ha_hisense_tv

Hisense TV integration for Home Assistant
MIT License
100 stars 22 forks source link

Update Mosquitto Addon to 6.2.0 breakes proper working ha_hisense_tv #50

Closed nepozs closed 1 year ago

nepozs commented 1 year ago

In fact after update it is only impossible to switch on tv, so I don't know why Mosquito update break WoL.

After manual TV on (local button ora IR remote), all works OK.

(bad) Mosquitto addon 6.2.0 uses Mosquitto 2.0.15 (working) Mosquitto addon 6.1.3 uses Mosquitto 2.0.11 https://mosquitto.org/ChangeLog.txt so maybe you can find dependecies with non-working WoL…

When TV is off it generates errors (something like this was also existing in old Mosquitto, I'll downgrade addon to show later)

2023-03-28 15:44:18: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:44:30: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:44:33: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:44:58: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:45:01: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:45:32: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:45:35: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:46:06: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:46:09: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:46:40: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:46:43: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:46:54: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:46:57: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:47:06: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:47:09: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:47:26: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:47:29: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:48:00: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:48:03: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:48:34: Connecting bridge Hisense (192.168.20.60:36669)

mqtt bridge configuration (file 'hisense.conf' located in '/share/', certificates located in /ssl/hisense/)

connection Hisense
address 192.168.20.60:36669
remote_username hisenseservice
remote_password multimqttservice
cleansession false
clientid HomeAssistant
bridge_tls_version tlsv1.2
bridge_cafile /ssl/hisense/hisense_ca.pem
bridge_certfile /ssl/hisense/rcm_certchain_pem.cer
bridge_keyfile /ssl/hisense/rcm_pem_privkey.pkcs8
bridge_insecure true
start_type automatic
try_private true
topic /remoteapp/# both 0 hisense

Edit: After addon downgrade nothing changed, so problem lies elsewhere, but recent day there was many updates, so I'm downgrading HA now.

NeeeeB commented 1 year ago

For me it doesn't work anymore at all. Even with TV on, it still says off, and nothing is reported. Of courses WOL doesn't work too. Everything is up to date, HA and Mosquitto

image

this is what I get, with TV on @sehaas

Schoultzies commented 1 year ago

After restoring a backup of Home Assitant to revert the latest Mosquito update, all again works as it should.

MnM001 commented 1 year ago

Mine is broken too., just like above (TV is on but sensor shows unavailable). I went back to mqtt 6.1.3 but is still broken.

MagoPoza commented 1 year ago

Hello, I also have the same problem since I updated the Mosquito Broker addon to version 6.2.0

currydani commented 1 year ago

Same here, the integration isn't working at all since the mqtt 6.2.0 update

sehaas commented 1 year ago

In fact after update it is only impossible to switch on tv, so I don't know why Mosquito update break WoL.

Don't see any relation between MQTT and WoL.

After manual TV on (local button ora IR remote), all works OK.

(bad) Mosquitto addon 6.2.0 uses Mosquitto 2.0.15 (working) Mosquitto addon 6.1.3 uses Mosquitto 2.0.11 https://mosquitto.org/ChangeLog.txt so maybe you can find dependecies with non-working WoL…

Thanks for narrowing it down to those versions. I don't use the addon, so I can't say anything about this. The changelog stated some TLS/SSL related changes. Maybe those are related.

When TV is off it generates errors (something like this was also existing in old Mosquitto, I'll downgrade addon to show later)

2023-03-28 15:44:18: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:44:30: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:44:33: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:44:58: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:45:01: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:45:32: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:45:35: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:46:06: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:46:09: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:46:40: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:46:43: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:46:54: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:46:57: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:47:06: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:47:09: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:47:26: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:47:29: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:48:00: Connecting bridge Hisense (192.168.20.60:36669)
2023-03-28 15:48:03: Client local.HomeAssistant disconnected: Protocol error.
2023-03-28 15:48:34: Connecting bridge Hisense (192.168.20.60:36669)

Looks OK for me. The bridge tries to connect to the TV, but the TV (and it's broker) are switched off.

Can anyone confirm if the bride is still working with Mosquitto 2.0.15 and the MQTT messages are still available there?

sehaas commented 1 year ago

Can anyone confirm if the bride is still working with Mosquitto 2.0.15 and the MQTT messages are still available there?

Answering myself: Can confirm the bridge is still working under 2.0.11, but not under 2.0.15. I'll try to narrow it down, but can't give you any ETA. If anyone want to help, please increase the Mosquitto loglevel and look for something SSL/certificate related.

NeeeeB commented 1 year ago

@sehaas well that is odd... I've had to restart HA (to validate the latest HACS update), and your addon is working again. sensor.hisense_tv gives me all infos, including that the TV is actually displaying Dolby Vision and so on... It didn't work for days, and now suddenly it works. Let's see if it still works in a day or two, maybe the log spam causes Mosquitto to "disable" it somehow ? still on Mosquitto 2.0.15 with addon 6.2.0 though, nothing changed on this side.

nepozs commented 1 year ago

Yes, in some situations it starts work, but it is really unstable. I can't test it now (as I'm not home for few days), but it looks like it does not work after machine reboot, but additional HA restart sometimes helps.

szoller commented 1 year ago

I have the same issues, the sensor became unavailable and i cant control the TV anymore.

The mosquitto Log does not Show anything about the bridge anymore. Just the saving of the database each 30 minutes...

Mosquitto Broker Add-On 6.2.0 (mosquitto 2.0.15). (Add-On Version also changed libwebsockets to 4.3.2)

Schoultzies commented 1 year ago

Will be a real shame if this amazing addon goes the way of the dodo. If there is anything I could do to help, let me know.

geniomatto commented 1 year ago

Ciao a tutti.... ho risolto il problema. Bisogna semplicemente rigenerare il certificato "hisense.crt" nella cartella /ssl

ho seguito questa procedura:

Run this command inside a linux terminal, to get the certificates needed to connect to the TVs embedded MQTT broker:

openssl s_client -host TV_IP_ADDRESS_CHANGE_IT_HERE -port 36669 -showcerts Copy-paste inside the file /ssl/hisense.crt both certificates shown from the previous command, with this structure as an example:

-----BEGIN CERTIFICATE----- qmierjfpaoisdjmçfaisldjcçfskdjafcaçskdjcçfmasidcf(...) -----END CERTIFICATE-----

-----BEGIN CERTIFICATE----- 7ferusycedaystraedyasredyatrdsecdtrseydtraESYDTRASCY (...) -----END CERTIFICATE-----

toddstar commented 1 year ago

Hi all.... I solved the problem. You simply need to regenerate the "hisense.crt" certificate in the /ssl folder

I followed this procedure:

Run this command inside a linux terminal, to get the certificates needed to connect to the TVs embedded MQTT broker:

openssl s_client -host TV_IP_ADDRESS_CHANGE_IT_HERE -port 36669 -showcerts Copy-paste inside the file /ssl/hisense.crt both certificates shown from the previous command, with this structure as an example:

-----BEGIN CERTIFICATE----- qmierjfpaoisdjmçfaisldjcçfskdjafcaçskdjcçfmasidcf(...) -----END CERTIFICATE-----

-----BEGIN CERTIFICATE----- 7ferusycedaystraedyasredyatrdsecdtrseydtraESYDTRASCY (...) -----END CERTIFICATE-----

Pretty certain this isn't the fix and you're just seeing it reconnect but will drop shortly; I have a none SSL TV but still have the connection issue after upgrading to 6.2.0. Mine actually works for a bit on restart (with the debug option turned on) but then stops (I've actually setup an automation to restart mosquitto every 60 mins and have a stable reading of my TV now but obviously not idea and something HA addon needs to fix, especially as rebooting mosquitto turns on one of my lights lol)

MnM001 commented 1 year ago

New mosquitto version released today. Took a snapshot of HA and upgraded to OS v10 and then upgraded mosquitto to latest. Next I delete the HiSenseTV integration. Turn the TV on manually. Re-do the integration.

Seems to work fine so far - been testing for the past 30m - turned on/off a few times via my automation. No issues yet. My TV doesn't use SSL certificates.

kitkat270 commented 1 year ago

Deleting the integration, re-downloading and setting up again has fixed this for me.

MnM001 commented 1 year ago

And OS 10.1 broke it again. After removing the integration and adding it back again it wont find the TV anymore (at the config stage where you enter your TV's IP and MAC). It just searches for it forever.

sehaas commented 1 year ago

The problem isn't the integration - it's the mqtt bridge IMHO. I didn't find time to investigate it further, sorry.

Schoultzies commented 1 year ago

Connects fine to an external MQTT broker Screenshot 2023-05-02 160737 Then bridged back to homeassistant

Schoultzies commented 1 year ago

Other users of addons with a bridge have reported that renaming the .conf file (hisense.conf) to mosquitto.conf fixes the bridge. Seems to be working but would be great if anyone else could try.

toddstar commented 1 year ago

Other users of addons with a bridge have reported that renaming the .conf file (hisense.conf) to mosquitto.conf fixes the bridge. Seems to be working but would be great if anyone else could try.

Also isn't the fix. Just another Temporary work around

Schoultzies commented 1 year ago

Other users of addons with a bridge have reported that renaming the .conf file (hisense.conf) to mosquitto.conf fixes the bridge. Seems to be working but would be great if anyone else could try.

Also isn't the fix. Just another Temporary work around

Been over 24hrs, still works fine. When you say it is not the fix, what should I expect to happen?

MnM001 commented 1 year ago

I have installed a new mqtt on a separate server. I have added it to HA. It is working with Home Assistant as I have added a power plug to it and it works fine.

I want to add the HiSense TV to this so I can test but I have no idea how to go about it. Anyone can guide me in how to add the HiSenseTV to the mqtt running on a different server and then integrate it with HA?

I guess that the hisense.conf file will need to move to the new mqtt - but where do I put it? How do I tell the new mqtt to read it? And then how does the HA HiSenseTV integration will know about it?

nepozs commented 1 year ago

@MnM001 That's outside the scope of this thread, just create separate issue.

But generally the MQTT broker needs to be properly configured and you should do it according to its documentation and bridge connection between brokers must use settings which could be accepted by TV.

@Schoultzies Maybe it works, but it isn't solution, MQTT broker should accept more than one bridge configuration (so should not accept only one configuration file).

toddstar commented 1 year ago

Other users of addons with a bridge have reported that renaming the .conf file (hisense.conf) to mosquitto.conf fixes the bridge. Seems to be working but would be great if anyone else could try.

Also isn't the fix. Just another Temporary work around

Been over 24hrs, still works fine. When you say it is not the fix, what should I expect to happen?

Renaming mine still caused the bridge to drop connection fairly often and requires a mosquitto reboot to reconnect the bridge

Edit: Altho my dropped connected / reconnection is probably made worse by the fact I have an smart switch that kills the power to TV & Sky box, others in the HA tickets seem to indicate just 1 reboot of mosquitto after HA restarts is enough. So can probably just add an automation to reboot mosquitto after HA boots rather than restarting mosquitto every hour like I have setup atm.

MnM001 commented 1 year ago

@MnM001 That's outside the scope of this thread, just create separate issue.

But generally the MQTT broker needs to be properly configured and you should do it according to its documentation and bridge connection between brokers must use settings which could be accepted by TV.

@nepozs Yeah I thought this belongs in here as is part of the troubleshooting this issue. Why? Because right now I am running latest mqtt (6.2.1) with HAOS 10.0 It all runs fine. As soon as I apply HAOS 10.1 update (so mqtt isnt touched according to HA) the whole thing breaks down again. I thought I will test and see what happens if I run mqqt on another server and HAOS 10.1 But to do that I need to have the configuration done and working with HAOS 10.0

Anyway Ill create a new thread for this (and maybe you can help me in there as while I understand the concept I have no idea how to implement it) and report back my findings back here afterwards.

Cheers

MnM001 commented 1 year ago

OK so I am back with some feedback. I have built an mqtt server and got it working with HA and HiSense TV integration. I can now reboot HA and have the integration running fine. However, if I reboot the mqtt server the integration will stop working.

Need to restart mqtt to get it going again.

No sure where the issue is - is it Home Assistant or it is an mqtt issues? not sure. In the new server I am using the official mqtt docker for this not the HA one.

NeeeeB commented 1 year ago

Well, some feedback after a few updates. I'm currently running Home Assistant 2023.4.6 And Mosquitto broker 6.2.1 I must say that I don't have any problem anymore. Everything works as expected, and it's been the case for a few weeks now. I even rebooted HA a few times after modifying some things, and it works reliably immediatly. Maybe the problems in Mosquitto got fixed ?

slipx06 commented 1 year ago

still not working for me

ash16888 commented 1 year ago

I also had problems with mosquitto add-on new version, I decided to replace it with EMQX, got some troubles setting up the bridge, but now everything is working

Schoultzies commented 1 year ago

I also had problems with mosquitto add-on new version, I decided to replace it with EMQX, got some troubles setting up the bridge, but now everything is working

Would you be able to share what those issues were? I assume that the certificates were compatible with EMQX?

NeeeeB commented 1 year ago

Well in fact it is still not working for me too. I thought it worked for a few days, but no... @sehaas did you find a bit of time to have a look at it ?

toddstar commented 1 year ago

I also had problems with mosquitto add-on new version, I decided to replace it with EMQX, got some troubles setting up the bridge, but now everything is working

can you share your config? Have Ingress (receiving data) working with EMQX but can't seem to get Egress working.

ash16888 commented 1 year ago

can you share your config? Have Ingress (receiving data) working with EMQX but can't seem to get Egress working.

Ingress remoteapp/# >> hisense/remoteapp/# Egress hisense1/remoteapp/# >> remoteapp/# using topic rewrite

Screenshot from 2023-06-29 08-03-00 Screenshot from 2023-06-29 08-02-09 Screenshot from 2023-07-08 09-17-24

toddstar commented 1 year ago

can you share your config? Have Ingress (receiving data) working with EMQX but can't seem to get Egress working.

Ingress remoteapp/# >> hisense/remoteapp/# Egress hisense1/remoteapp/# >> remoteapp/# using topic rewrite

Thanks, config page for the bridge makes it seem like topic rewrite isn't needed but adding that has got mine working 😄

lukasloetkolben commented 1 year ago

i just can't get it to run anymore with mosquitto. any updates?

toddstar commented 1 year ago

Mosquitto 6.3.0 seems to have fixed the bridge connection issue.

I swapped back to mosquitto from EMQX 3 days ago and haven't had to manually restart mosquitto once. Even after my TV has been powered completely off, so the bridge connection is completely disconnected for 6-12 hours, Its back to auto reconnecting once the TV is powered up.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 42 days with no activity. Remove stale label or comment or this will be closed in 7 days

royaldunlin commented 10 months ago

can you share your config? Have Ingress (receiving data) working with EMQX but can't seem to get Egress working.

Ingress remoteapp/# >> hisense/remoteapp/# Egress hisense1/remoteapp/# >> remoteapp/# using topic rewrite

Screenshot from 2023-06-29 08-03-00 Screenshot from 2023-06-29 08-02-09 Screenshot from 2023-07-08 09-17-24

For some reason my interface doesn't look like yours under the ingress and egress sections when creating a connector. Has the interface changed? Can you proved an updated screenshot?

ash16888 commented 10 months ago

Has the interface changed? Can you proved an updated screenshot?

all the same

royaldunlin commented 10 months ago

Has the interface changed? Can you proved an updated screenshot?

all the same

So this is under Integration > Connector. And there are only part of the options available in your screenshots. It appears to be missing the Local MQQT Broker section. Am I in the wrong interface?

Screenshot 2023-12-31 at 2 05 14 PM Screenshot 2023-12-31 at 2 05 58 PM