apexad / eufy-robovac

NodeJS library to control Eufy RoboVac
MIT License
59 stars 17 forks source link

Sort enums to match internally used indices #22

Closed kueblc closed 3 years ago

kueblc commented 3 years ago

Reordered enums based on order found in firmware. No functional changes.

I found this repo and used it as a reference while building an alternative firmware for my Eufy Robovac, but found that the enums didn't quite line up with the expected behavior/state.

Feel free to decline these changes, just thought I might offer it for others who are doing similar things.

kueblc commented 3 years ago

In case you're curious, here is the actual schema for the device:

[ { mode: 'rw', property: { type: 'bool' }, id: 1, type: 'obj' },
  { mode: 'rw', property: { type: 'bool' }, id: 2, type: 'obj' },
  { mode: 'rw',
    property:
     { range: [ 'forward', 'back', 'left', 'right' ], type: 'enum' },
    id: 3,
    type: 'obj' },
  { mode: 'rw',
    property:
     { range: [ 'auto', 'SmallRoom', 'Spot', 'Edge', 'Nosweep' ],
       type: 'enum' },
    id: 5,
    type: 'obj' },
  { mode: 'ro',
    property:
     { range:
        [ 'Running',
          'standby',
          'Sleeping',
          'Charging',
          'completed',
          'Recharge' ],
       type: 'enum' },
    id: 15,
    type: 'obj' },
  { mode: 'rw', property: { type: 'bool' }, id: 101, type: 'obj' },
  { mode: 'rw',
    property:
     { range: [ 'Standard', 'Boost_IQ', 'Max', 'No_suction' ],
       type: 'enum' },
    id: 102,
    type: 'obj' },
  { mode: 'rw', property: { type: 'bool' }, id: 103, type: 'obj' },
  { mode: 'ro',
    property: { min: 0, max: 100, scale: 0, step: 1, type: 'value' },
    id: 104,
    type: 'obj' },
  { mode: 'ro',
    property:
     { range:
        [ 'no_error',
          'Stuck_5_min',
          'Crash_bar_stuck',
          'sensor_dirty',
          'N_enough_pow',
          'Wheel_stuck',
          'S_brush_stuck',
          'Fan_stuck',
          'R_brush_stuck' ],
       type: 'enum' },
    id: 106,
    type: 'obj' } ]
apexad commented 3 years ago

Thanks!