Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selector switch level names not supported #21

Open
dwmw2 opened this issue May 12, 2018 · 14 comments
Open

Selector switch level names not supported #21

dwmw2 opened this issue May 12, 2018 · 14 comments

Comments

@dwmw2
Copy link
Contributor

dwmw2 commented May 12, 2018

Here's a selector switch as reported by json.htm?type=devices:

      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 5,
         "Data" : "Set Level: 100 %",
         "Description" : "",
         "DimmerType" : "none",
         "Favorite" : 0,
         "HardwareID" : 6,
         "HardwareName" : "Onkyo",
         "HardwareType" : "Onkyo AV Receiver (LAN)",
         "HardwareTypeVal" : 104,
         "HaveDimmer" : true,
         "HaveGroupCmd" : true,
         "HaveTimeout" : false,
         "ID" : "00000008",
         "Image" : "Amplifier",
         "IsSubDevice" : false,
         "LastUpdate" : "2018-05-12 06:45:59",
         "Level" : 100,
         "LevelActions" : "Off|10|01|02|05|03|25|24|23|22|2b|29|2e",
         "LevelInt" : 100,
         "LevelNames" : "Off|Bluray|Sky+ HD|Wii|Chromecast|Aux DVI|AM|FM|TV/CD|HDMI cable|NET|USB|BLUETOOTH",
         "LevelOffHidden" : true,
         "MaxDimLevel" : 100,
         "Name" : "Lounge source",
         "Notifications" : "false",
         "PlanID" : "12",
         "PlanIDs" : [ 12 ],
         "Protected" : false,
         "SelectorStyle" : 1,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "Status" : "Set Level: 100 %",
         "StrParam1" : "",
         "StrParam2" : "",
         "SubType" : "Selector Switch",
         "SwitchType" : "Selector",
         "SwitchTypeVal" : 18,
         "Timers" : "false",
         "Type" : "Light/Switch",
         "TypeImg" : "Light",
         "Unit" : 0,
         "Used" : 1,
         "UsedByCamera" : false,
         "XOffset" : "691",
         "YOffset" : "257",
         "idx" : "341"
      },

I can tell Alexa, "Set lounge source to 20" and it'll select the Sky+HD box. This is a slightly suboptimal user experience for anyone who doesn't know the levels. Can we make this work with the names from the LevelNames field?

@dwmw2 dwmw2 changed the title Selector switch not supported Selector switch level names not supported May 12, 2018
@dwmw2
Copy link
Contributor Author

dwmw2 commented May 12, 2018

@madgeni
Copy link
Owner

madgeni commented May 12, 2018

Hi -
are you still using alexa-domo, or is this a request for Controlicz?
If it's Controlicz, are your selector switches currently detected as Lights or Switches?

@Lyr3x
Copy link

Lyr3x commented May 12, 2018

Alexa recognises my selector switches as "Light/Switch".

@madgeni
Copy link
Owner

madgeni commented May 12, 2018

The issue with InputController is that it doesn't allow custom names, so alot of your LevelNames wouldn't be recognised -
https://forums.developer.amazon.com/questions/79376/inputselect-slot-type.html

@dwmw2
Copy link
Contributor Author

dwmw2 commented May 13, 2018

I am still using alexa-domo. Has the Alexa support in Controlicz moved on? Did anyone get OAuth2 working for Domoticz yet?

@madgeni
Copy link
Owner

madgeni commented May 13, 2018

Ok, i've been looking at this, but the main issue is the Domoticz API. In order to change a Selector Switch level, you call:
/json.htm?type=command&param=switchlight&idx=123&switchcmd=Set Level&level=0

In order to handle Level Names, i'll have to do a lookup, which will make an extra call, and slow the request down. Additionally, we're then relying on Alexa understanding your request cleanly enough for me to take that input and then match against your Level Names

@madgeni
Copy link
Owner

madgeni commented May 13, 2018

Alexa-domo is using the deprecated Alexa API, which will be end of life at some stage.
Controlicz is running against the latest version, and therefore has access to the latest functionality, as well as controls - for example, Alexa-domo can't use the InputController.

There is no OAUTH2 service in Domoticz, so you still have the same security issue, where I handle the tokens, and have to store (encrypted and hashed) your domoticz details.

@dwmw2
Copy link
Contributor Author

dwmw2 commented May 13, 2018

Is the Controlicz code available? I'm happy to hack in it to make improvements.. and less happy to use something I can't :)

Thanks for all your work on this!

@madgeni
Copy link
Owner

madgeni commented May 13, 2018

Hi -
afraid not, i made the decision when Amazon deprecated the last version to offer a service, rather than continue to support the open source version. i'd ended up supporting everyone's lambdas, configs - this way is better for most users (depending on security concerns). You can whitelist the Controlicz IP address.

@dwmw2
Copy link
Contributor Author

dwmw2 commented May 14, 2018

Do you still use Lambda for Controlicz? I can live with the security thing; if I give you a password for the "alexa" user in my Domoticz, that's fairly much equivalent to doing things "properly" with OAuth2. But I have been getting very annoyed with the Lambda first-time spinup recently as we've been adding more devices and using it more, so I was getting very tempted to add support directly into Domoticz itself for being invoked directly: https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-a-web-service.html

@dwmw2
Copy link
Contributor Author

dwmw2 commented May 14, 2018

Gr... except I don't think you can host anything except custom skills that way. Of course you ought to be able to host smart home skills on your local network and discover them with uPNP...

@madgeni
Copy link
Owner

madgeni commented May 14, 2018

yep, you can't run the smart home skill that way. Although you might be able to run the Smart Home skill on a lambda, which interacts with the IOT mqtt model, which your domoticz could work with. maybe.
I run Controlicz on a server, I handle the alexa interactions on a lambda however. It's tokenised between Alexa and Controlicz, then drops into the https call to your API - so you could whitelist Controlicz, provide a specific Alexa user on your Domoticz, which only has access to those devices you want Controlicz to see.

@dwmw2
Copy link
Contributor Author

dwmw2 commented May 15, 2018

Yeah, I already have a dedicated "Alexa" user. It's calling off-site to lambda that really bothers me, especially the first time. Maybe using yours would be better because I'd only suffer the 20-second Lambda spinup if none of your users have used Alexa in the last ten minutes. Rather than whenever my skill hasn't been used in the last ten minutes.

But still, it really sucks that Alexa won't talk directly to something over the local network. She does for Philips Hue! I'll go file an internal ticket and bitch about that... :)

@madgeni
Copy link
Owner

madgeni commented May 15, 2018

There's no obvious delay, given the nature of the lambda, it's unlikely that the lambda is constantly in action. I'm aware of the spinup issue with lambdas, but i'm not seeing it with Controlicz.
I think the Hue is a different case - I think the lights talk to the hub over it's proprietary protocol, but the hub talks to Alexa, which is definitely over the internet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants