vlebourl / custom_vesync

Custom VeSync component for Home Assistant
99 stars 72 forks source link

Core 300s missing entities #30

Closed acinc0 closed 2 years ago

acinc0 commented 2 years ago

Hello,

thank you @vlebourl for you fantastic job.

I am a newbie with HA and integrations, I just recently started (~1 month) I'm trying to integrate my Levoit 300s air purifier to HA, but I only managed to have access to 2 entities: fan (on/off) and fan speed level. I enabled debug logging, and this is what I see from my HA log:

DEBUG (MainThread) [custom_components.vesync.common] Found a fan: {'manager': <pyvesync.vesync.VeSync object at 0x7f364a3e82b0>, 'device_name': 'Master Bedroom ', 'device_image': 'https://image.vesync.com/defaultImages/deviceDefaultImages/wifibtonboardingnotify_airpurifier_core300s_eu_240.png', 'cid': 'vsaqeb7ec52e4ded8fe37b03f359af8f', 'connection_status': 'online', 'connection_type': 'WiFi+BTOnboarding+BTNotify', 'device_type': 'Core300S', 'type': 'wifi-air', 'uuid': '49c116ac-d91a-40fc-8d22-209e314dec26', 'config_module': 'WiFiBTOnboardingNotify_AirPurifier_Core300S_EU', 'mac_id': 'a8:48:fa:73:26:ea', 'mode': 'manual', 'speed': 2, 'extension': {'airQuality': -1, 'airQualityLevel': 1, 'mode': 'manual', 'fanSpeedLevel': '2'}, 'current_firm_version': None, 'sub_device_no': None, 'config': {'display': True, 'display_forever': True}, 'device_status': 'on', 'enabled': True, 'config_dict': {'module': 'VeSyncAirBypass', 'models': ['Core300S', 'LAP-C301S-WJP'], 'modes': ['sleep', 'off', 'auto'], 'features': ['air_quality'], 'levels': [1, 2, 3, 4]}, 'features': ['air_quality'], 'modes': ['sleep', 'off', 'auto'], 'air_quality_feature': True, 'details': {'filter_life': 100, 'mode': 'manual', 'level': 0, 'display': True, 'child_lock': False, 'night_light': 'off', 'air_quality': 1, 'display_forever': False, 'air_quality_value': 1}}

How do I get access to other entities, like air quality, modes, night light and so on listed above?

vlebourl commented 2 years ago

Hi,

Thank you for your issue, and sorry for the delay. I believe modes should already be available via the fan entity. On the humidifier it appears here: image

Regarding the night light, it should be fairely easy to add. Are you comfortable with editing the code? I don't own this device, so testing is not easy. If you are, can you edit the following file: config/custom_components/vesync/light.py and change line 53 from

        elif is_humidifier(dev.device_type):

to:

        elif is_humidifier(dev.device_type) or "night_light" in dev.details:

Concerning air quality, I'm not sure how to do it. How does it appear in the app? Could you add some screen-shots with different values? Could you also include the device diagnostics? They are available on the Settings -> Integration -> VeSync -> YourDevice -> Download diagnostics.

Thanks

acinc0 commented 2 years ago

Hi @vlebourl,

Thank you and sorry for the late reply, I just got back home today.

I have edited the code for the night light, however no new entities have been discovered. I will wait and see what happens.

These are the entities that I have currently access to with the integration:

Entities

The fan of the air purifier has 3 levels, with the integration I have access to a 4th level that doesn't do anything, but it's not a big deal. I don't have access to the the modes (sleep or auto), that would be handy, especially for automation in HA. I will try and play with the code (I am a beginner and I'm not sure what I'm doing yet, I'm learning to code in my spare time) and I will let you know if I there is any progress, and if I manage to have access to other entities.

This is what the app on mobile looks like:

App

This is the diagnostic:

 {
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.6.7",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.9.12",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/London",
    "os_name": "Linux",
    "os_version": "5.15.45",
    "supervisor": "2022.05.3",
    "host_os": "Home Assistant OS 8.2",
    "docker_version": "20.10.14",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "damda_awair": {
      "version": "1.2.6",
      "requirements": []
    },
    "vesync": {
      "version": "0.1.3",
      "requirements": []
    },
    "yi_hack": {
      "version": "0.3.9",
      "requirements": []
    },
    "webrtc": {
      "version": "v2.3.0",
      "requirements": []
    },
    "hacs": {
      "version": "1.25.5",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    }
  },
  "integration_manifest": {
    "domain": "vesync",
    "name": "VeSync",
    "documentation": "https://www.home-assistant.io/integrations/vesync",
    "codeowners": [
      "@markperdue",
      "@webdjoe",
      "@thegardenmonkey",
      "@vlebourl"
    ],
    "config_flow": true,
    "iot_class": "cloud_polling",
    "version": "0.1.3",
    "issue_tracker": "https://github.com/vlebourl/custom_vesync",
    "dhcp": [
      {
        "hostname": "levoit-*",
        "macaddress": "*"
      }
    ],
    "is_built_in": false
  },
  "data": {
    "fans": [
      {
        "config_dict": {
          "module": "VeSyncAirBypass",
          "models": [
            "Core300S",
            "LAP-C301S-WJP"
          ],
          "modes": [
            "sleep",
            "off",
            "auto"
          ],
          "features": [
            "air_quality"
          ],
          "levels": [
            1,
            2,
            3,
            4
          ]
        },
        "config": {
          "display": true,
          "display_forever": true
        },
        "details": {
          "filter_life": 99,
          "mode": "manual",
          "level": 0,
          "display": true,
          "child_lock": false,
          "night_light": "off",
          "air_quality": 1,
          "display_forever": false,
          "air_quality_value": 1
        }
      }
    ],
    "outlets": [],
    "switches": [],
    "bulbs": []
  }
}

It's strange, looking at the diagnostics it's like all the other entities are there, but I don't seem to make them work in HA.

I will do some more testing and let you know what happens. Thanks

vlebourl commented 2 years ago

Hey, thank you for the details. However debugging without access to the device is quite tough... Would you be willing to share access to your device for the time of the dev? If so, can you add vlebourl@gmail.com ? Thanks

V.

acinc0 commented 2 years ago

Hey, Yeah, no problem. I think I cannot share the device with you because you don't have the last version of the vesync app. Let me know when you update the app and I will send you an invite. Thanks

vlebourl commented 2 years ago

damn... no update available here... latest version on my playstore is 14th june version

acinc0 commented 2 years ago

That's strange, I have the same version from the 14th of June. This is what happens when I try to add you:

Screenshot

It might be a bug, I will send an email to the customer service and I will come back to you when they reply. Thanks

acinc0 commented 2 years ago

Hey, I finally managed to invite you. Thanks, Andrea

vlebourl commented 2 years ago

Hey, sorry I haven't had much time to play around with your device... I started this morning and got the display light switch in. I'll have a look later at the rest of the missing entities.

vlebourl commented 2 years ago

Regarding modes, I beleive it's already part of it although there is no clean way to display it I know, but that isn't part of the integration, but rather the UI.

image image

vlebourl commented 2 years ago

regarding air quality, how do you like this? image

vlebourl commented 2 years ago

Closed by #33.

acinc0 commented 2 years ago

Hey,

Thank you so much for doing this, it's perfect now. The air quality monitor looks very good.

I wish I could have helped more. Please let me know if there's any way I can help. You can keep using the device if you need it for testing/debug.

Thanks

vlebourl commented 2 years ago

Thanks, but I don't need it for now. I'll ask again if required. Cheers