b0mbays / continuously_casting_dashboards

HACS Integration for continuously casting a Home Assistant dashboard to your Google Chromecast Displays
MIT License
208 stars 9 forks source link

Help getting to cast to lenovo smart display #47

Closed Roachforlife closed 7 months ago

Roachforlife commented 7 months ago

Hello. Followed the steps and cant seem to get it to push the dashboard to the screen. I do see in the logviewer where its changing the volume (although odd as I didnt put in yaml to do so). And also see 'Executing the dashboard cast command".

From logviewer 2024-02-24 20:29:46.638 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] All device map: {'Giuseppe': {'instances': [{'dashboard_url': 'http:/192.168.19.50:8123/lovelace/default_view/default_view?kiosk', 'dashboard_state_name': 'Dummy', 'media_state_name': 'PLAYING', 'volume': -1, 'start_time': datetime.time(7, 0), 'end_time': datetime.time(23, 0), 'instance_change': False}], 'current_instance': 0}} Current device map: {'Giuseppe': {'dashboard_url': 'http:/192.168.19.50:8123/lovelace/default_view/default_view?kiosk', 'dashboard_state_name': 'Dummy', 'media_state_name': 'PLAYING', 'volume': -1, 'start_time': datetime.time(7, 0), 'end_time': datetime.time(23, 0), 'instance_change': False}} 2024-02-24 20:29:46.640 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Current local time: 20:29:46.637115 2024-02-24 20:29:46.643 INFO (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Local time is inside the allowed casting time for Giuseppe. Start time: 07:00:00 - End time: 23:00:00

2024-02-24 20:29:50.064 DEBUG (MainThread) [custom_components.continuously_casting_dashboards.dashboard_caster] Status output for Giuseppe when checking for dashboard state 'Dummy': Volume: 5 Volume muted: False 2024-02-24 20:29:52.284 ERROR (MainThread) [aiohttp.server] Error handling request (SORRY I AM UNSURE IF THIS IS RELATED BUT ITS RIGHT AFTER IN THE LOG FILE) Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 350, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: 400, message: Invalid method encountered: b'\x16\x03\x01\x02\x96\x01'

YAML homeassistant: external_url: "https://ha.domain.com" auth_providers:

continuously_casting_dashboards: logging_level: debug cast_delay: 45 start_time: "07:00" end_time: "00:00" devices: "Giuseppe":

QUESTION - Is the dashboard url Im using look correct? I am using just the main default dash but unsure if maybe I shouldnt have lovelace in there? Guessing that because its the stock one is why its there. Just checking.

Thanks for any help you can provide

b0mbays commented 7 months ago

Hi, I think you are correct with the dashboard url. It needs to be an external URL to your HA instance.

If you were to try and connect to your instance when you're not connected to your WiFi, that's the URL required. Currently it looks like you're using an internal IP address.

Roachforlife commented 7 months ago

Thanks for the reply. I will try that however the github page very explicitly says to use the internal IP address for the dashboard. Should I instead use https://ha.domain.com used for cloudflare?

Here is from the github notes

b0mbays commented 7 months ago

Yep. You are correct! That's my tired brain from this morning, apologies! I'm also using the internal URL 😂 OK I'll look into your error more now

b0mbays commented 7 months ago

Could you post your config inside a formatted code block with the indentation etc

b0mbays commented 7 months ago

I can see that you are missing a forward slash in your dashboard URL:

- dashboard_url: "http:/192.168.19.x:8123/lovelace/default_view/default_view?kiosk" Change to:

- dashboard_url: "http://192.168.19.x:8123/lovelace/default_view/default_view?kiosk"

Roachforlife commented 7 months ago

Thanks for the info, I must have caught that as it was showing right upon checking my YAML again. I did try both the external address and now its back to the internal (http), same issue. I was able to see more stuff on the logs though that may be useful to you. So I have 2 displays, both lenovo, one is the 10" one called Giuseppe and one is the little clock with a screen which I am not doing anything with. I am noticing it picks up on there even tho I never referenced the small clock. I confirmed and the name and ip is correct for Giueseppe as well. One question, I do use the photo frame feature from google photos. Is it possible this has to be disabled for the casting to work?

`

Logger: pychromecast.socket_client Source: /usr/local/lib/python3.12/site-packages/pychromecast/socket_client.py:678 First occurred: 1:09:32 PM (2 occurrences) Last logged: 2:14:21 PM

[Giuseppe(192.168.19.110):8009] Heartbeat timeout, resetting connection [Guest Bedroom clock(192.168.19.118):8009] Heartbeat timeout, resetting connection`

`Logger: pychromecast.socket_client
Source: /usr/local/lib/python3.12/site-packages/pychromecast/socket_client.py:398
First occurred: 1:09:47 PM (2 occurrences)
Last logged: 2:14:51 PM

[Giuseppe(192.168.19.110):8009] Failed to connect to service ServiceInfo(type='host', data=('192.168.19.110', 8009)), retrying in 5.0s
[Guest Bedroom clock(192.168.19.118):8009] Failed to connect to service ServiceInfo(type='mdns', data='Lenovo-Smart-Clock-263ee99405a87f4e81d53d23057a7b79._googlecast._tcp.local.'), retrying in 5.0s

`

Roachforlife commented 7 months ago

Sorry Ive never used the code/indent feature before lol. Hopefully the above gets it across well enough. its two different logs

Roachforlife commented 7 months ago

Interesting... I was staring at the the screen and saw 'DashCast' pop up for a second, but then it went back to what was on the screen. As mentioned earlier, it keeps changing the volume too. Is it possible its not compatible with the Lenovo Smart Display? Come to think of it, I have a Nest Hub v2. Let me try it against that and see if anything changes.

Oh and another question, since its seeing 2 screens on my network (well 3 if I put this Nest Hub back online), do I need to feed the yaml info on the others, even if not using?

Roachforlife commented 7 months ago

Here is a low quality (wasnt sure max file size) of what Im seeing on the device

https://github.com/b0mbays/continuously_casting_dashboards/assets/131777701/16378444-f6b4-4d21-ade5-df4c447201c1

Roachforlife commented 7 months ago

I have good news. Its working!

Not sure which thing fixed this but let me describe what I just changed. Now, after adding a nest hub I had, I have 3 displays in my house. So I had only the 1 in the yaml before since I was only casting to 1. I put the other 2 in there in terms of IPs and user and whatnot. Doubting this made the difference but maybe?

Then I went to my user to triple check the ID was right. I hadn't made this an Admin so I changed to admin.

After restarting it prompted for me to log in, so I used the onscreen keyboard and it looks right. Can I confirm whether I am supposed to have the user set to Admin or not? I had thought the " allow_bypass_login: true" would make it so I didnt have to log in, so I guess I will monitor and see if it asks me that each time and report back, Thanks! :)

b0mbays commented 7 months ago

Amazing! Yes I believe the user ID will need to be admin. I'll add that to the readme as I don't think I mention that.

It shouldn't be asking you to login though, it should bypass that login... 🤔 Can you try restarting again and double checking the trusted network IP address is the exact one on your display?

Also, I have the exact same Lenovo display and it works brilliantly. I can get two live RTSP streams on this working whereas I can only get one working on the Nest Hubs. 20230320_104400.jpg

Roachforlife commented 7 months ago

Thanks for confirming. And yeh I thought it was weird it was prompting since it was under trusted networks and trusted users. I am seeing the IP listed, and its the same and the correct one for the Lenovo Display. Dumb Q but does the order of how its listed matter? Should the allow bypass maybe be higher up on the list?

homeassistant:
  external_url: "https://ha.domain.com"
  auth_providers:
    - type: trusted_networks
      trusted_networks:
        - 192.168.19.110/32 #These are my display IP addresses, replace them with your own (including the /32)
        - 192.168.19.118/32 #These are my display IP addresses, replace them with your own (including the /32)
        - 192.168.19.200/32 #These are my display IP addresses, replace them with your own (including the /32)
      trusted_users:
        192.168.19.110: 7d1xxx
        192.168.19.118: 7d1xxx
        192.168.19.200: 7d1xxx
      allow_bypass_login: true
    - type: homeassistant
b0mbays commented 7 months ago

You have everything in the same order as me so that shouldn't be an issue...

Maybe there is something wrong with your http section (if you have one). I found this old issue here where someone commented out a line (I'm not sure which based off the comment) and the login page issue was fixed, could you share what you have in this section?

https://github.com/b0mbays/continuously_casting_dashboards/issues/36#issue-1893522685

Roachforlife commented 7 months ago

I actually battled with this one recently in order to get Cloudflare with Lets Encrypt working. Right now I have it set to my internal network and the CF server. If you have other suggestions let me know, thanks agian

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 192.168.19.0/24
    - 172.30.33.2
    - 172.30.0.0/24
b0mbays commented 7 months ago

Could you try just removing the local IP address inside here (the 192.168 one) to see if that fixes the trusted network? Just to test it, I'm aware this may break something with Cloudfare but you can put it back

sebastian-bugajny commented 7 months ago

Amazing! Yes I believe the user ID will need to be admin. I'll add that to the readme as I don't think I mention that.

It shouldn't be asking you to login though, it should bypass that login... 🤔 Can you try restarting again and double checking the trusted network IP address is the exact one on your display?

Also, I have the exact same Lenovo display and it works brilliantly. I can get two live RTSP streams on this working whereas I can only get one working on the Nest Hubs. 20230320_104400.jpg

I'm using Google Nest Hub for the same purpose and till version 2024.2 I was able to get 4 live streams via RTSP, now I cannot stream even one. Not sure what have changed as I cannot find anything related.

Roachforlife commented 7 months ago

Could you try just removing the local IP address inside here (the 192.168 one) to see if that fixes the trusted network? Just to test it, I'm aware this may break something with Cloudfare but you can put it back

I did remove it and my CF is still working. I actually dont know how to test the HA dashcast though as it hasnt prompted me after I logged in. Perhaps I should manually log out of it on the lenovo itself? And then see if it prompts for login again?

Roachforlife commented 7 months ago

Ok I did just that. Turned off kiosk mode, logged out, then reset it back. It logged in without prompting so I assume that did work. Sounds like the issue was I had my local network (which my display obviously lives in) in the trusted proxies area of http which I suppose causes the trusted networks or users not to work right.

b0mbays commented 7 months ago

Ok I did just that. Turned off kiosk mode, logged out, then reset it back. It logged in without prompting so I assume that did work. Sounds like the issue was I had my local network (which my display obviously lives in) in the trusted proxies area of http which I suppose causes the trusted networks or users not to work right.

Great news! Glad you got it sorted. 😄

b0mbays commented 7 months ago

Amazing! Yes I believe the user ID will need to be admin. I'll add that to the readme as I don't think I mention that. It shouldn't be asking you to login though, it should bypass that login... 🤔 Can you try restarting again and double checking the trusted network IP address is the exact one on your display? Also, I have the exact same Lenovo display and it works brilliantly. I can get two live RTSP streams on this working whereas I can only get one working on the Nest Hubs. 20230320_104400.jpg

I'm using Google Nest Hub for the same purpose and till version 2024.2 I was able to get 4 live streams via RTSP, now I cannot stream even one. Not sure what have changed as I cannot find anything related.

Yep and for this reason I haven't updated to 2024.2! I rolled back to 2023.12.4 and the streams are working great.

I did find someone else who had the same issue here, but I don't think they ever found a fix:

https://community.home-assistant.io/t/2024-2-more-voice-more-icons-more-integrations-more-everything/686359/330

b0mbays commented 7 months ago

@sebastian-bugajny I just found a couple issues on the HA github regarding this problem:

https://github.com/home-assistant/core/issues/110563

https://github.com/home-assistant/frontend/issues/19799

sebastian-bugajny commented 7 months ago

@sebastian-bugajny I just found a couple issues on the HA github regarding this problem:

home-assistant/core#110563

home-assistant/frontend#19799

Thanks I'll be monitoring it from there. I wouldn't like to go back to old HA version as in other case in 6 months half of my stack won't be working if I decide for an upgrade.