NEWS
Xiaomi Smartmi Air Humidifier2
-
Hallo @Pittini , vielen dank für deine Arbeit auf jeden fall :)! bin nach deiner Anleitung gegangen, leider werden datenpunkte überhaupt nicht Aktuallisiert =(.
Javascript Adapter node-mihome hinzugefügt, deinen javascript erstellt und gestartet, datenpunkt bzw modell aus dem Objekt ausgelesen und dann die entsprechende
folgender script "zhimi.airpurifier.mb3.js" in den ziel ordner " /opt/iobroker/node_modules/iobroker.javascript/node_modules/node-mihome/lib/devices/ " kopiert und Javascript Adapter neugestartet. Das einzige was ich an Fehlermeldung erhalten , ist22:44:33.307 info javascript.0 (31314) Stop script script.js.common.Luftreiniger_H3 22:44:33.322 info javascript.0 (31314) Start javascript script.js.common.Luftreiniger_H3 22:44:33.329 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Starting AllMyMi V.0.2.29 22:44:33.332 info javascript.0 (31314) script.js.common.Luftreiniger_H3: registered 0 subscriptions and 0 schedules 22:44:33.333 info javascript.0 (31314) script.js.common.Luftreiniger_H3: You are already logged in, login canceled 22:44:33.333 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Retrieving your in de registered MiHome Devices 22:44:33.483 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Found 4 MiHome Devices, those are: 22:44:33.484 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Luftreiniger 22:44:33.485 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Küchen Led 22:44:33.485 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Schlafzimmer lampe 22:44:33.486 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Yakışıklı 22:44:33.486 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Now searching for supported Devices... 22:44:33.487 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Device Luftreiniger is supported, creating DataPoints if necessary 22:44:33.487 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Device Küchen Led is supported, creating DataPoints if necessary 22:44:33.488 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Device Schlafzimmer lampe is supported, creating DataPoints if necessary 22:44:34.229 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Now creating device for zhimi.airpurifier.mb3 / 334775556 / 192.gelöscht / token gelöscht :) / 10000 22:44:34.230 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Created device {"_events":{},"_eventsCount":0,"_maxListeners":100,"id":"334775556","address":"192.gelöscht","token":"gelöscht :)","protocol":"local","refresh":10000,"_properties":{},"_propertiesToMonitor":["air-purifier:fault","air-purifier:on","air-purifier:fan-level","air-purifier:mode","environment:pm2.5-density","environment:relative-humidity","environment:temperature","filter:filter-life-level","filter:filter-used-time","alarm:alarm","indicator-light:brightness","indicator-light:on","motor-speed:motor-speed","motor-speed:motor-set-speed","motor-speed:favorite-fan-level","use-time:use-time","physical-controls-locked:physical-controls-locked"],"_miotSpec":null,"_miotSpecType":"urn:miot-spec-v2:device:air-purifier:0000A007:zhimi-mb3:2","model":"zhimi.airpurifier.mb3","setter":{},"definition":{"info":[{"id":"localip","initial":"","forceCreation":false,"common":{"read":true,"write":true,"name":"Ip Adress","type":"string","role":"value","def":""}},{"id":"token","initial":"","forceCreation":false,"common":{"read":true,"write":true,"name":"Token","type":"string","role":"value","def":""}},{"id":"did","initial":"","forceCreation":false,"common":{"read":true,"write":true,"name":"Device Id","type":"string","role":"value","def":""}},{"id":"model","initial":"","forceCreation":false,"common":{"read":true,"write":true,"name":"Model","type":"string","role":"value","def":""}},{"id":"rssi","initial":0,"forceCreation":false,"common":{"read":true,"write":false,"name":"rssi","type":"number","role":"value.rssi","def":0}},{"id":"name","initial":"","forceCreation":false,"common":{"read":true,"write":true,"name":"Name","type":"string","role":"value","def":""}},{"id":"isOnline","initial":false,"forceCreation":false,"common":{"read":true,"write":true,"name":"Is online","type":"boolean","role":"value","def":false}}],"model":"zhimi.airpurifier.mb3","description":"Purifier 3H","setter":{},"common":[{"name":"air-purifier.on","type":"boolean","role":"switch","read":true,"write":true,"min":false,"max":true},{"name":"air-purifier.fault","type":"number","read":true,"write":false,"min":0,"max":5,"states":{"0":"No faults","1":"m1_run","2":"m1_stuck","3":"no_sensor","4":"error_hum","5":"error_temp","6":"timer_error1","7":"timer_error2"},"role":"state"},{"name":"air-purifier.mode","type":"number","read":true,"write":true,"min":0,"max":3,"states":{"0":"auto","1":"sleep","2":"favorite","3":"fanset"},"role":"state"},{"name":"air-purifier.fan-level","type":"number","read":true,"write":true,"min":1,"max":3,"role":"state"},{"name":"alarm.alarm","type":"boolean","read":true,"write":true,"role":"state"},{"name":"indicator-light.brightness","type":"number","read":true,"write":true,"min":0,"max":2,"role":"state"},{"name":"indicator-light.on","type":"boolean","role":"switch","read":true,"write":true,"min":false,"max":true},{"name":"environment.temperature","type":"number","role":"value.temperature","read":true,"write":false,"min":-40,"max":125,"unit":"°C"},{"name":"motor-speed.motor-speed","type":"number","read":true,"write":false,"min":0,"max":3000,"unit":"rpm","role":"state"},{"name":"motor-speed.motor-set-speed","type":"number","read":true,"write":false,"min":0,"max":3000,"unit":"rpm","role":"state"},{"name":"motor-speed.favorite-fan-level","type":"number","read":true,"write":true,"min":0,"max":14,"role":"state"},{"name":"use-time.use-time","type":"number","read":true,"write":false,"role":"state"},{"name":"environment.relative-humidity","type":"number","role":"value.humidity","read":true,"write":false,"min":0,"max":100,"unit":"%"},{"name":"environment.pm2_5-density","type":"number","read":true,"write":false,"min":0,"max":600,"unit":"μg/m³","role":"state"},{"name":"filter.filter-life-level","type":"number","read":true,"write":false,"min":0,"max":100,"unit":"%","role":"state"},{"name":"filter.filter-used-time","type":"number","read":true,"write":false,"unit":"h","role":"state"},{"name":"physical-controls-locked.physical-controls-locked","type":"boolean","role":"switch","read":true,"write":true,"min":false,"max":true}]},"firstrun":true,"rssi":0,"isOnline":true} now fetching data 22:44:35.523 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Init Device# 0 - device="zhimi.airpurifier.mb3" 22:44:35.524 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Now creating device for yeelink.light.strip2 / 134113732 / 192.168.3.115gelöscht{},"_eventsCount":0,"_maxListeners":100,"id":"134113732","address":"192.1gelöscht","token":"gelöscht :)","protocol":"local","refresh":10000,"_properties":{},"_propertiesToMonitor":["power","bright","ct","hue","saturation"],"_miotSpec":null,"_miotSpecType":null,"model":"yeelink.light.strip2","setter":{},"definition":{"info":[{"id":"localip","initial":"","forceCreation":false,"common":{"read":true,"write":true,"name":"Ip Adress","type":"string","role":"value","def":""}},{"id":"token","initial":"","forceCreation":false,"common":{"read":true,"write":true,"name":"Token","type":"string","role":"value","def":""}},{"id":"did","initial":"","forceCreation":false,"common":{"read":true,"write":true,"name":"Device Id","type":"string","role":"value","def":""}},{"id":"model","initial":"","forceCreation":false,"common":{"read":true,"write":true,"name":"Model","type":"string","role":"value","def":""}},{"id":"rssi","initial":0,"forceCreation":false,"common":{"read":true,"write":false,"name":"rssi","type":"number","role":"value.rssi","def":0}},{"id":"name","initial":"","forceCreation":false,"common":{"read":true,"write":true,"name":"Name","type":"string","role":"value","def":""}},{"id":"isOnline","initial":false,"forceCreation":false,"common":{"read":true,"write":true,"name":"Is online","type":"boolean","role":"value","def":false}}],"model":"yeelink.light.strip2","description":"Yeelight Lightstrip Plus","setter":{},"common":[{"name":"power","type":"boolean","role":"switch","read":true,"write":true},{"name":"bright","type":"number","read":true,"write":true,"min":1,"max":100,"role":"state"},{"name":"hue","type":"number","read":true,"write":true,"min":0,"max":16777215,"role":"state"},{"name":"sat","type":"number","read":true,"write":true,"min":0,"max":100,"role":"state"},{"name":"color_mode","type":"number","read":true,"write":true,"min":1,"max":2,"role":"state"},{"name":"ct","type":"number","read":true,"write":true,"min":1700,"max":6500,"role":"state"}]},"firstrun":true,"rssi":0,"isOnline":true} now fetching data 22:44:35.533 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Init Device# 1 - device="yeelink.light.strip2" 22:44:35.533 info javascript.0 (31314) script.js.common.Luftreiniger_H3: Now creating device for yeelink.light.ceiling10 / 270781479 / 192.gelöscht / gelöscht :) / 10000 22:44:35.535 error javascript.0 (31314) script.js.common.Luftreiniger_H3: Error: Model yeelink.light.ceiling10 is not supported 22:44:35.536 error javascript.0 (31314) at CreateDevices (script.js.common.Luftreiniger_H3:910:36) 22:44:35.536 error javascript.0 (31314) at main (script.js.common.Luftreiniger_H3:842:5)
wobei ich sagen muss das die Lampe nicht unterstützt wird, ist ja für mich egal. Hab ich irgendwas falsch gemacht? Ich habe nur "node-mihome" in den Adapter hinzugefügt, oder muss man das installieren=?
PS : Hat sich erledigt ;). Hab das System kompl. rebootet , läuft :), einzigster Manko, du müsstest dein script mal umschrauben, damit die Angelegten Objekte richtig da stehen.
javascript.0 2022-01-19 23:28:55.575 warn at RefreshDps (script.js.common.Luftreiniger_H3:1027:45) javascript.0 2022-01-19 23:28:55.574 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1437:20) javascript.0 2022-01-19 23:28:55.573 warn You are assigning a string to the state "javascript.0.MiHomeAll.270781479.bg_hue" which expects a number. Please fix your code to use a number or change the state type to string. This warning might become an error in future versions. javascript.0 2022-01-19 23:28:55.572 warn at Timeout._onTimeout (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-mihome/lib/device-miio.js:73:9) javascript.0 2022-01-19 23:28:55.572 warn at module.exports.loadProperties (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-mihome/lib/device-miio.js:107:12) javascript.0 2022-01-19 23:28:55.571 warn at module.exports.EventEmitter.emit (domain.js:483:12) javascript.0 2022-01-19 23:28:55.571 warn at module.exports.emit (events.js:314:20) javascript.0 2022-01-19 23:28:55.570 warn at module.exports.<anonymous> (script.js.common.Luftreiniger_H3:940:21) javascript.0 2022-01-19 23:28:55.570 warn at RefreshDps (script.js.common.Luftreiniger_H3:1027:45) javascript.0 2022-01-19 23:28:55.569 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1437:20) javascript.0 2022-01-19 23:28:55.568 warn You are assigning a string to the state "javascript.0.MiHomeAll.270781479.bg_ct" which expects a number. Please fix your code to use a number or change the state type to string. This warning might become an error in future versions. javascript.0 2022-01-19 23:28:55.567 warn at Timeout._onTimeout (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-mihome/lib/device-miio.js:73:9) javascript.0 2022-01-19 23:28:55.566 warn at module.exports.loadProperties (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-mihome/lib/device-miio.js:107:12) javascript.0 2022-01-19 23:28:55.566 warn at module.exports.EventEmitter.emit (domain.js:483:12) javascript.0 2022-01-19 23:28:55.566 warn at module.exports.emit (events.js:314:20) javascript.0 2022-01-19 23:28:55.565 warn at module.exports.<anonymous> (script.js.common.Luftreiniger_H3:940:21) javascript.0 2022-01-19 23:28:55.565 warn at RefreshDps (script.js.common.Luftreiniger_H3:1027:45) javascript.0 2022-01-19 23:28:55.564 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1437:20) javascript.0 2022-01-19 23:28:55.562 warn You are assigning a string to the state "javascript.0.MiHomeAll.270781479.bg_bright" which expects a number. Please fix your code to use a number or change the state type to string. This warning might become an error in future versions. javascript.0 2022-01-19 23:28:55.562 warn at Timeout._onTimeout (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-mihome/lib/device-miio.js:73:9) javascript.0 2022-01-19 23:28:55.561 warn at module.exports.loadProperties (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-mihome/lib/device-miio.js:107:12) javascript.0 2022-01-19 23:28:55.556 warn at module.exports.EventEmitter.emit (domain.js:483:12) javascript.0 2022-01-19 23:28:55.556 warn at module.exports.emit (events.js:314:20) javascript.0 2022-01-19 23:28:55.555 warn at module.exports.<anonymous> (script.js.common.Luftreiniger_H3:940:21) javascript.0 2022-01-19 23:28:55.555 warn at RefreshDps (script.js.common.Luftreiniger_H3:1027:45) javascript.0 2022-01-19 23:28:55.554 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1437:20) javascript.0 2022-01-19 23:28:55.553 warn You are assigning a string to the state "javascript.0.MiHomeAll.270781479.active_bright" which expects a number. Please fix your code to use a number or change the state type to string. This warning might become an error in future versions. javascript.0 2022-01-19 23:28:55.552 warn at Timeout._onTimeout (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-mihome/lib/device-miio.js:73:9) javascript.0 2022-01-19 23:28:55.552 warn at module.exports.loadProperties (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-mihome/lib/device-miio.js:107:12) javascript.0 2022-01-19 23:28:55.551 warn at module.exports.EventEmitter.emit (domain.js:483:12) javascript.0 2022-01-19 23:28:55.551 warn at module.exports.emit (events.js:314:20) javascript.0 2022-01-19 23:28:55.550 warn at module.exports.<anonymous> (script.js.common.Luftreiniger_H3:940:21) javascript.0 2022-01-19 23:28:55.550 warn at RefreshDps (script.js.common.Luftreiniger_H3:1016:37) javascript.0 2022-01-19 23:28:55.549 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1437:20) javascript.0 2022-01-19 23:28:55.547 warn You are assigning a number to the state "javascript.0.MiHomeAll.270781479.color_mode" which expects a boolean. Please fix your code to use a boolean or change the state type to number. This warning might become an error in future versions. javascript.0 2022-01-19 23:28:55.547 warn at Timeout._onTimeout (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-mihome/lib/device-miio.js:73:9) javascript.0 2022-01-19 23:28:55.546 warn at module.exports.loadProperties (/opt/iobroker/node_modules/iobroker.javascript/node_modules/node-mihome/lib/device-miio.js:107:12) javascript.0 2022-01-19 23:28:55.546 warn at module.exports.EventEmitter.emit (domain.js:483:12) javascript.0 2022-01-19 23:28:55.545 warn at module.exports.emit (events.js:314:20) javascript.0 2022-01-19 23:28:55.545 warn at module.exports.<anonymous> (script.js.common.Luftreiniger_H3:940:21) javascript.0 2022-01-19 23:28:55.544 warn at RefreshDps (script.js.common.Luftreiniger_H3:1027:45) javascript.0 2022-01-19 23:28:55.543 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1437:20) javascript.0 2022-01-19 23:28:55.523 warn You are assigning a string to the state "javascript.0.MiHomeAll.270781479.moon_mode" which expects a boolean. Please fix your code to use a boolean or change the state type to string. This warning might become an error in future versions.
-
Hallo zusammen,
gibt es für den Xiaomi humidifier2 etwas neueres... oder eine anleitung wie ich das einbinden kann?
Gruß
alex -
@derioalex Was genau suchst du bzw. willst du denn? Ich habe bei mir mittels Javascript (nicht über den MiHome Adapter) den Humidifier2 bei mir eingebunden...
-
@bluefish sagte in Xiaomi Smartmi Air Humidifier2:
@derioalex Was genau suchst du bzw. willst du denn? Ich habe bei mir mittels Javascript (nicht über den MiHome Adapter) den Humidifier2 bei mir eingebunden...
Ich wollte auch den Humidifier2 einbilden… doch leider hab ich keine Ahnung wo und wie
-
@derioalex
Kurze Anleitung:-
Du installierst dir python-miio, am besten in eine Virtuelle Environment (z.B. Ordner "cd /opt/python/miio" dann "python3 -m venv venv" , "source venv/bin/activate" , "pip install python-miio")
-
Anschließend bekommst du mit du mittels "/opt/python/miio/venv/bin/miiocli airhumidifiermiot --ip 192.168.xxx.xx --token xxxxxxxxxxxx status":
-
Das ganze kannst du nun auch im iobroker mittels Blockly exec-Block abfragen oder mittels javascript... Die Werte kannst du dann extrahieren und in Datenpunkte schreiben
Zum Beispiel (natürlich musst du die Datenpunkte davor anlegen und die Variablen anpassen):
schedule("*/15 * * * * *", function () { exec(Path + ' airhumidifiermiot --ip ' + IPaddress + ' --token ' + Token + ' status', function (error, result, stderr) { var noconnection = result.indexOf('Error: Unable to discover the device') + 1; if (noconnection == 1) {setState("humidifier2.0.info.availability", false, true)}; if (noconnection == 0) { setState("humidifier2.0.info.availability", true, true); var MiioList = result.split("\n"); setState("humidifier2.0.info.power", MiioList[0].split(": ")[1], true); // Power: off setState("humidifier2.0.info.error", MiioList[1].split(": ")[1], true); // Error: 0 setState("humidifier2.0.info.targethumidity", parseFloat(MiioList[2].split(": ")[1].split(" %")[0]), true); // Target Humidity: 70 % setState("humidifier2.0.info.humidity", parseFloat(MiioList[3].split(": ")[1].split(" %")[0]), true); // Humidity: 60 % setState("humidifier2.0.info.temp", parseFloat(MiioList[4].split(": ")[1].split(" °C")[0]), true); // Temperature: 23.6 °C //setState("", MiioList[5].split(": ")[1].split(" °F")[0], true); // Temperature: 74.5 °F setState("humidifier2.0.info.depth", parseFloat(MiioList[6].split(": ")[1].split(" %")[0]), true); // Water Level: 0 % setState("humidifier2.0.info.waterTankDetached", MiioList[7].split(": ")[1], true); // Water tank detached: False setState("humidifier2.0.info.mode", MiioList[8].split(": ")[1].split(".")[1], true); // Mode: OperationMode.Auto setState("humidifier2.0.info.ledBrightnessLevel", MiioList[9].split(": ")[1].split(".")[1], true); // LED brightness: LedBrightness.Dim setState("humidifier2.0.info.buzzer", MiioList[10].split(": ")[1], true); // Buzzer: False setState("humidifier2.0.info.childLock", MiioList[11].split(": ")[1], true); // Child lock: False setState("humidifier2.0.info.dryMode", MiioList[12].split(": ")[1], true); // Dry mode: True //setState("", MiioList[13].split(": ")[1].split(".")[1], true); // Button pressed PressedButton.No setState("humidifier2.0.info.targetmotorspeed", parseFloat(MiioList[14].split(": ")[1].split(" rpm")[0]), true); // Target motor speed: 200 rpm setState("humidifier2.0.info.actualmotorspeed", parseFloat(MiioList[15].split(": ")[1].split(" rpm")[0]), true); // Actual motor speed: 0 rpm setState("humidifier2.0.info.usedTime", parseFloat(MiioList[16].split(": ")[1].split(" s")[0]), true); // Use time: 447787 s setState("humidifier2.0.info.powerTime", parseFloat(MiioList[17].split(": ")[1].split("s")[0]), true); // Power time: 155905 s setState("humidifier2.0.info.cleanMode", MiioList[18].split(": ")[1], true); // Clean mode: False } }); });
Und mit diesem Codebeispiel kannst du dann das Gerät ein- und ausschalten. (Kannst du natürlich auf jeden anderen benötigten Wert anpassen um z.B. LED steuern, motorSpeed etc.)
on({id: "humidifier2.0.control.power", change: "ne"}, function (obj) { if ((obj.state ? obj.state.val : "")) { exec(Path + ' airhumidifiermiot --ip ' + IPaddress + ' --token ' + Token + ' on'); } else { exec(Path + ' airhumidifiermiot --ip ' + IPaddress + ' --token ' + Token + ' off'); } });
Ich hoffe du bekommst es mit diesen Infos hin, ansonsten schreib mir eine PN, dann schaue ich mal, wie ich dir sonst helfen kann
-
-
@bluefish
Hinweis am Rande:
Unter Debian versucht man zuerst das Paket über den Paketmanager einzuspielen.Müsste eigentlich verfügbar sein:
sudo apt install python3-miio
-
@thomas-braun ob man python3-miio mittels apt oder pip installiert, sollte eigentlich keinen Unterschied machen, das Resultat ist doch das selbe! Ich habe mir jedoch angewöhnt alles in Virtual Environments zu installieren, aber das kann jeder machen wie er will
-
Hält pip auch die Versionen aktuell?
Und zieht Dependencies nach? -
@thomas-braun du meinst die Updates mittels "sudo apt update && sudo apt upgrade"!?
Natürlich gibt es auch Befehle, um alle pip (Python) Module zu updaten, aber das möchte man / ich eigentlich nicht. Kleines Beispiel zu diesem Beispiel. In python3-miio wurden durch ein Update Zeilen für den Humidifier2 hinzugefügt. Damit stimmte meine Zuordnung mittels "MiioList[x]" natürlich auch nicht mehr... Hätte ich das nun automatisch geupdatet, hätte ich es vermutlich nicht direkt mitbekommen. Daher update ich Python Module lieber manuell und abhängig zur entsprechenden Virtual EnvironmentJa, pip installiert auch die zugehörigen Module, aber wie gesagt, es geht auch der Weg über apt. Viele Wege führen nach Rom
-
@canim kann es sein das es mit Iobroker v4 nicht funktioniert? Habe node 14 aktuell laufen, leider geht es nicht mehr
-
funktioniert der Adapter auch mit dem runden Modell?
Ich bekomme den Xiaomi MiHome Gateway Adapter nicht zum laufen. So wie es aussieht benötigt man da ein Xiaomi Gateway, ich hab aber nur diesen Luftbefeuchter, sonst nichts.