Skip to content

Commit

Permalink
Battery level also when AC motor (falsely) reported
Browse files Browse the repository at this point in the history
  • Loading branch information
EDelsman committed Nov 24, 2021
1 parent 8c61b9c commit a78df96
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 13 deletions.
12 changes: 10 additions & 2 deletions .homeychangelog.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"1.2.0": {
"en": "• Support for Kwantum window coverings (using bridge) • Support for Eve Motionblinds (using bridge).",
"nl": "• Ondersteuning voor Kwantum raamdecoratie (via bridge) • Support for Eve Motionblinds (via bridge)."
},
"1.1.9": {
"en": "• Enable battery power capability for devices that report AC power as well as battery level, as some devices misreport voltage mode.",
"nl": "• Batterijniveau tonen voor gordijnen die zowel netstroom als batterijnveau aangeven, omdat sommige gordijnen het stroomtype verkeerd doorgeven."
},
"1.1.8": {
"en": "Support for Kwantum window coverings • Prevent crash when heartbeat message has no data element.",
"nl": "Ondersteuning voor Kwantum raamdecoratie • Voorkom crash als het heartbeat bericht geen data element heeft."
"en": "• Prevent crash when heartbeat message has no data element.",
"nl": "• Voorkom crash als het heartbeat bericht geen data element heeft."
},
"1.1.7": {
"en": "• Added tilt action card.",
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ To connect your MOTION devices to Homey, you must have a WIFI bridge in your hom

In order for Homey to be allowed to send commands to the bridge, it needs a key. The key can be configured in the Homey MOTION app settings. You will find instructions there on how to obtain the key.

### EVE MOTIONBLINDS
The new Eve MotionBlinds product line is also supported by this app, provided you connect them using the WIFI bridge as there is currently no support for Matter in Homey.

### AVAILABILITY
[Motion](https://motionblinds.com/) products are developed by [Coulisse](https://coulisse.com/) and can be found in window coverings from various other manufacturers across the world. [ROBBshop](https://www.robbshop.nl/) features a DIY kit to convert a normal rollerblind into a Motion powered smart blind. You can also find Motion controls in products from [Zonnelux](https://www.zonnelux.nl/), [BSL raambekleding](https://www.bsl-raambekleding.nl/), [Kwantum](https://www.kwantum.nl/), [Hornbach](https://www.hornbach.nl/) and others. You can find a store near you at [https://motionblinds.com/stores/](https://motionblinds.com/stores/).
[Motion](https://motionblinds.com/) products are developed by [Coulisse](https://coulisse.com/) and can be found in window coverings from various other manufacturers across the world. [ROBBshop](https://www.robbshop.nl/) features a DIY kit to convert a normal rollerblind into a Motion powered smart blind. You can also find Motion controls in products from [Zonnelux](https://www.zonnelux.nl/), [BSL raambekleding](https://www.bsl-raambekleding.nl/), [Smartblinds.nl](https://www.smartblinds.nl/), [Kwantum](https://www.kwantum.nl/), [Hornbach](https://www.hornbach.nl/) and others. You can find a store near you at [https://motionblinds.com/stores/](https://motionblinds.com/stores/).
5 changes: 4 additions & 1 deletion README.nl.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Om je MOTION apparaten te verbinden met Homey moet je een MOTION WIFI bridge in

Om te zorgen dat Homey commando's naar de bridge kan sturen is een sleutel nodig. Deze sleutel moet ingesteld worden in de instellingen van de Homey MOTION app. Daar vind je ook de instructies hoe je aan deze sleutel kunt komen.

### EVE MOTIONBLINDS
De nieuwe Eve MotionBlinds productlijn wordt ook ondersteund door deze app, mits je ze via de WIFI bridge aansluit omdat er op dit moment nog geen Matter ondersteuning voor Homey is.

### BESCHIKBAARHEID
[Motion](https://motionblinds.com/nl/) producten worden ontwikkeld door [Coulisse](https://coulisse.com/) en kunnen gevonden worden in raambekleding van diverse fabrikanten over de hele wereld. [ROBBshop](https://www.robbshop.nl/) heeft een Doe-Het-Zelf kit om een normaal rolgordijn in een Motion aangedreven slim gordijn te veranderen. Je kunt ook Motion bediening krijgen in producten van [Zonnelux](https://www.zonnelux.nl/), [BSL raambekleding](https://www.bsl-raambekleding.nl/), [Kwantum](https://www.kwantum.nl/), [Hornbach](https://www.hornbach.nl/) en vele anderen. Je kunt ook een winkel in de buurt vinden op [https://motionblinds.com/nl/winkels/](https://motionblinds.com/nl/winkels/).
[Motion](https://motionblinds.com/nl/) producten worden ontwikkeld door [Coulisse](https://coulisse.com/) en kunnen gevonden worden in raambekleding van diverse fabrikanten over de hele wereld. [ROBBshop](https://www.robbshop.nl/) heeft een Doe-Het-Zelf kit om een normaal rolgordijn in een Motion aangedreven slim gordijn te veranderen. Je kunt ook Motion bediening krijgen in producten van [Zonnelux](https://www.zonnelux.nl/), [BSL raambekleding](https://www.bsl-raambekleding.nl/), [Smartblinds.nl](https://www.smartblinds.nl/), [Kwantum](https://www.kwantum.nl/), [Hornbach](https://www.hornbach.nl/) en vele anderen. Je kunt ook een winkel in de buurt vinden op [https://motionblinds.com/nl/winkels/](https://motionblinds.com/nl/winkels/).

6 changes: 5 additions & 1 deletion README.nl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Om je MOTION apparaten te verbinden met Homey moet je een MOTION WIFI bridge in

Om te zorgen dat Homey commando's naar de bridge kan sturen is een sleutel nodig. Deze sleutel moet ingesteld worden in de instellingen van de Homey MOTION app. Daar vind je ook de instructies hoe je aan deze sleutel kunt komen.

EVE MOTIONBLINDS

De nieuwe Eve MotionBlinds productlijn wordt ook ondersteund door deze app, mits je ze via de WIFI bridge aansluit omdat er op dit moment nog geen Matter ondersteuning voor Homey is.

BESCHIKBAARHEID

Motion producten worden ontwikkeld door Coulisse en kunnen gevonden worden in raambekleding van diverse fabrikanten over de hele wereld. ROBBshop heeft een Doe-Het-Zelf kit om een normaal rolgordijn in een Motion aangedreven slim gordijn te veranderen. Je kunt ook Motion bediening krijgen in producten van Zonnelux, BSL raambekleding, Kwantum, Hornbach en vele anderen. Je kunt ook een winkel in de buurt vinden op de motionblinds website.
Motion producten worden ontwikkeld door Coulisse en kunnen gevonden worden in raambekleding van diverse fabrikanten over de hele wereld. ROBBshop heeft een Doe-Het-Zelf kit om een normaal rolgordijn in een Motion aangedreven slim gordijn te veranderen. Je kunt ook Motion bediening krijgen in producten van Zonnelux, BSL raambekleding, Smartblinds.nl, Kwantum, Hornbach en vele anderen. Je kunt ook een winkel in de buurt vinden op de motionblinds website.
6 changes: 5 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ To connect your MOTION devices to Homey, you must have a WIFI bridge in your hom

In order for Homey to be allowed to send commands to the bridge, it needs a key. The key can be configured in the Homey MOTION app settings. You will find instructions there on how to obtain the key.

EVE MOTIONBLINDS

The new Eve MotionBlinds product line is also supported by this app, provided you connect them using the WIFI bridge as there is currently no support for Matter in Homey.

AVAILABILITY

Motion products are developed by Coulisse and can be found in window coverings from various other manufacturers across the world. ROBBshopfeatures a DIY kit to convert a normal rollerblind into a Motion powered smart blind. You can also find Motion controls in products from Zonnelux, BSL raambekleding, Kwantum, Hornbach and many others. You can find a store near you at the motionblinds website.
Motion products are developed by Coulisse and can be found in window coverings from various other manufacturers across the world. ROBBshop features a DIY kit to convert a normal rollerblind into a Motion powered smart blind. You can also find Motion controls in products from Zonnelux, BSL raambekleding, Smartblinds.nl, Kwantum, Hornbach and many others. You can find a store near you at the motionblinds website.
6 changes: 3 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "com.coulisse.motionblinds",
"version": "1.1.8",
"version": "1.2.0",
"compatibility": ">=5.0.0",
"sdk": 3,
"brandColor": "#2F9C94",
Expand All @@ -16,8 +16,8 @@
"nl": "Motion Blinds"
},
"description": {
"en": "Smart window coverings by Coulisse. Available from ROBBshop, Kwantum, Hornbach and many others.",
"nl": "Slimme raamdecoratie van Coulisse. Verkrijgbaar bij ROBBshop, Kwantum, Hornbach en vele anderen."
"en": "Smart window coverings by Coulisse. Available from ROBBshop, Smartblinds.nl, Kwantum, Hornbach and many others.",
"nl": "Slimme raamdecoratie van Coulisse. Verkrijgbaar bij ROBBshop, Smartblinds.nl, Kwantum, Hornbach en vele anderen."
},
"category": [
"appliances"
Expand Down
12 changes: 8 additions & 4 deletions drivers/genericdevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MotionDeviceGeneric extends Homey.Device {
onNewDevice() { // the motiondriver now knows me, so register
if (this.mdriver.registerDevice(this.getData().mac)) { // check if set. onInit calls this too so it may already be done
this.mdriver.setDeviceInGroup(this.getData().mac, this.getSetting('inRemoteGroup'));
this.statusQuery(); // this seems to update battery, whereas read does not. This is also why evert nth heartbeat a status query is done
this.statusQuery();
}
}

Expand Down Expand Up @@ -744,15 +744,19 @@ class MotionDeviceGeneric extends Homey.Device {
}
}
if (msg.data.voltageMode != undefined) {
this.checkBatteryCapability(msg.data.voltageMode == this.mdriver.VoltageMode.DC, msg.data.type, settings.separateBatteryStates);
let hasbattery = msg.data.voltageMode == this.mdriver.VoltageMode.DC ||
msg.data.batteryLevel != undefined && msg.data.batteryLevel > 300 && msg.data.batteryLevel < 1660;
this.checkBatteryCapability(hasbattery, msg.data.type, settings.separateBatteryStates);
if (msg.data.voltageMode != settings.voltageMode || settings.voltageModeName == undefined || settings.voltageModeName == '?') {
newSettings.voltageMode = msg.data.voltageMode;
newSettings.voltageModeName = this.homey.app.getVoltageModeName(msg.data.voltageMode);
if (newSettings.voltageModeName == null || newSettings.voltageModeName == undefined || newSettings.voltageModeName == '?')
newSettings.voltageModeName = '-';
save = true;
}
}
} else if (msg.data.batteryLevel != undefined)
this.checkBatteryCapability(msg.data.batteryLevel > 300 && msg.data.batteryLevel < 1660, msg.data.type, settings.separateBatteryStates);

if (msg.data.wirelessMode != undefined) {
this.checkBidirectionalCapability(msg.data.wirelessMode == this.mdriver.WirelessMode.BiDirection ||
msg.data.wirelessMode == this.mdriver.WirelessMode.BidirectionMech, msg.data.type);
Expand Down Expand Up @@ -1071,7 +1075,7 @@ class MotionDeviceGeneric extends Homey.Device {
}
}

async statusQuery() {
async statusQuery() { // status query operation seems to update battery, whereas readDevice does not. This is also why evert nth heartbeat a status query is done
this.log('statusQuery');

if (this.hasCapability('windowcoverings_set.top') && this.hasCapability('windowcoverings_set.bottom')) {
Expand Down

0 comments on commit a78df96

Please sign in to comment.