# \[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:** 4

<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:** [December 29, 2018, 3:50pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/61 "2018-12-29T15:50:01Z")

</div>

> [@Eduardo\_Rodriguez](#):
>
> If open homey in browser, in console nothing happens when add the device.
> 
> when you talk about the synchronization is it because homey knows what percentage are the blinds open now?

I have uploaded a new version to Github which should at least fix the error shown in the CLI log. Could you try re-adding the Shelly2 again.

Yes, Homey should now also know which percentage the blinds are at even when it’s controlled by the Shelly app or manually.

---

<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:** [December 29, 2018, 4:03pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/62 "2018-12-29T16:03:39Z")

</div>

@Phuturist

Tested new version. Can’t add device yet.

log:

2018-12-29 17:04:05 [log] [ManagerDrivers] [shelly2-rollershutter] [0] current blinds position is 0  
(node:19516) UnhandledPromiseRejectionWarning: Error: invalid\_capability  
at Object. (/opt/homey-client/system/manager/ManagerApps/jsonfns.js:1:1103)  
at JSON.parse ()  
at Object.jsonToObject (/opt/homey-client/system/manager/ManagerApps/jsonfns.js:1:1001)  
at function.e.apply.s.args.map.s (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1401)  
at Array.map ()  
at HomeyClient.\_onMessage (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1386)  
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)

I see the possition of blind in the log, and is correct, (is totally closed, now i can’t open the blinds, my wife and son are sleeping)

---

<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:** [December 29, 2018, 4:22pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/63 "2018-12-29T16:22:11Z")

</div>

> [@Eduardo\_Rodriguez](#):
>
> I see the possition of blind in the log, and is correct, (is totally closed, now i can’t open the blinds, my wife and son are sleeping)

Just did another commit, hopefully that allows you to pair the device.

---

<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:** [December 29, 2018, 4:42pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/64 "2018-12-29T16:42:46Z")

</div>

@Phuturist, update and same thing. Delete other shelly2 and the log is diferent:

2018-12-29 17:37:01 [log] [ShellyApp] Initializing Shelly App …  
testConnection succes  
{ type: ‘SHSW-21’,  
mac: ‘827D3A5B270D’,  
auth: false,  
fw: ‘20181228-125308/v1.4.3@083c8385’,  
num\_outputs: 2,  
num\_meters: 1,  
num\_rollers: 1 }  
testConnection succes  
{ type: ‘SHSW-21’,  
mac: ‘CE50E355A57A’,  
auth: false,  
fw: ‘20181228-125308/v1.4.3@083c8385’,  
num\_outputs: 2,  
num\_meters: 1,  
num\_rollers: 1 }

---

<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:** [December 29, 2018, 7:08pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/65 "2018-12-29T19:08:16Z")

</div>

> [@Eduardo\_Rodriguez](#):
>
> update and same thing.

Really weird. Does not seem to be related to the code changes I have made though. I have not changed anything in pairing of the device. Could you try running it with the following command `athom app run --clean`. And perhaps first reboot Homey, just to make sure.

---

<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:** [December 29, 2018, 8:24pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/66 "2018-12-29T20:24:05Z")

</div>

Could something be failing in the pairing template? It looks like the code doesn’t reach `Homey.addDevice` for some reason.

The desktop app has a option _“View \> Toggle Developer Tools”_ that shows a JS console.

---

<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:** [December 29, 2018, 9:18pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/67 "2018-12-29T21:18:28Z")

</div>

> [@robertklep](#):
>
> Could something be failing in the pairing template? It looks like the code doesn’t reach `Homey.addDevice` for some reason.
> 
> The desktop app has a option _“View \> Toggle Developer Tools”_ that shows a JS console.

According to @Eduardo_Rodriguez the developer console did not show any output as well. I’m pretty lost on what this could be. My guess is that there is somehow a duplicate device still registered with the same ID (MAC address of the device) and it therefor can’t add the device. Running it clean might fix that.

---

<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:** [December 29, 2018, 9:38pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/68 "2018-12-29T21:38:21Z")

</div>

@Phuturist

I uninstall shelly app and restart homey. Fresh install and same thing when add a shelly 2 device. Same log whit “athom app run --clean”.

I have 4 shelly 1, and i can add them whitout problems.

I see the video in slow motion and the result when add the device is ok:

![added](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/6/6d3b76a392198794d2ead0f4ac6b0fe26b2205a2.jpeg)

@robertklep apparently this console shows the same thing that browser console: nothing.

---

<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:** [December 29, 2018, 9:43pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/69 "2018-12-29T21:43:05Z")

</div>

Do you use something like `getDevice({ id })` in the driver to check if there’s already a device with that id registered?

---

<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:** [December 29, 2018, 9:58pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/70 "2018-12-29T21:58:59Z")

</div>

@robertklep

I don’t know how to do this. My level of programing is 0.

But if in case there was a repeated id, why the shelly 1 let me add them without problem? Only can’t add a the shelly 2 devices.🙄

---

<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:** [December 29, 2018, 9:59pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/71 "2018-12-29T21:59:58Z")

</div>

Don’t worry, I was asking @Phuturist 🙂

---

<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:** [December 29, 2018, 11:48pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/72 "2018-12-29T23:48:59Z")

</div>

> [@robertklep](#):
>
> Do you use something like `getDevice({ id })` in the driver to check if there’s already a device with that id registered?

No, never had to. But seeying that Eduardo sees the ‘Shelly device added succesfully’ message in the pairing wizard indicates that the Homey.addDevice({}) function has been executed succesfully and my inital guess that it might be a duplicate device id seems off anyway. Anything that happens after this function is Homey core. I really have no clue on what could cause this.

I have uploaded some changes that will output something on the browser console (F12 in Chrome) when pairing. Could you check that @Eduardo_Rodriguez .

---

<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:** [December 30, 2018, 12:11am UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/73 "2018-12-30T00:11:40Z")

</div>

@Phuturist

In F12 get 2 errors:

invalid\_capability VM269:83  
null VM269:87

Lines 83 to 87:

```
      console.log(error);
				$('.shelly-error').show();
				$('.shelly-error-msg').html(error.message || error.toString() );
			}
    console.log(result);
			$('.shelly-test').hide();
			$('.shelly-error').hide();
			$('.shelly-ok').show();

			Homey.done();
		})

```

In “athom app run” a lot of log is reported:

(node:28582) UnhandledPromiseRejectionWarning: Error: invalid\_capability  
at Object. (/opt/homey-client/system/manager/ManagerApps/jsonfns.js:1:1103)  
at JSON.parse ()  
at Object.jsonToObject (/opt/homey-client/system/manager/ManagerApps/jsonfns.js:1:1001)  
at function.e.apply.s.args.map.s (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1401)  
at Array.map ()  
at HomeyClient.\_onMessage (/opt/homey-client/system/manager/ManagerApps/bootstrap/sdk/v2/lib/HomeyClient.js:1:1386)  
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:28582) 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:28582) [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.

---

<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:** [December 30, 2018, 8:03am UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/74 "2018-12-30T08:03:08Z")

</div>

This code misses a `Homey.done(); return;` inside the `if (error)` block.

```auto
if (error) {
  $('.shelly-error').show();
  $('.shelly-error-msg').html(error.message || error.toString() );
}
$('.shelly-test').hide();
$('.shelly-error').hide();
$('.shelly-ok').show();

Homey.done();

```

If there’s an error, `.shelly-error` is shown, but because there’s no return, it gets hidden again and `.shelly-ok` is shown.

---

<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:** [December 30, 2018, 9:46am UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/75 "2018-12-30T09:46:08Z")

</div>

> [@Eduardo\_Rodriguez](#):
>
> In F12 get 2 errors:
> 
> invalid\_capability VM269:83  
> null VM269:87

Well, then my only conclusion is that the API documentation from Athom is incorrect. I’m using a capability called windowcoverings\_set which should allow you to set the postion by percentage but this error indicates that it’s not a valid capability. I’ll ask Athom about it.

> [@robertklep](#):
>
> This code misses a `Homey.done(); return;` inside the `if (error)` block

Thanx, I’ll fix that.

---

<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, 5:48pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/76 "2019-01-03T17:48:04Z")

</div>

Hi,

I’m wondering if anyone has managed to control Shelly 2 using the built in voice commands in Homey 1.x? (not using Shelly cloud.) When I ask my Shelly 2 to switch off, Homey responds saying “I didn’t find any sockets to turn off”. Is it possible to get this to work?

It would also be nice to “tag” the switch as light so it turns off, as my Fibaro dimmer 2 and Hue lights does, when I ask Homey to turn off all lights or a specific zone. Anyone who has managed to integrate a Shelly 2 relay like that?

If I build a flow with a specific voice command to turn on/off the relay it works fine. But I’m not sure if that is a good solution for a full house. If I can get Shelly to work well with Homey I plan to install this relay behind all my wall switches in the house.

Anyone with experience from Shelly 2 that has any good advice or tips?

Thanks in advance

---

<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 3, 2019, 5:54pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/77 "2019-01-03T17:54:59Z")

</div>

> [@LinaN](#):
>
> I’m wondering if anyone has managed to control Shelly 2 using the built in voice commands in Homey 1.x? (not using Shelly cloud.) When I ask my Shelly 2 to switch off, Homey responds saying “I didn’t find any sockets to turn off”. Is it possible to get this to work?

This should be possible. If you are still on firmware 1.5.x you could try looking at the speech input and output pages to see what Homey actually hears or test the command by typing it in manually.

http://[ip]/manager/speech-input/  
http://[ip]/manager/speech-output/

> [@LinaN](#):
>
> It would also be nice to “tag” the switch as light so it turns off, as my Fibaro dimmer 2 and Hue lights does, when I ask Homey to turn off all lights or a specific zone. Anyone who has managed to integrate a Shelly 2 relay like that?

Not sure if it’s possible to change the device class upon pairing but I’ll have a look at it.

---

<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 3, 2019, 6:33pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/78 "2019-01-03T18:33:20Z")

</div>

> [@Phuturist](#):
>
> Not sure if it’s possible to change the device class upon pairing but I’ll have a look at it.

Yes, that’s possible (see the VD app for an example).

---

<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, 6:43pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/79 "2019-01-03T18:43:46Z")

</div>

> [@Phuturist](#):
>
> This should be possible. If you are still on firmware 1.5.x you could try looking at the speech input and output pages to see what Homey actually hears or test the command by typing it in manually.
> 
> http://[ip]/manager/speech-input/  
> http://[ip]/manager/speech-output/

I’ve tried all possible commands that I can think of by looking at the recognized speech command, but no luck. I’ve named my Shelly 2 device to “Lamp 2” in Homey. And for example I tried the command “Turn on Lamp 2” the reply I get is “I can’t find sockets to turn on”.

Has anyone else managed to get this to work?

Does the device have be classified as a “light” for the voice command to work? (I have no idea how this works so please excuse if this is a strange question.)

---

<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 3, 2019, 9:26pm UTC](https://community.homey.app/t/app-shelly-smart-solutions-for-every-home-and-office/765/80 "2019-01-03T21:26:06Z")

</div>

> [@LinaN](#):
>
> I’ve tried all possible commands that I can think of by looking at the recognized speech command, but no luck. I’ve named my Shelly 2 device to “Lamp 2” in Homey. And for example I tried the command “Turn on Lamp 2” the reply I get is “I can’t find sockets to turn on”.
> 
> Has anyone else managed to get this to work?

I think I know what is going on. The Shelly 2 has two relays and I implemented them with a custom capability. Therefor the default onoff capability is not used and the corresponding voice commands wont work either. I’m sorry to say but I have no plans of changing this as that would create other difficulties that are beyond my programming skills. Changing the device class to light probably wont fix this either. Maybe, just maybe when I have a lot of free time I’ll try and find out how to pair each relay as seperate device but dont count on it.

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

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