Porting smartswitch plugin to openLuup

Hey folks…

I would really need some help to port the smartswitch plugin to openLuup!

The first error I got just after the install:

an error occurred while displaying the javascript tab. devid: 0-203 err:deviceIdsJSON.replace is not a function
stack:TypeError: deviceIdsJSON.replace is not a function
    at ss_getDeviceIdsSetting (J_SmartSwitch1.js:100:32)
    at ss_removeUsedDevices (J_SmartSwitch1.js:76:18)
    at ss_deviceSelectDropdown (J_SmartSwitch1.js:122:12)
    at ss_showSettings (J_SmartSwitch1.js:37:15)
    at eval (eval at _deviceDrawControlPanelJSTab (http://XXXX/port_3480/J_ALTUI_uimgr.js:2714:17), :1:1)
    at _deviceDrawControlPanelJSTab (http://XXXX/port_3480/J_ALTUI_uimgr.js:2714:17)
    at _deviceDrawControlPanelOneTabContent (http://XXXX/port_3480/J_ALTUI_uimgr.js:3226:8)
    at _displayActiveDeviceTab (http://XXXX/port_3480/J_ALTUI_uimgr.js:3253:4)
    at HTMLAnchorElement. (http://XXXX/port_3480/J_ALTUI_uimgr.js:6204:4)
    at HTMLDivElement.dispatch (http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:3:10316)

Would really like to have it on openLuup…

Anyone want some $$ to made that ? :wink:

@AK ? @Vosmont ? @amg0 ? :wink:

Sorry, but I haven’t a clue about JavaScript…

[quote=“DesT, post:1, topic:197671”]Hey folks…

I would really need some help to port the smartswitch plugin to openLuup!

The first error I got just after the install:

an error occurred while displaying the javascript tab. devid: 0-203 err:deviceIdsJSON.replace is not a function
stack:TypeError: deviceIdsJSON.replace is not a function
    at ss_getDeviceIdsSetting (J_SmartSwitch1.js:100:32)
    at ss_removeUsedDevices (J_SmartSwitch1.js:76:18)
    at ss_deviceSelectDropdown (J_SmartSwitch1.js:122:12)
    at ss_showSettings (J_SmartSwitch1.js:37:15)
    at eval (eval at _deviceDrawControlPanelJSTab (http://XXXX/port_3480/J_ALTUI_uimgr.js:2714:17), :1:1)
    at _deviceDrawControlPanelJSTab (http://XXXX/port_3480/J_ALTUI_uimgr.js:2714:17)
    at _deviceDrawControlPanelOneTabContent (http://XXXX/port_3480/J_ALTUI_uimgr.js:3226:8)
    at _displayActiveDeviceTab (http://XXXX/port_3480/J_ALTUI_uimgr.js:3253:4)
    at HTMLAnchorElement. (http://XXXX/port_3480/J_ALTUI_uimgr.js:6204:4)
    at HTMLDivElement.dispatch (http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:3:10316)[/quote]

it depends what ‘crazy’ things this plugin does. can you tell me where to find the files of this plugin and I ll give it a try
from what I see in the stack the variable deviceIdsJSON is probably null hence the crash in ALTUI. depending on what it is we may or may not be able to find a fix
please also note that workflow would offer an alternative to smartswitch

Here’s a backup of the files…

amg0,

I know that workflow can do that… but one thing I like from smartswitch it’s you create one smartswitch PER device you want and you can play with the dimmer % and also the duration from any scene…

So for example… during the evening, I put some light in smartswitch mode with a 100% load with a couple of minutes …but during night mode, I changed them to be at 10% with 30 seconds. Not sure I will be able to do all that with workflow?!

With smartswitch, you can do all that with a couple of clicks and it works fine!

[quote=“DesT, post:6, topic:197671”]amg0,

I know that workflow can do that… but one thing I like from smartswitch it’s you create one smartswitch PER device you want and you can play with the dimmer % and also the duration from any scene…

So for example… during the evening, I put some light in smartswitch mode with a 100% load with a couple of minutes …but during night mode, I changed them to be at 10% with 30 seconds. Not sure I will be able to do all that with workflow?!

With smartswitch, you can do all that with a couple of clicks and it works fine![/quote]

yes absolutely ,workflow would do that easily too.

States:

  1. day mode : action light down to 0%
  2. night mode :action light up to 100%
  3. Dimmed mode :action dim down to 10%

Transitions
1 <=> 2 : transitions according to DayNight plugin variable status changes
2 => 3 : transition according to a timer 10sec

[quote=“amg0, post:7, topic:197671”][quote=“DesT, post:6, topic:197671”]amg0,

I know that workflow can do that… but one thing I like from smartswitch it’s you create one smartswitch PER device you want and you can play with the dimmer % and also the duration from any scene…

So for example… during the evening, I put some light in smartswitch mode with a 100% load with a couple of minutes …but during night mode, I changed them to be at 10% with 30 seconds. Not sure I will be able to do all that with workflow?!

With smartswitch, you can do all that with a couple of clicks and it works fine![/quote]

yes absolutely ,workflow would do that easily too.

States:

  1. day mode : action light down to 0%
  2. night mode :action light up to 100%
  3. Dimmed mode :action dim down to 10%

Transitions
1 <=> 2 : transitions according to DayNight plugin variable status changes
2 => 3 : transition according to a timer 10sec[/quote]

amg0,

do you mind sharing a working example to understand how to do that…

A real life example from smartswitch for me was:

During day: nothing happen
Evening: OFF at 20%, ON with motion at 60% (5 mins delay)
Night: OFF at 0%, ON at 10% with motion (30 secs delay)

[quote=“DesT, post:9, topic:197671”]A real life example from smartswitch for me was:

During day: nothing happen
Evening: OFF at 20%, ON with motion at 60% (5 mins delay)
Night: OFF at 0%, ON at 10% with motion (30 secs delay)[/quote]

Have you seen examples here ? http://forum.micasaverde.com/index.php/topic,37746.0.html
Some are relatively close to your needs

Yeah already check that but looks way easier with smartswitch when you have a lot of “smart switch” to create :frowning:

Like I said, I more than open to $$ someone to make it works…

Hi DesT,

I think this version should work. It should also fully work on UI7. It does not work on UI5 in this setup. Can you do some testing and let me know?

Cheers Rene

Ohhhhhh My god reneboer :wink:

looks awesome. At least it’s installing… :wink:

I will create some device and let you know later!

thanks again!

reneboer,

As for now, it seem to be working fine.

Will run it for a couple of days to see!

And of course, as I said, let me know how much you want for that fix :wink:

Hi Dest,

Glad it is working. I am looking at a scenario for the plugin as well and the fix was not that hard to do as I have several plugins developed and much of the code snippets available. Also the LUA code used for it seems quite solid, maybe even too, so I learned a few things again.

I’ll send hugheaves a message on making the updates to the published plugin if he is interested. Else I’ll ask if it is ok to put this one on the openLuup App store.

Cheers Rene

It will be nice if someone can continue to develop this plugin with some new features!

EDIT: Like having in the dropdown list of devices, the room in ( ) so it can be easier to select the right devices when you have too many :wink:
EDIT: Or being able to activate a smartswitch only with a specific House Mode…

Agreed. Waiting on a reply. Hugheaves has not been active on the forum since this summer, so not sure if there will be a reply.

Cheers Rene

reneboer,

not sure if it’s related… but since I’m using smartswitch on openLuup to handle “smart lights” on my vera… I’m having a bunch of LUUP restart on my veraplus… and looks like that when it happen, it’s when smartswitch on openLuup send a command to open a light on my vera…

Hi Dest,

Not good but not impossible either. Can you send me some log files to see what is happening? Either send me a PM for email exchange or PM me a link on google docs. I will go over the different files as I know that UI5 was more tolerant to some items missing from the definition files than UI7 seems to be.

Cheers Rene

Let me grab the openLuup log when that happen again!