benct / lovelace-xiaomi-vacuum-card

Simple card for various robot vacuums in Home Assistant's Lovelace UI
MIT License
264 stars 37 forks source link

Support for Kyvol vacuum now that Tuya IoT platform supports it? #82

Open gnosis3825 opened 3 years ago

gnosis3825 commented 3 years ago

New at submitting requests, please bear with me. I feel like this is so close to working already, but I'm missing something. Here are logs from HA relative to the vacuum:

Device is identified as vacuum in Smart Life and the info does successfully pass to the IoT platform and back to HA (as seen below). I just don't know how to "pick up" those values in the card.

Device normal info

{
"active_time": 1631897881,
"biz_type": 18,
"category": "sd",
"create_time": 1631734146,
"icon": "smart/icon/ay1552647039402ueTid/9999d419105e4eba3801025aa15fbd93.png",
"id": "ebd764e768104117degnv8",
"ip": "***",
"lat": "***",
"local_key": "***",
"lon": "***",
"model": "F9370",
"name": "Kynado",
"online": true,
"owner_id": "36426771",
"product_id": "modhla03lopnmad8",
"product_name": "E31",
"status": [
{
"code": "power",
"value": true
},
{
"code": "power_go",
"value": false
},
{
"code": "mode",
"value": "chargego"
},
{
"code": "direction_control",
"value": "stop"
},
{
"code": "status",
"value": "Charge_Comp"
},
{
"code": "electricity_left",
"value": 100
},
{
"code": "edge_brush",
"value": 44
},
{
"code": "roll_brush",
"value": 72
},
{
"code": "reset_edge_brush",
"value": false
},
{
"code": "reset_roll_brush",
"value": false
},
{
"code": "reset_filter",
"value": false
},
{
"code": "seek",
"value": false
},
{
"code": "suction",
"value": "3"
},
{
"code": "clean_record",
"value": "20210921075200501100204"
},
{
"code": "clean_area",
"value": 113
}

Device specifications (please complete the following information, which can be found in log):

2021-09-23 06:31:51 DEBUG (SyncWorker_3) [tuya iot] Request: method = GET, url = https://openapi.tuyaus.com/v1.0/devices/ebd764e768104117degnv8/specifications, params = None, body = None, t = 1632396711357
2021-09-23 06:31:51 DEBUG (Thread-4) [tuya iot] _on_log: Received SUBACK
2021-09-23 06:31:51 DEBUG (Thread-4) [tuya iot] _on_subscribe: 1
2021-09-23 06:31:51 DEBUG (SyncWorker_3) [tuya iot] Response: {
"result": {
"category": "sd",
"functions": [
{
"code": "power",
"type": "Boolean",
"values": "{}"
},
{
"code": "power_go",
"type": "Boolean",
"values": "{}"
},
{
"code": "direction_control",
"type": "Enum",
"values": "{\"range\":[\"forward\",\"backward\",\"turn_left\",\"turn_right\",\"stop\"]}"
},
{
"code": "reset_edge_brush",
"type": "Boolean",
"values": "{}"
},
{
"code": "reset_roll_brush",
"type": "Boolean",
"values": "{}"
},
{
"code": "reset_filter",
"type": "Boolean",
"values": "{}"
},
{
"code": "seek",
"type": "Boolean",
"values": "{}"
},
{
"code": "suction",
"type": "Enum",
"values": "{\"range\":[\"0\",\"1\",\"2\",\"3\",\"4\"]}"
},
{
"code": "mode",
"type": "Enum",
"values": "{\"range\":[\"standby\",\"random\",\"smart\",\"wall_follow\",\"mop\",\"spiral\",\"sroom\",\"partial_bow\",\"chargego\"]}"
}
],
"status": [
{
"code": "mode",
"type": "Enum",
"values": "{\"range\":[\"standby\",\"random\",\"smart\",\"wall_follow\",\"mop\",\"spiral\",\"sroom\",\"partial_bow\",\"chargego\"]}"
},
{
"code": "power",
"type": "Boolean",
"values": "{}"
},
{
"code": "power_go",
"type": "Boolean",
"values": "{}"
},
{
"code": "direction_control",
"type": "Enum",
"values": "{\"range\":[\"forward\",\"backward\",\"turn_left\",\"turn_right\",\"stop\"]}"
},
{
"code": "status",
"type": "Enum",
"values": "{\"range\":[\"Sleep\",\"Standby\",\"Cleaning\",\"Cleaning_Auto\",\"Cleaning_Random\",\"Cleaning_Sroom\",\"Cleaning_Edge\",\"Cleaning_Spot\",\"Clean_Comp\",\"Docking\",\"Charging_Base\",\"Charging_DC\",\"Charge_Comp\",\"Fault\"]}"
},
{
"code": "electricity_left",
"type": "Integer",
"values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}"
},
{
"code": "edge_brush",
"type": "Integer",
"values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}"
},
{
"code": "roll_brush",
"type": "Integer",
"values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}"
},
{
"code": "reset_edge_brush",
"type": "Boolean",
"values": "{}"
},
{
"code": "reset_roll_brush",
"type": "Boolean",
"values": "{}"
},
{
"code": "reset_filter",
"type": "Boolean",
"values": "{}"
},
{
"code": "seek",
"type": "Boolean",
"values": "{}"
},
{
"code": "clean_record",
"type": "String",
"values": "{\"maxlen\":255}"
},
{
"code": "suction",
"type": "Enum",
"values": "{\"range\":[\"0\",\"1\",\"2\",\"3\",\"4\"]}"
},
{
"code": "clean_area",
"type": "Integer",
"values": "{\"unit\":\"掔\",\"min\":0,\"max\":9999,\"scale\":0,\"step\":1}"
}

Here is what I tried to add to your card, but it's not picking any of this up. This is where my knowledge ends :-( I'm not a coder.

    const vendors = {
        kyvol: {
            state: {
                fan_speed: {key: 'suction'}
            },
            attributes: {
                main_brush: {key: 'roll_brush'},
                side_brush: {key: 'edge_brush'},
                fan_speed: {key: 'suction'},
            },
            buttons: {
                start: {service: 'vacuum.power_go'},
                pause: {service: 'vacuum.stop'},
                return: {service: 'vacuum.return_to_base'},
            },

Here is what my card config looks like:

type: custom:xiaomi-vacuum-card
entity: vacuum.ebd764e768104117degnv8
vendor: kyvol
name: Kynado
attributes:
  roll_brush:
    key: roll_brush
    label: 'Roll Brush: '
    unit: percentage
  edge_brush:
    key: edge_brush
    label: 'Edge Brush: '
    unit: percentage
  clean_area:
    key: clean_area
    label: 'Cleaned Area: '
    unit: m2
  main_brush: false
  side_brush: false
  filter: false
  sensor: false
buttons:
  locate: false
  stop: false

I'm not sure how much of that is really needed. Interestingly, Battery Life reports properly, Start and Return to Base work, but not stop, but Status, Fan Speed and all Attributes are "Unavailable" (as they were before I started doing "custom stuff" in the card YAML.

Happy to help in any way I can.

benct commented 3 years ago

I have no idea what Kyvol or Tuya is, so I'm not sure if I can support it easily. Do you have a vacuum entity in your HA system? If you look for vacuum under <your-HA-url>/developer-tools/state, could you copy the state and attributes and paste them here.

gnosis3825 commented 3 years ago

Hi Ben, thanks for the note but Iā€™m no longer using the device. I got a Roborock which just works. (Both in HA (via Mi) and at picking up dog hair šŸ˜€)

On Sat, Nov 6, 2021 at 9:29 PM, Ben Tomlin @.***> wrote:

I have no idea what Kyvol or Tuya is, so I'm not sure if I can support it easily. Do you have a vacuum entity in your HA system? If you look for vacuum under /developer-tools/state, could you copy the state and attributes and paste them here.

ā€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.