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

Ecovacs #1712

Closed
wants to merge 157 commits into from
Closed

Ecovacs #1712

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
5c45801
add ecovacs service
Jul 25, 2022
2beb63d
package-lock.json redone after npm change
Jul 25, 2022
4d0c6aa
Merge branch 'master' into ecovacs
Jul 28, 2022
5c12878
Init Ecovacs service
Aug 2, 2022
d38c4cf
V1 Ecovacs => discover vacbot, add them to Gladys, run / stop cleaning
Sep 19, 2022
66bb4a8
merge 4.10.1
Sep 19, 2022
22f015d
WIP: get battery info
Oct 2, 2022
1021387
Merge remote-tracking branch 'upstream/master' into ecovacs
Oct 18, 2022
ac347b9
vacbot translations
Oct 31, 2022
f91177c
vacbot translations
Oct 31, 2022
4e2d365
Merge remote-tracking branch 'upstream/master' into ecovacs
Nov 17, 2022
9d60aaf
Plugin version handling vacbot function : clean, pause, stop ... with…
Nov 17, 2022
4ff0c8d
merge 4.12.2
Nov 17, 2022
a916f6b
Fixes : password handling, save / get configuration method usage, UI …
Nov 19, 2022
fe86209
Merge remote-tracking branch 'upstream/master' into ecovacs
Nov 22, 2022
87767f5
merge 4.13.0
Dec 11, 2022
b963af5
ecovacs package 0.9
Dec 11, 2022
7b4c4ac
Merge remote-tracking branch 'upstream/master' into ecovacs
Dec 12, 2022
7419e65
merge from ecovacs dev branch
Dec 20, 2022
5cb6a84
Vacuum dashboard box & poll battery
Jan 16, 2023
6c4f780
Merge remote-tracking branch 'upstream/master' into ecovacs
Jan 16, 2023
6ab88bd
Merge remote-tracking branch 'upstream/master' into ecovacs
Jan 25, 2023
bd4f356
last merge 4.12. ???
Jan 25, 2023
09df301
typo
Jan 25, 2023
a77d850
WIP: listen to all registered vacbot
Feb 12, 2023
fa5d581
4.16 merge
Feb 12, 2023
ddef7d7
Correct double from merge
ngeissel Feb 22, 2023
af4f522
Merge remote-tracking branch 'upstream/master' into ecovacs
ngeissel Feb 22, 2023
cb6a8b2
correct english translation
ngeissel Feb 22, 2023
7d393e8
Rationalise code using a common method to get VabotObj + add a way to…
ngeissel Feb 25, 2023
3e81433
Load vacbots object into controller when registered in gladys + test
Feb 26, 2023
baedc9f
Handle events on vacbots
Mar 6, 2023
caf3096
Vacbot box : get image and name of vacuum
Mar 8, 2023
2b27909
Correct start test and loadVacbots test
ngeissel Mar 9, 2023
1da9b3b
Fix discover test with new battery feature
ngeissel Mar 9, 2023
a2f8d44
test poll and listen
Mar 11, 2023
6892366
Add return charge to stop commande + get more information about vacbo…
Mar 13, 2023
fb09b96
Reload vacbots object after adding a new device
Mar 14, 2023
ad66cd5
cleaning up dead code
Mar 14, 2023
430a64b
Display in error logs, errors like : device is power off
Mar 14, 2023
5ebe8b6
[WIP] Vacbot box update infos
Mar 15, 2023
bff5f2c
Retrieve vacbot infos
Mar 16, 2023
9f3d324
merge 4.17.1
Mar 20, 2023
86e6ef5
getStatus test from a vacbot mock obj
ngeissel Mar 21, 2023
014fce5
getStatus test from a vacbot mock obj
ngeissel Mar 21, 2023
4448752
Test vacbot poll : check what is run
ngeissel Mar 21, 2023
55e3b24
Test if charge is run when stopped + reuse fakes instead of VacbotMock
ngeissel Mar 21, 2023
8b142d0
Improve listen test coverage
Mar 21, 2023
12d55c6
Improve listen test coverage
Mar 21, 2023
b16cc59
Improve controller test coverage
Mar 21, 2023
3a0caa9
Improve controller test coverage
Mar 21, 2023
5be0f2d
Improve connect test coverage
Mar 21, 2023
c026324
Improve load test coverage by removing tracez
Mar 21, 2023
a43f0d2
Improve saveConfiguration test coverage
Mar 22, 2023
3c997ce
Improve discover test coverage
Mar 22, 2023
8960c7e
Add onMessage test
Mar 22, 2023
01d51cc
Eslint stuff
Mar 26, 2023
e613a36
prettier
Mar 26, 2023
5abda50
This vacbot box begins to have style
Mar 26, 2023
f056f9e
improve demo
Mar 28, 2023
a6c8d70
improve demo.js and vacbot card
ngeissel Mar 29, 2023
2ea17ee
Improve Vacbot box
Mar 29, 2023
9646022
Update Vacbot box template
Apr 3, 2023
b5288f4
Merge with 4.20.0
Apr 14, 2023
c6156e8
correct merge typo
Apr 15, 2023
fa778eb
Correct merge typo
Apr 15, 2023
d4a7ce5
merge 4.20.0
Apr 17, 2023
8bfe006
Vacbot menu & background image
Apr 18, 2023
141fa27
template clean up
ngeissel Apr 19, 2023
28766b8
Merge remote-tracking branch 'upstream/master' into ecovacs-poll
Apr 28, 2023
2bd7a7c
Update version of ecovacs-deebot lib
Apr 28, 2023
013eeb5
Add batterylevel in status test
Apr 28, 2023
fa849ed
merge v4.23.2
May 16, 2023
222ba4b
Create and use a VacbotModeDeviceFeature in place of hacking another one
May 17, 2023
d05f3d6
Repair test with new state charge
May 21, 2023
7b8ace0
Respect eslint rulez
May 21, 2023
f420b45
Handle battery level. Handle Clean, stop, pause, charge command with …
May 21, 2023
edd46d7
Modification related to prettier / eslint / compare-translations
May 22, 2023
b0c4e71
Modification related to prettier / eslint / compare-translations
May 22, 2023
90e8cc5
Merge v4.23.4
May 22, 2023
d3ff42d
WIP : implementing VacbotModeDeviceFeature into a Vacbot global box
May 30, 2023
7a6eb88
Merge remote-tracking branch 'upstream/master' into ecovacs
May 30, 2023
a03d36e
more log
Jun 18, 2023
7fc8914
Merge v4.25.0
Jun 18, 2023
a4fb7c0
Merge from gladys 4.26.0
Jul 28, 2023
469ea4a
update from gladys master
Jul 28, 2023
344c59a
Merge v4.26.1
Aug 25, 2023
7fed25f
Merge 4.27-2
Sep 1, 2023
085fe5f
Change @connect for connect()
Sep 1, 2023
3714ee8
Change @connect for connect()
Sep 1, 2023
bae1b51
Vacbot box v1.0 : command, status, battery and automatic model image
Sep 1, 2023
50e1e24
Vacbot box v1.0 : command, status, battery and automatic model image
Sep 1, 2023
d6521bb
Add Vacbot box : a complete box to manage a vacbot + merge 4.27.2
Sep 1, 2023
cc655ab
prettier
Sep 1, 2023
4ca44b2
eslint correction
Sep 1, 2023
26cab5d
prettier
Sep 1, 2023
947c7c0
merge gladys v4.28.0
Sep 13, 2023
34ba0af
Merge remote-tracking branch 'upstream/master' into ecovacs
Sep 30, 2023
ad13667
update from master
ngeissel Oct 21, 2023
7bf0488
Add some documentation ...
ngeissel Oct 23, 2023
0fa4419
Refresh vacabot data on setValue event + fix box title display
ngeissel Oct 23, 2023
30592b2
Merge remote-tracking branch 'upstream/master' into ecovacs
ngeissel Oct 23, 2023
209cdf5
Display improved
ngeissel Oct 23, 2023
f2b4eeb
prettier
ngeissel Oct 24, 2023
7db0834
Merge gladys 4.28.0
ngeissel Nov 2, 2023
2d81da2
Merge from Gladys dev master
ngeissel Nov 13, 2023
447dee3
Add errors and todos ...
ngeissel Nov 19, 2023
2f41977
switch on errorCodes
ngeissel Nov 20, 2023
2a508b2
Better logs when event is not handled
ngeissel Nov 20, 2023
ea42bf5
Unsubscribe when service stops
ngeissel Nov 20, 2023
fc7db4f
Merge Gladys v4.31.0
ngeissel Nov 20, 2023
7c7d1e7
Merge Gladys v4.31.0
ngeissel Nov 22, 2023
ca8f607
Update from gladys master
ngeissel Nov 26, 2023
b8ea662
check if vacbot is online
ngeissel Nov 29, 2023
eac5ff4
test on vacbot is_ready & disconnect if vacbot is unreachable
ngeissel Nov 29, 2023
b1d68f1
test on 'clean report' poll
ngeissel Nov 29, 2023
5a619b3
merge from gladys master
ngeissel Nov 29, 2023
531f4ef
eslint & prettier
ngeissel Nov 29, 2023
d0e8f0f
merge v4.33.0
ngeissel Dec 18, 2023
3ee0007
merge v4.33.0
ngeissel Dec 18, 2023
72f1f65
Do not poll when service is stopped
ngeissel Dec 30, 2023
7062cf3
Complete vacbot obj mock
ngeissel Dec 30, 2023
2cd3498
Complete stop test case
ngeissel Dec 30, 2023
5a8e8a8
Add no value in config test
ngeissel Dec 30, 2023
335b3d7
Remove useless log, run prettier and eslint
ngeissel Dec 30, 2023
661b216
Merge branch 'ecovacs-1.1' into ecovacs
ngeissel Dec 30, 2023
8fa3062
Clean log
ngeissel Dec 31, 2023
e33ac58
Improve tests
ngeissel Dec 31, 2023
6c768f6
Ecovacs v1.1
ngeissel Jan 1, 2024
51f9339
Merge Gladys 4.35.0
ngeissel Jan 31, 2024
ad17d57
remove unused translate keys
ngeissel Jan 31, 2024
4f9d3c1
Add DE Ecovacs translations
ngeissel Jan 31, 2024
64f6cac
Update demo with vacbot box
ngeissel Jan 31, 2024
8ee7b87
Prettier
ngeissel Jan 31, 2024
a7ca129
Merge Gladys 4.36.0
ngeissel Feb 6, 2024
b9358d1
merge gladys 4.36.0dev
ngeissel Feb 8, 2024
2a4738c
remove console.log statement
ngeissel Feb 8, 2024
89852ee
prettier
ngeissel Feb 8, 2024
5b32dc0
Eslint
ngeissel Feb 8, 2024
30a51e8
Remove comment
ngeissel Feb 13, 2024
957c191
Improve APIdoc
ngeissel Feb 13, 2024
403fa57
From 0.9.5 to 0.9.6-alpha.34 ecovacs lib
ngeissel Feb 13, 2024
5d1752d
Add a method to find the vacbot object in map using the device extern…
ngeissel Feb 13, 2024
81a36fa
Do not use connected attribute to say vacbot is disconnected, this at…
ngeissel Feb 13, 2024
faeb938
Rectoring vacbot discovering and creating devices in gladys
ngeissel Feb 14, 2024
92d9f60
Prettier + Eslint
ngeissel Feb 14, 2024
1a30e24
Minor refactoring
ngeissel Feb 18, 2024
e72452a
Add a Clean Report feature
ngeissel Feb 19, 2024
090846c
Test getVacbotObj
ngeissel Feb 19, 2024
ca51d6b
Reporting feature
ngeissel Feb 20, 2024
cbcd1ff
Merge from Gladys v4.37.0
ngeissel Feb 20, 2024
8e799ae
merge Gladys 4.38.1
ngeissel Apr 2, 2024
64014f7
Merge Gladys v4.38.3
ngeissel Apr 12, 2024
aba8411
Merge with Gladys 4.40.0
ngeissel May 12, 2024
337f067
Remove log.trace
ngeissel May 14, 2024
f55117f
Merge with Gladys 4.41.0
ngeissel May 14, 2024
44dede8
Merge with v4.42.0
ngeissel May 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions front/src/actions/dashboard/boxes/vacbot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { RequestStatus } from '../../../utils/consts';
import createBoxActions from '../boxActions';

const BOX_KEY = 'Vacbot';

function createActions(store) {
const boxActions = createBoxActions(store);

const actions = {
async getVacbotBoxDatas(state, box, x, y) {
boxActions.updateBoxStatus(state, BOX_KEY, x, y, RequestStatus.Getting);
try {
const status = await state.httpClient.get(`/api/v1/service/ecovacs/${box.device_feature}/status`);
// api/v1/device/:device_selector
const vacbotDevice = await state.httpClient.get(`/api/v1/device/${box.device_feature}`);
boxActions.mergeBoxData(state, BOX_KEY, x, y, {
vacbotStatus: status,
device: vacbotDevice,
status: RequestStatus.Success
});
boxActions.updateBoxStatus(state, BOX_KEY, x, y, RequestStatus.Success);
} catch (e) {
boxActions.mergeBoxData(state, BOX_KEY, x, y, {
vacbotStatus: null,
device: null,
status: RequestStatus.Error
});
boxActions.updateBoxStatus(state, BOX_KEY, x, y, RequestStatus.Error);
}
}
};

return Object.assign({}, actions);
}

export default createActions;
Binary file added front/src/assets/integrations/cover/ecovacs.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions front/src/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ import EweLinkEditPage from '../routes/integration/all/ewelink/edit-page';
import EweLinkDiscoverPage from '../routes/integration/all/ewelink/discover-page';
import EweLinkSetupPage from '../routes/integration/all/ewelink/setup-page';

// Ecovacs
import EcovacsPage from '../routes/integration/all/ecovacs/device-page';
import EcovacsDiscoverPage from '../routes/integration/all/ecovacs/discover-page';
import EcovacsSetupPage from '../routes/integration/all/ecovacs/setup-page';

// OpenAI integration
import OpenAIPage from '../routes/integration/all/openai/index';

Expand Down Expand Up @@ -281,6 +286,9 @@ const AppRouter = connect(
<EweLinkEditPage path="/dashboard/integration/device/ewelink/edit/:deviceSelector" />
<EweLinkDiscoverPage path="/dashboard/integration/device/ewelink/discover" />
<EweLinkSetupPage path="/dashboard/integration/device/ewelink/setup" />
<EcovacsPage path="/dashboard/integration/device/ecovacs" />
<EcovacsDiscoverPage path="/dashboard/integration/device/ecovacs/discover" />
<EcovacsSetupPage path="/dashboard/integration/device/ecovacs/setup" />
<HomeKitPage path="/dashboard/integration/communication/homekit" />
<OpenAIPage path="/dashboard/integration/communication/openai" />

Expand Down
2 changes: 2 additions & 0 deletions front/src/components/boxs/device-in-room/DeviceRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import NumberDeviceFeature from './device-features/NumberDeviceFeature';
import CoverDeviceFeature from './device-features/CoverDeviceFeature';
import ThermostatDeviceFeature from './device-features/ThermostatDeviceFeature';
import AirConditioningModeDeviceFeature from './device-features/AirConditioningModeDeviceFeature';
import VacbotModeDeviceFeature from './device-features/VacbotModeDeviceFeature';
import LMHVolumeDeviceFeature from './device-features/LMHVolumeDeviceFeature';

const ROW_TYPE_BY_FEATURE_TYPE = {
Expand All @@ -27,6 +28,7 @@ const ROW_TYPE_BY_FEATURE_TYPE = {
[DEVICE_FEATURE_TYPES.CURTAIN.STATE]: CoverDeviceFeature,
[DEVICE_FEATURE_TYPES.CURTAIN.POSITION]: MultiLevelDeviceFeature,
[DEVICE_FEATURE_TYPES.THERMOSTAT.TARGET_TEMPERATURE]: ThermostatDeviceFeature,
[DEVICE_FEATURE_TYPES.VACBOT.STATE]: VacbotModeDeviceFeature,
[DEVICE_FEATURE_TYPES.AIR_CONDITIONING.MODE]: AirConditioningModeDeviceFeature,
[DEVICE_FEATURE_TYPES.AIR_CONDITIONING.TARGET_TEMPERATURE]: ThermostatDeviceFeature,
[DEVICE_FEATURE_TYPES.SIREN.LMH_VOLUME]: LMHVolumeDeviceFeature,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const SUPPORTED_FEATURE_TYPES = [
DEVICE_FEATURE_TYPES.THERMOSTAT.TARGET_TEMPERATURE,
DEVICE_FEATURE_TYPES.AIR_CONDITIONING.MODE,
DEVICE_FEATURE_TYPES.AIR_CONDITIONING.TARGET_TEMPERATURE,
DEVICE_FEATURE_TYPES.VACBOT.STATE,
DEVICE_FEATURE_TYPES.SIREN.LMH_VOLUME,
DEVICE_FEATURE_TYPES.SIREN.MELODY,
DEVICE_FEATURE_TYPES.DURATION.DECIMAL
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import get from 'get-value';
import { Text, Localizer } from 'preact-i18n';
import cx from 'classnames';

import { getDeviceName } from '../../../../utils/device';
import { DeviceFeatureCategoriesIcon } from '../../../../utils/consts';
import { VACBOT_MODE } from '../../../../../../server/utils/constants';

const VacbotModeDeviceFeature = ({ children, ...props }) => {
const { device, deviceFeature } = props;
const { category, type, last_value: lastValue } = deviceFeature;

function updateValue(value) {
props.updateValueWithDebounce(deviceFeature, value);
}

function clean() {
updateValue(VACBOT_MODE.CLEAN);
}

function pause() {
updateValue(VACBOT_MODE.PAUSE);
}

function charge() {
updateValue(VACBOT_MODE.CHARGE);
}

function stop() {
updateValue(VACBOT_MODE.STOP);
}

return (
<tr>
<td>
<i class={`fe fe-${get(DeviceFeatureCategoriesIcon, `${category}.${type}`, { default: 'sliders' })}`} />
</td>
<td>{getDeviceName(device, deviceFeature)}</td>

<td class="py-0">
<div class="d-flex justify-content-end">
<div class="btn-group" role="group">
<Localizer>
<button
class={cx('btn btn-sm btn-secondary', 'fe', 'fe-play', {
active: lastValue === VACBOT_MODE.CLEAN
})}
onClick={clean}
title={<Text id={`deviceFeatureAction.category.${category}.${type}.clean`} />}
/>
</Localizer>
<Localizer>
<button
class={cx('btn btn-sm btn-secondary', 'fe', 'fe-pause', {
active: lastValue === VACBOT_MODE.PAUSE
})}
onClick={pause}
title={<Text id={`deviceFeatureAction.category.${category}.${type}.pause`} />}
/>
</Localizer>
<Localizer>
<button
class={cx('btn btn-sm', 'btn-secondary', 'fe', 'fe-square', {
active: lastValue === VACBOT_MODE.STOP
})}
onClick={stop}
title={<Text id={`deviceFeatureAction.category.${category}.${type}.stop`} />}
/>
</Localizer>
<Localizer>
<button
class={cx('btn btn-sm', 'btn-secondary', 'fe', 'fe-home', {
active: lastValue === VACBOT_MODE.CHARGE
})}
onClick={charge}
title={<Text id={`deviceFeatureAction.category.${category}.${type}.charge`} />}
/>
</Localizer>
</div>
</div>
</td>
</tr>
);
};

export default VacbotModeDeviceFeature;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const DISPLAY_BY_FEATURE_CATEGORY = {
[DEVICE_FEATURE_CATEGORIES.OPENING_SENSOR]: IconBinaryDeviceValue,
[DEVICE_FEATURE_CATEGORIES.SIGNAL]: SignalQualityDeviceValue,
[DEVICE_FEATURE_CATEGORIES.BUTTON]: ButtonClickDeviceValue,
[DEVICE_FEATURE_CATEGORIES.TEXT]: TextDeviceValue
[DEVICE_FEATURE_CATEGORIES.TEXT]: TextDeviceValue,
[DEVICE_FEATURE_CATEGORIES.VACBOT]: TextDeviceValue
};

const DISPLAY_BY_FEATURE_TYPE = {
Expand All @@ -31,7 +32,8 @@ const DEVICE_FEATURES_WITHOUT_EXPIRATION = [
DEVICE_FEATURE_CATEGORIES.SMOKE_SENSOR,
DEVICE_FEATURE_CATEGORIES.LEAK_SENSOR,
DEVICE_FEATURE_CATEGORIES.BUTTON,
DEVICE_FEATURE_CATEGORIES.TEXT
DEVICE_FEATURE_CATEGORIES.TEXT,
DEVICE_FEATURE_CATEGORIES.VACBOT
];

const SensorDeviceType = ({ children, ...props }) => {
Expand Down
99 changes: 99 additions & 0 deletions front/src/components/boxs/vacbot/EditVacbot.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { Component } from 'preact';
import { connect } from 'unistore/preact';
import { Text, Localizer } from 'preact-i18n';
import BaseEditBox from '../baseEditBox';
import actions from '../../../actions/dashboard/boxActions';

const EditVacbotBox = ({ children, ...props }) => (
<BaseEditBox {...props} titleKey="dashboard.boxTitle.vacbot">
<div class={props.loading ? 'dimmer active' : 'dimmer'}>
<div class="loader" />

<div class="form-group">
<label>
<Text id="dashboard.boxes.vacbot.editVacbotLabel" />
</label>
<select onChange={props.updateBoxVacbot} class="form-control">
<option>
<Text id="global.emptySelectOption" />
</option>
{props.vacbots &&
props.vacbots.map(vacbot => (
<option selected={vacbot.selector === props.box.device_feature} value={vacbot.selector}>
{vacbot.name}
</option>
))}
</select>
</div>

<div class="form-group">
<label>
<Text id="dashboard.boxes.vacbot.editBoxNameLabel" />
</label>
<Localizer>
<input
type="text"
value={props.box.title}
onInput={props.updateBoxTitle}
class="form-control"
placeholder={<Text id="dashboard.boxes.vacbot.editBoxNamePlaceholder" />}
/>
</Localizer>
</div>
</div>
</BaseEditBox>
);

class EditVacbotBoxComponent extends Component {
updateBoxVacbot = e => {
this.props.updateBoxConfig(this.props.x, this.props.y, {
device_feature: e.target.value
});
};
updateBoxTitle = e => {
this.props.updateBoxConfig(this.props.x, this.props.y, { title: e.target.value });
};

getVacbots = async () => {
await this.setState({
loading: true
});
try {
await this.setState({
error: false,
pending: true
});
const vacbots = await this.props.httpClient.get('/api/v1/service/ecovacs/vacbots');
this.setState({
vacbots,
pending: false,
loading: false
});
} catch (e) {
console.error(e);
this.setState({
error: true,
pending: false,
loading: false
});
}
};

componentDidMount() {
this.getVacbots();
}

render(props, { loading, vacbots }) {
return (
<EditVacbotBox
{...props}
vacbots={vacbots}
loading={loading}
updateBoxVacbot={this.updateBoxVacbot}
updateBoxTitle={this.updateBoxTitle}
/>
);
}
}

export default connect('httpClient', actions)(EditVacbotBoxComponent);
Loading
Loading