# \[APP\] Shelly - Smart solutions for every home and office

**URL:** <https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765>\
**Category:** Apps\
**Tags:** app, official, homey, homey-pro, homey-cloud\
**Created:** [August 28, 2018, 8:54pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765 "2018-08-28T20:54:43Z")\
**Posts on this page:** 20\
**Page:** 5

<div class="post-metadata">

**Author:** ![LinaN](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/linan/32/3562_2.png) [@LinaN](https://community.homey.app/u/LinaN)\
**Post date:** [January 3, 2019, 10:55pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/81 "2019-01-03T22:55:52Z")

</div>

Ok, that’s too bad. Shelley seems to have some interesting products at a competitive price that would be great for a smart home.  
But thanks for the information.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 4, 2019, 7:10am UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/82 "2019-01-04T07:10:17Z")

</div>

Perhaps use a virtual device for each relay?

---

<div class="post-metadata">

**Author:** ![Phuturist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/phuturist/32/49_2.png) [@Phuturist](https://community.homey.app/u/Phuturist)\
**Post date:** [January 4, 2019, 10:11am UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/83 "2019-01-04T10:11:17Z")

</div>

Yes, something like that. But the Shelly2 also had the measure\_power capability which is one capability for both relays. I’m would not know how to do this without it getting to complicated. Perhaps 3 devices, one for the measure\_power and two for the individual relays. Does not feel good though.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 4, 2019, 10:13am UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/84 "2019-01-04T10:13:41Z")

</div>

~~For the Sonoff Dual, which has 2 relays, I create just one device that has two `onoff` capabilities (`onoff.1` and `onoff.2`). From what I understand, you create two devices (one for each relay)?~~

Never mind, you also create just one. In that case, if someone wants to be able to address a relay _as if it’s a separate device_, creating a virtual device seems to make sense. Perhaps, although I’ve never looked at it, you could share the `measure_power` capability between those two virtual devices.

---

<div class="post-metadata">

**Author:** ![Phuturist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/phuturist/32/49_2.png) [@Phuturist](https://community.homey.app/u/Phuturist)\
**Post date:** [January 4, 2019, 3:00pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/85 "2019-01-04T15:00:32Z")

</div>

> [@robertklep](#):
>
> Never mind, you also create just one. In that case, if someone wants to be able to address a relay _as if it’s a separate device_ , creating a virtual device seems to make sense. Perhaps, although I’ve never looked at it, you could share the `measure_power` capability between those two virtual devices.

I’m afraid sharing the measure\_power would mean both virtual devices having to poll the actual device causing excessive traffic to the device. This dilemma made me choose for using two custom onoff capabilities with one device. But I’ll think it over some more.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 4, 2019, 3:37pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/86 "2019-01-04T15:37:58Z")

</div>

If you have a trigger flow (“measured power has changed”), you would set the `measure_power` capability of both virtual devices to that value. I don’t think there’s any polling involved (fwiw, I’m talking about the Virtual Devices app and v1.5, don’t know if things are different on v2).

---

<div class="post-metadata">

**Author:** ![Phuturist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/phuturist/32/49_2.png) [@Phuturist](https://community.homey.app/u/Phuturist)\
**Post date:** [January 4, 2019, 5:17pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/87 "2019-01-04T17:17:11Z")

</div>

> [@robertklep](#):
>
> If you have a trigger flow (“measured power has changed”), you would set the `measure_power` capability of both virtual devices to that value. I don’t think there’s any polling involved (fwiw, I’m talking about the Virtual Devices app and v1.5, don’t know if things are different on v2).

The current driver polls the Shelly2 device at a specified frequency which reads out the current usage and upstates the measure\_power capability. To my understanding splitting the onoff capability over two separate devices would create two instances of the driver and thus poll the Shelly2 twice as well.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 4, 2019, 6:01pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/88 "2019-01-04T18:01:48Z")

</div>

I think that we might be talking langs elkaar heen 😉

From what I understand, the current app creates one device for a Shelly2, and that device has two (custom) `onoff` capabilities, and also one `measure_power` capability.

Because of those custom `onoff` caps, it’s not possible to use voice commands to switch the relays.

That problem can, from what I know, be solved (by the user, not by you) by creating two virtual devices (class “light”, capabilities “onoff” and “measure\_power”).

Those virtual devices, created with the Virtual Devices app, can have their capabilities set in flows, by triggering on “a relay has changed state” (I assume that your app provides a similar trigger?) and changing the state of the virtual device, and also vice versa, where a change of the virtual device switches one of the Shelly relays (again, this would require action cards in your app).

As for `measure_power`, you would do something similar, but only one way: trigger on a change of the measured power (and again, this would require your app to provide a trigger for that) and setting the virtual devices capabilities.

If you _do_ consider creating two devices for one Shelly2, you could consider handling all communications from `driver.js` instead of `device.js`. I do something similar for the Sonoff app: instead of creating a new MQTT connection for each device, I create a connection for each _broker_, and let the driver find the correct device to pass the incoming data to.

---

<div class="post-metadata">

**Author:** ![Phuturist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/phuturist/32/49_2.png) [@Phuturist](https://community.homey.app/u/Phuturist)\
**Post date:** [January 4, 2019, 6:18pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/89 "2019-01-04T18:18:20Z")

</div>

Ah right, thanx for the clear explanation.

@LinaN, the method mentioned by Robert above is indeed a way to get the voice commands to work with the Shelly2 devices. It does require an extra app called Virtual Devices and some flows that keep the virtual devices and the two Shelly2 relays in sync.

---

<div class="post-metadata">

**Author:** ![LinaN](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/linan/32/3562_2.png) [@LinaN](https://community.homey.app/u/LinaN)\
**Post date:** [January 4, 2019, 10:43pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/90 "2019-01-04T22:43:12Z")

</div>

That was a creative work-around, it works. 🙃 The virtual device is classified as a light and is responding to voice commands as it should.  
Thank you @robertklep

@Phuturist I know you said it probably won’t happen, but I secretly wish for a future upgrade of the app where it’s possible to classify the device and address each relay directly.  
Perhaps someone in the community might be willing to assist in developing these features…? 🤞  
Thank you for all your help!

---

<div class="post-metadata">

**Author:** ![Eduardo\_Rodriguez](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eduardo_rodriguez/32/1902_2.png) [@Eduardo\_Rodriguez](https://community.homey.app/u/Eduardo_Rodriguez)\
**Post date:** [January 6, 2019, 3:52pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/91 "2019-01-06T15:52:09Z")

</div>

Hello,  
Some progress in the investigation of the status of opening/close in percentage?

---

<div class="post-metadata">

**Author:** ![Phuturist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/phuturist/32/49_2.png) [@Phuturist](https://community.homey.app/u/Phuturist)\
**Post date:** [January 6, 2019, 4:29pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/92 "2019-01-06T16:29:39Z")

</div>

> [@Eduardo\_Rodriguez](#):
>
> Some progress in the investigation of the status of opening/close in percentage?

Not much, you can follow it here: [windowcoverings\_set capability is invalid · Issue #24 · athombv/homey-apps-sdk-issues · GitHub](https://github.com/athombv/homey-apps-sdk-issues/issues/24)

---

<div class="post-metadata">

**Author:** ![Eduardo\_Rodriguez](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eduardo_rodriguez/32/1902_2.png) [@Eduardo\_Rodriguez](https://community.homey.app/u/Eduardo_Rodriguez)\
**Post date:** [January 17, 2019, 11:21am UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/93 "2019-01-17T11:21:06Z")

</div>

Hello!

Yesterday update homey to version 2.0, everything seemed normal but the timer in the flows has stopped working, only opens or closes the shutter at 0 or 100%, does not respect the allotted time.

I imagine that it will be a problem of the homey itself. There are chances that the version with percentage opening will work in homey 2.0?

---

<div class="post-metadata">

**Author:** ![Phuturist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/phuturist/32/49_2.png) [@Phuturist](https://community.homey.app/u/Phuturist)\
**Post date:** [January 17, 2019, 2:42pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/94 "2019-01-17T14:42:34Z")

</div>

> [@Eduardo\_Rodriguez](#):
>
> I imagine that it will be a problem of the homey itself. There are chances that the version with percentage opening will work in homey 2.0?

I can’t image that its related to the Homey version but there is no way for me to test it. Have you recently upgraded the firmware of your Shelly2? I’m not on 2.x and don’t have a Shelly 2. I could create a debug version on GitHub which you can run from the command line to see what is going on. Are you comfortable with this?

---

<div class="post-metadata">

**Author:** ![Eduardo\_Rodriguez](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eduardo_rodriguez/32/1902_2.png) [@Eduardo\_Rodriguez](https://community.homey.app/u/Eduardo_Rodriguez)\
**Post date:** [January 17, 2019, 3:30pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/95 "2019-01-17T15:30:17Z")

</div>

Don’t update shelly firmware, it’s the same last few weeks, no problem whit CLI.

Waiting for your new version.

---

<div class="post-metadata">

**Author:** ![Phuturist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/phuturist/32/49_2.png) [@Phuturist](https://community.homey.app/u/Phuturist)\
**Post date:** [January 17, 2019, 9:21pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/96 "2019-01-17T21:21:51Z")

</div>

> [@Eduardo\_Rodriguez](#):
>
> Waiting for your new version.

Run this from command line (`athom app run`): [GitHub - jghaanstra/cloud.shelly: Homey app to control Shelly Cloud devices](https://github.com/jghaanstra/cloud.shelly)

Let me know what the output on the console says when you try to set the blinds with a specific duration.

---

<div class="post-metadata">

**Author:** ![Eduardo\_Rodriguez](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eduardo_rodriguez/32/1902_2.png) [@Eduardo\_Rodriguez](https://community.homey.app/u/Eduardo_Rodriguez)\
**Post date:** [January 17, 2019, 11:51pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/97 "2019-01-17T23:51:37Z")

</div>

This is the log that i get (2 roller shutters in the flow):

changing roller shutter with duration: undefined  
changing roller shutter with duration: undefined  
{ state: ‘open’,  
power: 253.39,  
is\_valid: true,  
safety\_switch: false,  
stop\_reason: ‘normal’,  
last\_direction: ‘open’,  
current\_pos: 0,  
calibrating: false,  
positioning: true }  
{ state: ‘open’,  
power: 179.57,  
is\_valid: true,  
safety\_switch: false,  
stop\_reason: ‘normal’,  
last\_direction: ‘open’,  
current\_pos: 0,  
calibrating: false,  
positioning: true }

The cards are setting whit 13 seconds.

When i run the command get some errors:

{ state: ‘stop’,  
power: 1.14,  
is\_valid: true,  
safety\_switch: false,  
stop\_reason: ‘normal’,  
last\_direction: ‘close’,  
current\_pos: 0,  
calibrating: false,  
positioning: true }  
{ state: ‘stop’,  
power: 0,  
is\_valid: true,  
safety\_switch: false,  
stop\_reason: ‘normal’,  
last\_direction: ‘close’,  
current\_pos: 0,  
calibrating: false,  
positioning: true }  
(node:23320) UnhandledPromiseRejectionWarning: Error: invalid\_capability  
at Object.JSON.parse (/opt/homey-client/system/helpers/jsonfns.js:1:1190)  
at JSON.parse ()  
at jsonToObject (/opt/homey-client/system/helpers/jsonfns.js:1:1083)  
at function.e.data.map.e (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1379)  
at Array.map ()  
at HomeyClient.\_onMessage (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1372)  
at emitTwo (events.js:126:13)  
at process.emit (events.js:214:7)  
at emit (internal/child\_process.js:762:12)  
at \_combinedTickCallback (internal/process/next\_tick.js:142:11)  
(node:23320) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)  
(node:23320) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.  
(node:23320) UnhandledPromiseRejectionWarning: Error: invalid\_capability  
at Object.JSON.parse (/opt/homey-client/system/helpers/jsonfns.js:1:1190)  
at JSON.parse ()  
at jsonToObject (/opt/homey-client/system/helpers/jsonfns.js:1:1083)  
at function.e.data.map.e (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1379)  
at Array.map ()  
at HomeyClient.\_onMessage (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1372)  
at emitTwo (events.js:126:13)  
at process.emit (events.js:214:7)  
at emit (internal/child\_process.js:762:12)  
at \_combinedTickCallback (internal/process/next\_tick.js:142:11)  
(node:23320) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![Phuturist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/phuturist/32/49_2.png) [@Phuturist](https://community.homey.app/u/Phuturist)\
**Post date:** [January 18, 2019, 6:57am UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/98 "2019-01-18T06:57:12Z")

</div>

> [@Eduardo\_Rodriguez](#):
>
> This is the log that i get (2 roller shutters in the flow):

Strange, are you sure you have entered the duration as a number in the action card? You might try adding the card again. Perhaps something changed during the firmware upgrade.

I have also updated the Github repo with extra debug logging. Could you try again and let me know the outcome.

> **[GitHub - jghaanstra/cloud.shelly: Homey app to control Shelly Cloud devices](https://github.com/jghaanstra/cloud.shelly)**
>
> Homey app to control Shelly Cloud devices. Contribute to jghaanstra/cloud.shelly development by creating an account on GitHub.

[EDIT] once this issue is resolved I would like to as you to test the functionality of setting the blinds in percentage on firmware 2.x. Athom just closed my bug report about this capability because appearantly they do not support issues on 1.5.x anymore. So I need to know if this issue is also present on firmware 2.x. I will need to upload another version on github and you would have to repair your shelly2 as roller shutter while running the app from the command line. Would you help me out with this?

---

<div class="post-metadata">

**Author:** ![Eduardo\_Rodriguez](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eduardo_rodriguez/32/1902_2.png) [@Eduardo\_Rodriguez](https://community.homey.app/u/Eduardo_Rodriguez)\
**Post date:** [January 18, 2019, 11:09am UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/99 "2019-01-18T11:09:22Z")

</div>

> [@Phuturist](#):
>
> Strange, are you sure you have entered the duration as a number in the action card? You might try adding the card again. Perhaps something changed during the firmware upgrade.
> 
> I have also updated the Github repo with extra debug logging. Could you try again and let me know the outcome.

Yes, not touched the flow and work perfect, after homey update the blinds open to 100%, ignoring the time of action card. Try to remake a new flow and the same result.

Test the new app:

changing roller shutter with duration: undefined  
{ direction: ‘close’,  
device:  
Shelly2RollerShutterDevice {  
domain: null,  
\_events:  
{ \_\_capability: [Function: bound \_\_onCapability],  
\_\_renamed: [Function: bound \_\_onRenamed],  
\_\_settings: [Function: bound \_\_onSettings],  
\_\_added: [Function: bound \_\_onAdded],  
\_\_deleted: [Function: bound \_\_onDeleted],  
\_\_init: [Function: bound \_\_onInit],  
\_\_log: [Function: bound],  
\_\_error: [Function: bound],  
\_\_debug: [Function: bound] },  
\_eventsCount: 9,  
\_maxListeners: undefined,  
pollingInterval:  
Timeout {  
\_called: true,  
\_idleTimeout: 5000,  
\_idlePrev: [Object],  
\_idleNext: [Object],  
\_idleStart: 137580,  
\_onTimeout: [Function],  
\_timerArgs: undefined,  
\_repeat: 5000,  
\_destroyed: false,  
[Symbol(asyncId)]: 95,  
[Symbol(triggerAsyncId)]: 90 },  
[Symbol()]:  
Shelly2RollerShutterDriver {  
domain: null,  
\_events: [Object],  
\_eventsCount: 9,  
\_maxListeners: undefined,  
id: ‘shelly2-rollershutter’,  
[Symbol()]: [Object],  
[Symbol()]: [Object],  
[Symbol()]: [Array],  
[Symbol()]: [Object],  
[Symbol()]: true,  
[Symbol()]: [Array] },  
[Symbol()]: { emit: [Function: emit] },  
[Symbol()]: true,  
[Symbol()]: ,  
[Symbol()]: { id: ‘CE50E355A57A’ },  
[Symbol()]: { windowcoverings\_state: ‘idle’, measure\_power: 0 },  
[Symbol()]: true,  
[Symbol()]: ‘Persiana Grande’,  
[Symbol()]: ‘windowcoverings’,  
[Symbol()]: [‘windowcoverings\_state’, ‘measure\_power’],  
[Symbol()]:  
{ address: ‘192.168.1.162’,  
username: ‘XXXXX’,  
password: ‘XXXXX’,  
polling: 5 },  
[Symbol()]: {},  
[Symbol()]: ‘18a538b7-69db-4dc7-a60e-0c1742447d84’,  
[Symbol()]:  
{ windowcoverings\_state: [Function: bound onCapabilityWindowcoveringsState] },  
[Symbol()]: false } }

But now i can see that homey knows the position:

**current\_pos: 29,**

And is the same as shelly app position.

> [@Phuturist](#):
>
> [EDIT] once this issue is resolved I would like to as you to test the functionality of setting the blinds in percentage on firmware 2.x. Athom just closed my bug report about this capability because appearantly they do not support issues on 1.5.x anymore. So I need to know if this issue is also present on firmware 2.x. I will need to upload another version on github and you would have to repair your shelly2 as roller shutter while running the app from the command line. Would you help me out with this?

Of course i help you.

---

<div class="post-metadata">

**Author:** ![Phuturist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/phuturist/32/49_2.png) [@Phuturist](https://community.homey.app/u/Phuturist)\
**Post date:** [January 18, 2019, 12:18pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/100 "2019-01-18T12:18:20Z")

</div>

> [@Eduardo\_Rodriguez](#):
>
> But now i can see that homey knows the position:

It seems that the action card is not passing on the duration argument from the action card to the function that handles the change in position for that specified duration. As this used to work just fine on 1.5.x I’m not sure if I can actually fix this within my app. To me it seems as a bug in Homey itself. Could you post a screenshot from the Homey app where you configure this action card, perhaps that tells me what might be wrong.

About the current position. I’m already updating the current position from the Shelly device to Homey but there is an issue with adding this capability to the device. That’s exactly why I can use your help testing this further once I have tackled the above issue.

[Previous page](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765.md?page=4)

[Next page](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765.md?page=6)
