home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.34k stars 29.88k forks source link

Discovery not finding Cast devices #6635

Closed darkps10n closed 7 years ago

darkps10n commented 7 years ago

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version): 0.40.0 (docker version from https://hub.docker.com/r/homeassistant/home-assistant/)

Python release (python3 --version): Python 3.5.3

Component/platform: Cast

Description of problem:

Not Discovering any devices, doesn't seem like I can manually detect either

Expected: To auto discover devices on network

Problem-relevant configuration.yaml entries and steps to reproduce:

```yaml homeassistant: # Name of the location where Home Assistant is running name: Home # Location required to calculate the time the sun rises and sets latitude: super secret longitude: super secret # Impacts weather/sunrise data (altitude above sea level in meters) elevation: secret # metric for Metric, imperial for Imperial unit_system: metric # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones time_zone: Antarctica # Show links to resources in log and frontend #introduction: # Enables the frontend frontend: # Enables configuration UI config: http: # Uncomment this to add a password (recommended!) # api_password: PASSWORD # Uncomment this if you are using SSL or running in Docker etc # base_url: example.duckdns.org:8123 # Checks for available updates updater: # Discover some devices automatically discovery: # Allows you to issue voice commands from the frontend in enabled browsers conversation: # Enables support for tracking state changes over time. history: # View all events in a logbook logbook: # Track the sun sun: # Weather Prediction sensor: - platform: wunderground api_key: secret api key monitored_conditions: - alerts - feelslike_c - precip_1hr_metric - precip_today_metric - solarradiation - temp_c - weather - platform: time_date display_options: - 'time' - 'date' - 'beat' # Text to speech tts: platform: google mqtt: broker: secret ip port: secret port client_id: home-assistant-1 keepalive: 60 username: HA password: HA protocol: 3.1 birth_message: topic: "tele/hass1/LWT" payload: "Online" qos: 1 retain: true will_message: topic: "tele/hass1/LWT" payload: "Offline" qos: 1 retain: true notify: - name: PushBullet platform: pushbullet api_key: secret api key media_player: - platform: kodi host: secret ip port: 80 name: Living Room Kodi - platform: cast device_tracker: # - platform: owntracks # max_gps_accuracy: 200 # waypoints: True # waypoint_whitelist: - platform: unifi username: secret username password: secret password interval_seconds: 10 consider_home: 60 track_new_devices: no verify_ssl: false #Groups group: living_room_lamps: - switch.living_room_left_lamp - switch.living_room_right_lamp inside_lights: - switch.living_room_left_lamp - switch.living_room_right_lamp Time: - sensor.date - sensor.time #Devices switch: - platform: mqtt name: "Living Room Left Lamp" state_topic: "stat/LivingRoomLampL/POWER" command_topic: "cmnd/LivingRoomLampL/POWER" qos: 1 payload_on: "ON" payload_off: "OFF" retain: true - platform: mqtt name: "Living Room Right Lamp" state_topic: "stat/LivingRoomLampR/POWER" command_topic: "cmnd/LivingRoomLampR/POWER" qos: 1 payload_on: "ON" payload_off: "OFF" retain: true - platform: mqtt name: "Garage Door" state_topic: "stat/Garagedoor/POWER" command_topic: "cmnd/Garagedoor/POWER" qos: 1 payload_on: "ON" payload_off: "OFF" retain: true automation: - alias: 'Turn a few lights on when the sun gets dim' trigger: - platform: numeric_state entity_id: sun.sun value_template: '{{ state.attributes.elevation }}' below: 5 condition: condition: state entity_id: group.all_devices state: 'home' action: service: switch.turn_on entity_id: group.living_room_lamps - alias: Turn on lights when raining trigger: - platform: state entity_id: sensor.pws_weather state: 'Rain' - platform: state entity_id: sensor.pws_weather state: 'Thunderstorm' - platform: state entity_id: sensor.pws_weather state: 'Overcast' condition: - condition: state entity_id: group.all_devices state: 'home' - condition: time after: '15:00' before: '18:00' action: service: switch.turn_on entity_id: group.living_room_lamps - alias: Turn off all inside lights when leaving house trigger: - platform: state entity_id: group.all_devices state: 'not_home' action: service: switch.turn_off entity_id: group.inside_lights - alias: Garage Door Open/Close trigger: - platform: state entity_id: switch.garage_door to: 'on' action: - service: switch.turn_on entity_id: switch.garage_door - delay: 00:00:00.3 - service: switch.turn_off entity_id: switch.garage_door - alias: lights on arriving home trigger: - platform: state entity_id: group.all_devices from: 'not home' to: 'home' condition: - condition: state entity_id: sun.sun state: 'below_horizon' action: service: switch.turn_on entity_id: group.living_room_lamps ```
  1. Just Start up HASS

Traceback (if applicable):

```bash The following errors have been logged this session: 17-03-15 00:05:12 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform cast Traceback (most recent call last): File "/usr/local/lib/python3.5/site-packages/pychromecast/discovery.py", line 107, in discover_chromecasts listener, browser = start_discovery(callback) File "/usr/local/lib/python3.5/site-packages/pychromecast/discovery.py", line 88, in start_discovery ServiceBrowser(Zeroconf(), "_googlecast._tcp.local.", listener) File "/usr/local/lib/python3.5/site-packages/zeroconf.py", line 1660, in __init__ self._listen_socket = new_socket() File "/usr/local/lib/python3.5/site-packages/zeroconf.py", line 1632, in new_socket s.bind(('', _MDNS_PORT)) OSError: [Errno 98] Address already in use During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/app/homeassistant/helpers/entity_component.py", line 153, in _async_setup_platform entity_platform.schedule_add_entities, discovery_info File "uvloop/future.pyx", line 230, in __iter__ (uvloop/loop.c:110600) File "uvloop/future.pyx", line 432, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:113980) File "uvloop/future.pyx", line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108900) File "/usr/local/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/app/homeassistant/components/media_player/cast.py", line 64, in setup_platform hosts = [tuple(dev[:2]) for dev in pychromecast.discover_chromecasts() File "/usr/local/lib/python3.5/site-packages/pychromecast/discovery.py", line 114, in discover_chromecasts stop_discovery(browser) UnboundLocalError: local variable 'browser' referenced before assignment 17-03-15 00:05:16 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/app/homeassistant/components/discovery.py", line 128, in _discover netdisco.scan() File "/usr/local/lib/python3.5/site-packages/netdisco/discovery.py", line 57, in scan self.mdns.start() File "/usr/local/lib/python3.5/site-packages/netdisco/mdns.py", line 20, in start self.zeroconf = zeroconf.Zeroconf() File "/usr/local/lib/python3.5/site-packages/zeroconf.py", line 1660, in __init__ self._listen_socket = new_socket() File "/usr/local/lib/python3.5/site-packages/zeroconf.py", line 1632, in new_socket s.bind(('', _MDNS_PORT)) OSError: [Errno 98] Address already in use During handling of the above exception, another exception occurred: Traceback (most recent call last): File "uvloop/future.pyx", line 374, in uvloop.loop.BaseTask._fast_step (uvloop/loop.c:112704) File "/usr/src/app/homeassistant/components/discovery.py", line 111, in scan_devices None, _discover, netdisco) File "uvloop/future.pyx", line 230, in __iter__ (uvloop/loop.c:110600) File "uvloop/future.pyx", line 432, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:113980) File "uvloop/future.pyx", line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108900) File "/usr/local/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/app/homeassistant/components/discovery.py", line 134, in _discover netdisco.stop() File "/usr/local/lib/python3.5/site-packages/netdisco/discovery.py", line 82, in stop self.mdns.stop() File "/usr/local/lib/python3.5/site-packages/netdisco/mdns.py", line 34, in stop self.zeroconf.close() AttributeError: 'NoneType' object has no attribute 'close' 17-03-15 00:12:01 ERROR (MainThread) [homeassistant.core] Invalid service data for automation.trigger: extra keys not allowed @ data['friendly_name']. Got 'lights on arriving home' extra keys not allowed @ data['last_triggered']. Got None 17-03-15 00:12:18 ERROR (MainThread) [homeassistant.core] Invalid service data for automation.trigger: extra keys not allowed @ data['friendly_name']. Got 'Turn a few lights on when the sun gets dim' extra keys not allowed @ data['last_triggered']. Got None ```

Additional info:

rpitera commented 7 years ago

Not sure if this is related but at least two of my cast devices weren't showing up at all. When I checked my home app they showed as linked but not active. I rebooted both devices from the Home app and then restarted HA. Both showed up immediately.

Now, I wasn't getting the Address already in use error, but I would suggest trying the same steps to see if it helps.

balloob commented 7 years ago

Do you have any other services on your machine that are running a zeroconf service?

fabaff commented 7 years ago

There is no further reaction of the reporter. Closing this.

If it's a bug, please re-open the issue or use the forum for questions about installation, setup, and configuration.