Skip to content

Commit

Permalink
Release 2.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jghaanstra committed Jan 30, 2019
1 parent 9deb2a3 commit 6b3c8fc
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
33 changes: 31 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
"min": 0,
"max": 100,
"step": 0.1
"step": 1
}
},
"drivers": [
Expand Down Expand Up @@ -867,7 +867,36 @@
"filter": "driver_id=mi-robot"
}
]
}
},
{
"id": "humidifier2Waterlevel",
"title": {
"en": "Waterlevel has changed",
"nl": "Waterniveau is veranderd"
},
"tokens": [
{
"name": "waterlevel",
"type": "number",
"title": {
"en": "waterlevel",
"nl": "waterniveau"
},
"example": 88
}
],
"args": [
{
"name": "device",
"type": "device",
"placeholder": {
"en": "Select Humidifier 2",
"nl": "Selecteer Humidifier 2"
},
"filter": "driver_id=humidifier2"
}
]
}
],
"conditions": [
{
Expand Down
5 changes: 4 additions & 1 deletion drivers/mi-humidifier2/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const miio = require('miio');
class MiHumidifier2Device extends Homey.Device {

onInit() {
this.humidifier2WaterlevelTrigger = new Homey.FlowCardTriggerDevice('humidifier2Waterlevel').register();

this.createDevice();
this.setUnavailable(Homey.__('unreachable'));

Expand Down Expand Up @@ -66,7 +68,7 @@ class MiHumidifier2Device extends Homey.Device {
const mode = await this.miio.mode();
const depth = await this.miio.depth();

var waterlevel = Math.round(depth * 10) / 10;
const waterlevel = Math.round(depth);

if (this.getCapabilityValue('onoff') != power) {
this.setCapabilityValue('onoff', power);
Expand All @@ -79,6 +81,7 @@ class MiHumidifier2Device extends Homey.Device {
}
if (this.getCapabilityValue('measure_waterlevel') != waterlevel) {
this.setCapabilityValue('measure_waterlevel', waterlevel);
this.humidifier2WaterlevelTrigger.trigger(this, {waterlevel: waterlevel});
}
if (this.getStoreValue('mode') != mode) {
this.setStoreValue('mode', mode);
Expand Down

0 comments on commit 6b3c8fc

Please sign in to comment.