Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iHome AutoVac Nova #1660

Closed
backcountrymountains opened this issue Feb 15, 2024 · 0 comments
Closed

iHome AutoVac Nova #1660

backcountrymountains opened this issue Feb 15, 2024 · 0 comments

Comments

@backcountrymountains
Copy link

Through much suffering I have made this device work. It doesn't report many DPs using tinytuya or tuya-local but it is functional.

The main problem I have is that it reports location and status as a base64 encoded json on DP 102. I don't think tuya-local can decode the base64 and then format the json to extract the information as a sensor. Right now I'm only able to get the base64 encoded string, and HA doesn't like it because sometimes it's too long for a sensor value.

Upstairs Vacuum received {"102": "eyJkYXRhIjp7InBhdGhJRCI6MTcwODAyMzQyNiwicG9pbnRDb3VudHMiOjgsInBvc0FycmF5IjpbWy0xOTExLC0xMzExXSxbLTE5NDcsLTEzMzFdLFstMTk5NSwtMTMzOV0sWy0yMDQ3LC0xMzM5XSxbLTIwOTksLTEzMzFdLFstMjE0MywtMTMxOV0sWy0yMTg3LC0xMzA3XSxbLTIyMjMsLTEyOTFdXSwic3RhcnRQb3MiOjk5LCJ0b3RhbFBvaW50cyI6MTA3fSwiaW5mb1R5cGUiOjIxMDExLCJtZXNzYWdlIjoib2siLCJ0cyI6MTcwODAyMzUwMn0=", "full_poll": false}

Decodes to:

{"data":{"pathID":1708023426,"pointCounts":8,"posArray":[[-1911,-1311],[-1947,-1331],[-1995,-1339],[-2047,-1339],[-2099,-1331],[-2143,-1319],[-2187,-1307],[-2223,-1291]],"startPos":99,"totalPoints":107},"infoType":21011,"message":"ok","ts":1708023502}

But HA doesn't like it:

2024-02-15 11:58:22.621 ERROR (MainThread) [homeassistant.helpers.entity] Failed to set state for sensor.upstairs_vacuum_json, fall back to unknown
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 872, in _async_write_ha_state
    hass.states.async_set(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1732, in async_set
    state = State(
            ^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1309, in __init__
    validate_state(state)
  File "/usr/src/homeassistant/homeassistant/core.py", line 193, in validate_state
    raise InvalidStateError(
homeassistant.exceptions.InvalidStateError: Invalid state with length 336. State max length is 255 characters.

DP 102 sometimes has information that I'm interested in, like battery level and runtime:
Sample decoded string:
{"data":{"cleanArea":11,"cleanTime":570,"elec":82,"elecReal":82,"mode":"sweep","subMode":"smart","timeStamp":1708024009},"infoType":20001}

But I don't know how to get this data out. It seems pretty unique for a tuya device to operate in this manner, given that there are designated DPs that should be used for this information.

Anyway, if you feel like adding base64-->json-->sensor mapping functionality to tuya-local, I would super appreciate it!

Here is the info for the device and my config:

2024-02-15 08:29:48.004 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2024-02-15 08:29:52.873 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches None with quality of 0%. DPS: {"updated_at": 1708010988.0687084, "5": "charge_done", "110": 0}
2024-02-15 08:29:52.873 WARNING (MainThread) [custom_components.tuya_local.config_flow] Report this to https://github.com/make-all/tuya-local/issues/

Information about DPS mappings

Sending to DP 1,2 will start the vacuum but is not ever reported locally
DP 3 does all the controlling of the vacuum
DP 5 reports the status
DP 6, battery, doesn't work locally or in the cloud
DP 13, locate, will make the device beep
DP id 14, fan speed, doesn't do anything with the fan, even using the tuya cloud or the tuya smart app.
DP 101, no info
DP 102 is a base64 encoded json report of the device location or device stats:
  {"data":{"phi":-3095,"pos":[3205,366]},"infoType":20001}
  {"data":{"cleanArea":11,"cleanTime":575,"elec":82,"elecReal":82,"mode":"sweep","subMode":"smart","timeStamp":1708024010},"infoType":20001}'

"model": "{modelId:000002k03h,services:[{actions:[],code:,description\ ":,events:[],name:Default service,properties:[{

DP 103 to 105 appear to be unused
DP 107-109 appear to be cloud only
DP 110 and 111 are indecipherable numbers that indicate some sort of status or error
  once I got: "The main brush is stuck" for {'dps': {'3': 'smart', '5': 'paused', '110': -2401}}

Tuya "Query Things Data Model":

DpId:1,
"power,description:[optional], \\ Optional no power on/off function. , On/off control. , Send: Send control instructions to the host, and the host performs power on and off operations according to the instruction status. , Reporting: , When the host uses the remote control to shut down or enters the shutdown state after being stationary for a long time, the host will report a shutdown data. , When the host is in the off state, through the remote control or touching the buttons on the host, the host will enter the power on state, and the host will report a power on data. \\, ,extensions:{iconName:icon-dp_power2},name:switch,typeSpec: {type:bool,typeDefaultValue:false}},{

DpId:2,
"switch_go,description:[Required],extensions :{iconName:icon-dp_power,attribute:544},name:Cleaning switch,typeSpec: {type:bool,typeDefaultValue:false}},{

DpId:3, \"accessMode\":\"rw\",\"code\":\"mode\",\"description\":\"[Required] Enumeration value on demand choose
"mode,description:[Required] Select the enumeration value as needed , you can delete those you don’t need, 
 standby: standby mode,
 random: random mode,
 smart: automatic cleaning,
 wall_follow: cleaning along the edge,
 mop: mopping function,
 spiral: fixed-point cleaning,
 left_spiral: left spiral,
 right_spiral: right spiral,
 right_bow : right bow character,
 left_bow: left bow character,
 partial_bow: partial bow character,
 chargego: recharge mode,
 ,extensions:{iconName:icon-dp_mode },name:Working Mode,typeSpec:{range:[standby,random,smart,wall_follow ,mop,spiral,left_spiral,right_spiral,right_bow,left_bow,partial_bow,chargego ],type:enum,typeDefaultValue:standby}},{

DpId:5,accessMode:ro,code:status,description:[Required], Status indication\ \n
 standby Standby,
 smart_clean Automatic cleaning,
 wall_clean Cleaning along the wall,
 spot_clean Fixed-point cleaning,
 mop_clean Mopping and cleaning,
 goto_charge Returning to seat,
 charging Charging,
 charge_done Charging completed,
 paused Paused ,
 cleaning cleaning,
 sleep sleeping,
,extensions:{iconName:icon-dp_dust,attribute:576},\ "name:working status,typeSpec:{range:[standby,smart_clean,wall_clean,spot_clean, mop_clean,goto_charge,charging,charge_done,paused,cleaning,sleep],type:\ "enum,typeDefaultValue:standby}},{

DpId:6,accessMode:ro,code:battery_percentage,description:[Optional] The default interval is 0% —100% (no decimal point). If you need to display it as a decimal point, you can modify the multiple parameter. For example, if you need to support one decimal point, the multiple parameter is 1. The reported value will be calculated and retained with one decimal place. For example, 589 will be reported and converted. After that it was 58.9%.,extensions:{attribute:1090},name:Remaining power,typeSpec:{ max:100,min:0,scale:0,step:1,type:value,typeDefaultValue:0, unit:%}},{

DpId:13,
"seek,description:[optional],  ,extensions:{iconName:icon-dp_curve},name:Find machine,typeSpec:{type:\ "bool,typeDefaultValue:false}},{

DpId:14,
"suction,description:[optional] default value (can be modified , delete, add):, 
	strong strong wind suction, 
	normal medium suction, 
	gentle weak wind suction, 
,extensions:{iconName:icon-Strong,\ "attribute:1056},name:Suction selection,typeSpec:{range:[gentle,normal ,strong],type:enum,typeDefaultValue:gentle}},{

DpId:101,
"Str,description:,name:\ "Character transmission,typeSpec:{maxlen:255,type:string,typeDefaultValue:}},{

DpId:102,
"rawData,description:,name:\ "Transparent transmission,typeSpec:{maxlen:128,type:raw}},{
**This comes through as base64 encoded strings: {"data":{"cleanArea":48,"cleanTime":3206,"elec":89,"elecReal":89,"mode":"charge","subMode":"null","timeStamp":1707937520},"infoType":20001}**


DpId:103,accessMode:ro,code:yuliu1,description:Reserved 1,name\ ":Reserved,typeSpec:{max:100000,min:1,scale:1,step:1, type:value,typeDefaultValue:1,unit:}},{

DpId:104,accessMode:ro,code:yuliu2,description:reserved,name :Reserved,typeSpec:{max:100000,min:1,scale:1,step:1,type :value,typeDefaultValue:1,unit:}},{

DpId:105,accessMode:ro,code:yuliu3,description:reserved,name :Reserved,typeSpec:{max:100000,min:1,scale:1,step:1,type :value,typeDefaultValue:1,unit:}},{

DpId:106,accessMode:ro,code:SN,description:,name:\ "Device serial number,typeSpec:{maxlen:128,type:raw}},{

DpId:107,accessMode:ro,code:TotalCleanHistory,description:,name:\ "Cleaning total statistics,typeSpec:{maxlen:128,type:raw}},{
**cloud-only logs: {"data":{"counts":10,"mopArea":0,"sweepArea":503,"time":30815},"infoType":21009}**

DpId:108,accessMode:ro,code:UUID,description:,name:\ "Host SN,typeSpec:{maxlen:128,type:raw}},{

DpId:109,accessMode:ro,code:device_id,description:device virtual id,name\ ":virtual id,typeSpec:{maxlen:128,type:raw}},{

DpId:110,accessMode:ro,code:error_report,description:Used LeDong error code number ,name:Error prompt,typeSpec:{max:1000000,min:-1000000,scale:0,step\ ":1,type:value,typeDefaultValue:-1000000,unit:}},{

DpId:111,accessMode:ro,code:event_report,description:乐动的Message code, name:Message prompt,typeSpec:{max:1000000,min:-1000000,scale:0,step:1 ,type:value,typeDefaultValue:-1000000,unit:}}]}]}"
   },

Product ID


      "model": "IHRV6-BLK",
      "name": "Nova (iHRV6) 2",
      "product_id": "gejo2t2mgux3avdq",
      "product_name": "Nova (iHRV6)",

My config:

name: iHome AutoVac Nova Vacuum
primary_entity:
  entity: vacuum
  dps:
    - id: 1
      type: boolean
      name: power
      optional: true
      
    - id: 2
      type: boolean
      name: activate
      optional: true
      
    - id: 3
      type: string
      name: command
      mapping:
        - dps_val: standby
          value: standby
        - dps_val: random
          value: random
        - dps_val: smart
          value: smart
        - dps_val: wall_follow
          value: wall_follow
        - dps_val: mop
          value: mop
        - dps_val: spiral
          value: clean_spot
        - dps_val: left_spiral
          value: left_spiral
        - dps_val: right_spiral
          value: right_spiral
        - dps_val: bow
          value: bow
        - dps_val: left_bow
          value: left_bow
        - dps_val: right_bow
          value: right_bow
        - dps_val: partial_bow
          value: partial_bow
        - dps_val: chargego
          value: return_to_base
          
    - id: 5
      type: string
      name: status
      mapping:
        - dps_val: standby
          value: standby
        - dps_val: smart_clean
          value: automatic_cleaning
        - dps_val: wall_clean
          value: cleaning_along_the_wall
        - dps_val: spot_clean
          value: fixed-point_cleaning
        - dps_val: mop_clean
          value: mopping_and_cleaning
        - dps_val: goto_charge
          value: returning_to_seat
        - dps_val: charging
          value: charging
        - dps_val: charge_done
          value: charging_completed
        - dps_val: paused
          value: paused
        - dps_val: cleaning
          value: cleaning
        - dps_val: sleep
          value: sleeping
          
    - id: 13
      type: boolean
      name: locate
      optional: true
          
    - id: 102
      type: base64
      name: sensor
      optional: true
          
    - id: 110
      type: integer
      name: error
          
    - id: 111
      type: integer
      name: event_report
      optional: true
      
secondary_entities:
        
  - entity: select
    name: mode
    category: config
    dps:
      - id: 3
        type: string
        name: option
        mapping:
          - dps_val: standby
            value: standby
          - dps_val: random
            value: random
          - dps_val: smart
            value: smart
          - dps_val: wall_follow
            value: wall_follow
          - dps_val: mop
            value: mop
          - dps_val: spiral
            value: clean_spot
          - dps_val: chargego
            value: return_to_base
            
  - entity: select
    name: spiral
    category: config
    dps:
      - id: 3
        type: string
        name: option
        mapping:
          - dps_val: left_spiral
            value: left_spiral
          - dps_val: right_spiral
            value: right_spiral
          - dps_val: bow
            value: bow
          - dps_val: left_bow
            value: left_bow
          - dps_val: right_bow
            value: right_bow
          - dps_val: partial_bow
            value: partial_bow
        
  - entity: select
    name: fan_speed
    category: config
    icon: "mdi:fan"
    optional: true
    dps:            
      - id: 14
        type: string
        name: option
        optional: true
        mapping:
          - dps_val: strong
            value: strong
          - dps_val: normal
            value: normal
          - dps_val: gentle
            value: gentle
            
  - entity: sensor
    name: json
    category: diagnostic
    icon: "mdi:robot-vacuum"
    optional: true
    dps:
      - id: 102
        type: base64
        name: sensor
        optional: true
            
@backcountrymountains backcountrymountains added the new device Unsupported device label Feb 15, 2024
@make-all make-all added full_info All info needed was provided config provided Config included by reporter labels Feb 15, 2024
@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release and removed config provided Config included by reporter full_info All info needed was provided labels Mar 10, 2024
@make-all make-all removed new device Unsupported device awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release labels Mar 27, 2024
timlaing pushed a commit to timlaing/tuya-local that referenced this issue Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants