leikoilja / ha-google-home

Home Assistant Google Home custom component
MIT License
439 stars 74 forks source link

Feature - Check if device is compatible through eureka endpoint #220

Open DurgNomis-drol opened 3 years ago

DurgNomis-drol commented 3 years ago

Actually even if the devices returns a 200 for eureka_info, there is no guaranty that the device supports alarms or timers, we still would need to check assistant_supported. This can also come in handy in the future where we can check what other features is supported.

The check should probably be a combination of both like this:

  1. Request eureka_info if 404 return device not compatible. Else continue check.
  2. Check if assistant_supported is true, return device is compatible. If false return device is not compatible.

Originally posted by @DurgNomis-drol in https://github.com/leikoilja/ha-google-home/issues/212#issuecomment-821975322

eureka_info example:

"device_info": {
  "capabilities": {
    "aogh_supported": true,
    "assistant_supported": true,
    "audio_hdr_supported": false,
    "audio_surround_mode_supported": false,
    "ble_supported": true,
    "bluetooth_audio_sink_supported": true,
    "bluetooth_audio_source_supported": true,
    "bluetooth_supported": true,
    "cloudcast_supported": true,
    "content_filters_supported": true,
    "display_supported": false,
    "fdr_supported": false,
    "hdmi_prefer_50hz_supported": false,
    "hdmi_prefer_high_fps_supported": false,
    "hotspot_supported": true,
    "https_setup_supported": true,
    "input_management_supported": true,
    "keep_hotspot_until_connected_supported": true,
    "multi_user_supported": true,
    "multichannel_group_supported": true,
    "multizone_supported": true,
    "night_mode_supported": true,
    "night_mode_supported_v2": true,
    "opencast_supported": false,
    "preview_channel_supported": true,
    "reboot_supported": true,
    "remote_ducking_supported": true,
    "separate_tts_volume_supported": true,
    "setup_supported": true,
    "sleep_mode_supported": true,
    "stats_supported": true,
    "system_sound_effects_supported": false,
    "user_eq_supported": true,
    "wifi_auto_save_supported": true,
    "wifi_regulatory_domain_locked": true,
    "wifi_supported": true
    },
}
KapJI commented 3 years ago

If eureka_info is 200, we should create device sensor. If assistant_supported is true we should also create alarms and timers sensors and do not disturb switch.

leikoilja commented 3 years ago

Great idea! That exactly what i was thinking in earlier discussions, we could probably take a step backwards and implement it in the following manner:

stboch commented 3 years ago

yup also the reboot device function can be based on reboot_supported. A stub for future Bluetooth work based on ble_supported.