Skip to content

Commit

Permalink
### 0.3.2 (2017-07-07)
Browse files Browse the repository at this point in the history
fix Protocol after robot update and some  small changes
  • Loading branch information
MeisterTR committed Jun 7, 2017
1 parent 64483af commit 2e28df0
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 52 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Token Vorgehen:

### 1. Roboter resetten
Um den Token des Roboters zu bekommen, muss man ihn erstmal aus dem Wlan abmelden.
Dies geht entweder über die app unter den Einstellungen des Gerätes
(genauer kann ich es nicht beschreiben weil ich kein Chinesisch kann).
Dies geht entweder über die app unter den Einstellungen des Gerätes
(genauer kann ich es nicht beschreiben weil ich kein Chinesisch kann).
Da steht Remove Device, über diesen Punkt kann man das Gerät Entfernen
Alternativ kann man auch den Resetknopf am Gerät drücken.

Expand All @@ -36,13 +36,13 @@ Die Kennung des Wlan lautet: rockrobo...
Das Programm "Packet Sender" muss installiert sein und gestartet werden

- Bei müssen folgende Werte eingegeben werden
- HEX: 21310020ffffffffffffffffffffffffffffffffffffffffffffffffffffffff (=HALO Nachricht)
- HEX: 21310020ffffffffffffffffffffffffffffffffffffffffffffffffffffffff (=HALO Nachricht)
- IP Vacuum 192.168.8.1
- Port 54321
- Nachrichtentyp UDP

### 5. Packet senden.
Fenster unten:
Fenster unten:

a) gesetzte Nachricht
b) darüber die Antwort von dem Roboter
Expand All @@ -54,6 +54,8 @@ Die letzten 16 Byte der Antwort sind der gesuchte Token
![Widget](widgets/img/previewControl.png)

## Changelog
### 0.3.2 (2017-06-07)
* (MeisterTR) fix no communication after softwareupdate(Vers. 3.3.9)

### 0.3.1 (2017-04-10)
* (MeisterTR) fix setting the fan power
Expand Down
18 changes: 12 additions & 6 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"common": {
"name": "mihome-vacuum",
"version": "0.3.1",
"version": "0.3.2",
"news": {
"0.3.2": {
"en": "fix Protocol update after 3.3.9",
"de": "Korrigiere Protokollupdate nach Version 3.3.9",
"ru": "fix Protocol update after 3.3.9"
},
"0.3.1": {
"en": "fix setting the fan power",
"de": "Korrigiere die Steuerung von Fan Power",
Expand Down Expand Up @@ -41,15 +46,15 @@
"type": "hardware",
"config": {
"minWidth": 800,
"width ": 1224
"width ": 1224
}
},
"native": {
"port": 54321,
"ownPort": 53421,
"port": 54321,
"ownPort": 53421,
"pingInterval": 20000
},
"instanceObjects": [
"instanceObjects": [
{
"_id": "info",
"type": "channel",
Expand Down Expand Up @@ -191,6 +196,7 @@
"3": "Sleep",
"5": "Cleaning",
"6": "Returning home",
"7": "Manuell mode",
"8": "Charging",
"10": "Paused",
"11": "Spot cleaning",
Expand Down Expand Up @@ -259,7 +265,7 @@
"_id": "info.consumable.side_brush",
"type": "state",
"common": {
"name": "Main brush",
"name": "Side brush",
"type": "number",
"role": "level",
"read": true,
Expand Down
3 changes: 2 additions & 1 deletion lib/mihomepacket.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function Packet(token) {
this.len = new Buffer(rawhex.substr( 4, 4), 'hex');
this.unknown = new Buffer(rawhex.substr( 8, 8), 'hex');
this.serial = new Buffer(rawhex.substr(16, 8), 'hex');
this.stamp = new Buffer(rawhex.substr(24, 8), 'hex');
//this.stamp = new Buffer(rawhex.substr(24, 8), 'hex');
this.checksum = new Buffer(rawhex.substr(32, 32), 'hex');
this.data = new Buffer(rawhex.substr(64), 'hex');
};
Expand All @@ -55,6 +55,7 @@ function Packet(token) {
crypted += cipher.final('binary');
crypted = new Buffer(crypted, 'binary');
this.data = crypted;
this.stamp =parseInt(new Date().getTime()/1000).toString(16);
};

this.getPlainData = function () {
Expand Down
18 changes: 12 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ var pingInterval;
var message = '';
var counter = 9;
var packet;
var last_ids ={
get_consumable: 0,
get_status: 0,

};

// is called if a subscribed state changes
adapter.on('stateChange', function (id, state) {
Expand Down Expand Up @@ -71,11 +76,11 @@ function sendPing() {
try {
if (counter >= 10){
counter = 0;
packet.msgCounter = 1100;
message = commands.get_consumable;
last_ids["get_consumable"]= packet.msgCounter;
} else{
packet.msgCounter = 1000;
message = commands.get_status;
last_ids["get_status"]= packet.msgCounter;
counter++;
}
server.send(commands.ping, 0, commands.ping.length, adapter.config.port, adapter.config.ip, function (err) {
Expand Down Expand Up @@ -127,15 +132,15 @@ function getStates(message){
//adapter.log.info(answer.result[0].state);
//adapter.log.info(answer['id']);

if (answer.id === 1000) {
if (answer.id === last_ids["get_status"]) {
adapter.setState('info.battery', answer.result[0].battery , true);
adapter.setState('info.cleanedtime', Math.round(answer.result[0].clean_time/60) , true);
adapter.setState('info.cleanedarea', Math.round(answer.result[0].clean_area/10000)/100 , true);
adapter.setState('control.fan_power', Math.round(answer.result[0].fan_power) , true);
adapter.setState('info.state', answer.result[0].state , true);
adapter.setState('info.error', answer.result[0].error_code , true);
adapter.setState('info.dnd', answer.result[0].dnd_enabled , true)
} else if (answer.id === 1100) {
} else if (answer.id === last_ids["get_consumable"]) {
adapter.setState('info.consumable.main_brush', 100 - (Math.round(answer.result[0].main_brush_work_time/3600/3)) , true);
adapter.setState('info.consumable.side_brush', 100- (Math.round(answer.result[0].side_brush_work_time/3600/2)) , true);
adapter.setState('info.consumable.filter', 100 - (Math.round(answer.result[0].filter_work_time/3600/1.5)) , true);
Expand All @@ -157,7 +162,7 @@ function main() {

packet = new MiHome.Packet(str2hex(adapter.config.token));

packet.msgCounter = 6430;
packet.msgCounter = 1;

commands = {
ping: str2hex('21310020ffffffffffffffffffffffffffffffffffffffffffffffffffffffff'),
Expand Down Expand Up @@ -193,7 +198,6 @@ function main() {
try {
packet.setPlainData('{"id":' + packet.msgCounter + ',' + message + '}');
adapter.log.debug('{"id":' + packet.msgCounter +',' + message + '}');
packet.msgCounter++;
var cmdraw = packet.getRaw();
adapter.log.debug('Send >>> {"id":' + packet.msgCounter + ',' + message + "} >>> " + cmdraw.toString('hex'));
adapter.log.debug(cmdraw.toString('hex'));
Expand All @@ -202,6 +206,8 @@ function main() {
if (err) adapter.log.error('Cannot send command: ' + err);
if (typeof callback === 'function') callback(err);
});
packet.msgCounter++;
if(packet.msgCounter >=9999)packet.msgCounter=0;
} catch (err) {
adapter.log.warn('Cannot send command_: ' + err);
if (typeof callback === 'function') callback(err);
Expand Down
69 changes: 34 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
{
"name": "iobroker.mihome-vacuum",
"version": "0.3.1",
"description": "Control your mihome vacuum cleaner with ioBroker",
"author": {
"name": "bluefox",
"email": "dogafox@gmail.com"
},
"homepage": "https://github.com/ioBroker/ioBroker.mihome-vacuum",
"keywords": [
"ioBroker",
"mihome-vacuum"
],
"repository": {
"type": "git",
"url": "https://github.com/ioBroker/ioBroker.mihome-vacuum"
},
"dependencies": {
},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-replace": "^0.9.3",
"grunt-contrib-jshint": "^0.11.2",
"grunt-jscs": "^2.0.0",
"grunt-http": "^1.6.0",
"mocha": "^2.3.4",
"chai": "^3.4.1"
},
"bugs": {
"url": "https://github.com/ioBroker/ioBroker.mihome-vacuum/issues"
},
"main": "main.js",
"scripts": {
"test": "node node_modules/mocha/bin/mocha"
},
"license": "MIT"
"name": "iobroker.mihome-vacuum",
"version": "0.3.2",
"description": "Control your mihome vacuum cleaner with ioBroker",
"keywords": [
"ioBroker",
"mihome-vacuum"
],
"homepage": "https://github.com/ioBroker/ioBroker.mihome-vacuum",
"bugs": {
"url": "https://github.com/ioBroker/ioBroker.mihome-vacuum/issues"
},
"license": "MIT",
"author": {
"name": "bluefox",
"email": "dogafox@gmail.com"
},
"main": "main.js",
"repository": {
"type": "git",
"url": "https://github.com/ioBroker/ioBroker.mihome-vacuum"
},
"scripts": {
"test": "node node_modules/mocha/bin/mocha"
},
"dependencies": {},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-replace": "^0.9.3",
"grunt-contrib-jshint": "^0.11.2",
"grunt-jscs": "^2.0.0",
"grunt-http": "^1.6.0",
"mocha": "^2.3.4",
"chai": "^3.4.1"
}
}

0 comments on commit 2e28df0

Please sign in to comment.