Page 4 of 6

Re: Mode-selector / multistate device

Posted: Monday 25 January 2016 20:29
by StephaneG
Hello,

Indeed, fixed in 4312.

PS: the selector switch is not available in the current stable version, you need to switch to beta.

Regards,
--
Stéphane

Re: Mode-selector / multistate device

Posted: Tuesday 26 January 2016 13:49
by elmortero
Hi all,

I have created a selector with 3 states (Off, peak and high)
But when I want to set it from within Blockly these states are not available.
Already restarted domoticz, still not showing.

Does anyone know why?

Re: Mode-selector / multistate device

Posted: Tuesday 26 January 2016 14:01
by pj-r
elmortero wrote:Does anyone know why?
Use text blocky instead of switch mode blocky.

Re: Mode-selector / multistate device

Posted: Tuesday 26 January 2016 20:56
by deennoo
Is this possible to got selector switch for milight device please ?

This feature is really cool

Re: Mode-selector / multistate device

Posted: Wednesday 27 January 2016 9:36
by elmortero
That worked.
Thanks a lot

Re: Mode-selector / multistate device

Posted: Wednesday 27 January 2016 9:58
by pj-r
deennoo wrote:Is this possible to got selector switch for milight device please ?
Is Milight is already supported in domoticz?
If so just use this kinda simple blocky to control it with selector:

Code: Select all

If selector = somethign
  Set milight = somethingelse
else if selector = something2
  set milight = somethingselese2
.......
end if

Re: Mode-selector / multistate device

Posted: Wednesday 27 January 2016 20:02
by pluggin
JacquesMulders wrote:Works in v 2.4312 :)
:D
Thanks for the info!!

Re: Mode-selector / multistate device

Posted: Wednesday 27 January 2016 22:34
by deennoo
OK done thx for my Hyperion selector (milight isn't enought supported)

Re: Mode-selector / multistate device

Posted: Wednesday 27 January 2016 23:39
by StanHD
If it helps, for Milight, I made individual Scenes for each colour setting. Made a Selector with "Off", "Green", "Orange", "Violet". Made a Blockly that checks the selector and sets the matching scene. Works well.

Re: Mode-selector / multistate device

Posted: Thursday 28 January 2016 0:17
by Nautilus
Hi,

I'd like to combine my Harmony Activities to a selector switch but preferably so that existing functionality remains ( = does not matter whether you use the actual Harmony remote or switches in Domoticz to change the activity). So basically the individual switches would need to update the selector status and the selector status would need to update the individual switches which quite logically would create an endless loop. However, when testing this setup (out of curiosity of seeing what happens :) ) it actually worked quite well when just changing the activity (there was always an error in the log about harmony hub already changing the activity, which I assume was the result of the almost simultaneous effort of trying to do the same thing again, but apparently just once though, maybe there is some check to prevent it looping forever?). But when turning the system completely off it seemed to screw it up.

So the question would be if there are any ideas how I could get this working with the current selector switch functionality? Somehow it would need to be so that a change in activity switch only updates the selector to reflect the correct state ( = the selected activity) but the selector state update would not trigger an action in this specific case. An action would be however triggered from the selector switch when changing the status "with a button click" directly on the selector.

I know I'm able to update a light switch status without triggering the linked script with the api like On: url:port/json.htm?type=command&param=udevice&idx=47&nvalue=1&svalue=, Off: url:port/json.htm?type=command&param=udevice&idx=47&nvalue=0&svalue= Could something like this work with the selector and in that case, what would the syntax be to set the level?

Also, I was wondering would there be any point in adding a functionality to the selector switch that would allow you to map different switches directly to selector levels so that it would be a "collection of switches" of a sort? That would at least work with this kind of dependant switches like harmony activities where in any case only one of them is "On" at a time and others "Off". Or actually maybe I'm looking for altogether another type of "collector" switch that would just group a set of (dependant) switches together more tightly to tidy the user interface a bit. It would not need to include any other functionality than grouping the (dependant) switches nicely together the same way as this new selector switch is capable of doing...:)

Re: Mode-selector / multistate device

Posted: Thursday 28 January 2016 22:03
by robal_k
This is awesome, and I was waiting for this functionality for a long time.
I'm using LightwaveRF, and it uses one way radio, so Domoticz cannot possibly know change of state of a dimmer switch if it's operated by hand.
Selector can finally give me "on button and off button" feel, rather than toogling device twice.

The only issue is that it's a bit of a hassle to setup blockly to control LighwaveRF devices via Dummy Selector device.

It would super-great if it was possible to set Lighwave device to "Selector" type directly.
At the moment (2.4337) it breaks the device:

Re: Mode-selector / multistate device

Posted: Saturday 30 January 2016 10:38
by darknico31
EDIT :
Cache issue, nothing to see here :oops:
(not refreshing even with CTRL-F5)

Re: Mode-selector / multistate device

Posted: Wednesday 03 February 2016 12:11
by kurniawan77
[quote="Nautilus"][/quote]

@Nautilus

this works already with:

Code: Select all

/json.htm?type=command&param=udevice&idx=IDX&nvalue=1&svalue=30
nvalue=0 or 1 (on/off), svalue=LEVEL (0,10,20,30...)
with LUA:

Code: Select all

commandArray['UpdateDevice']='idx|nValue|sValue'

Re: Mode-selector / multistate device

Posted: Wednesday 03 February 2016 15:18
by Nautilus
kurniawan77 wrote: @Nautilus
this works already with:
/json.htm?type=command&param=udevice&idx=IDX&nvalue=1&svalue=30
nvalue=0 or 1 (on/off), svalue=LEVEL (0,10,20,30...)
with LUA:
commandArray['UpdateDevice']='idx|nValue|sValue'
Great, thanks! I got it working decently by adding sufficient conditions but will definitely try out this as well :)

Re: Mode-selector / multistate device

Posted: Wednesday 03 February 2016 17:51
by davidlevillain
Hi,

I'm using the 4389 beta rev and I can't get selector switches work.

It always stays Off. I tried to create it from devices and switches tab.

Can you help me ?
DomoticzPb.png
DomoticzPb.png (24.73 KiB) Viewed 5299 times

Re: Mode-selector / multistate device

Posted: Wednesday 03 February 2016 20:48
by niceandeasy
Big thank you for this selector switch. I'm using it since I first discovered it as a new feature, without any problems. (now running 2.4389)

I added it by using the manual light/switch button and I'm using it's state/values in LUA. I never updated it's state/values by commandArray. (I guess I should try that, to determine if that causes the above inconsistencies.)

I'm using it to select at which RGB ledstrip I'm changing the colour. The colour is in a user variable and can be changed by 3 dimmers, R&G&B. At changes to these dimmers or change to the selector, it will update the colour on the selected LED strip, unless it's turned off.

Mode-selector / multistate device

Posted: Thursday 04 February 2016 15:34
by mvzut
Just as Nautilus, the first use of the selector switch I had in mind was also grouping the Harmony Hub activities into one panel. I did this as follows:

I created a selector switch (I believe there are several ways to do this, but I did it via the Hardware page, and then used the "Create virtual sensors" button found in in the Dummy entry).

I created the following LUA script, named it script_device_harmony.lua and put it into the ~/domoticz/scripts/lua directory:

Code: Select all

commandArray = {}

-- From devices to selector switch

if devicechanged['TV/beamer uit'] == 'On' then
  commandArray['Logitech Harmony'] = 'Off'
elseif devicechanged['TV kijken'] == 'On' then
  commandArray['Logitech Harmony'] = 'Set Level 10'
elseif devicechanged['Netflix/Plex'] == 'On' then
  commandArray['Logitech Harmony'] = 'Set Level 20'
elseif devicechanged['TV/beamer uit'] == 'Film (beamer)' then
  commandArray['Logitech Harmony'] = 'Set Level 30'

-- From selector switch to devices

elseif devicechanged['Logitech Harmony'] == 'Off' then
  commandArray['TV/beamer uit'] = 'On'
elseif devicechanged['Logitech Harmony'] == 'TV kijken' then
  commandArray['TV kijken'] = 'On'
elseif devicechanged['Logitech Harmony'] == 'Netflix/Plex' then
  commandArray['Netflix/Plex'] = 'On'
elseif devicechanged['Logitech Harmony'] == 'Film (beamer)' then
  commandArray['Film (beamer)'] = 'On'
end

return commandArray
Obviously, you have to change the activity names to the ones that apply to your own situation. Finally, I set the original activity devices to "unused" in the devices page. Although I thought so at first, this doesn't seem to work in the end.

Maybe this helps others that want to do the same.

P.S. I should probably ask in the Harmony plugin subforum, but would it be possible that, at some point in the future, when you add the Harmony Hub, the activities will automatically be created as a selector device instead of multiple activity devices?

Re: Mode-selector / multistate device

Posted: Friday 05 February 2016 23:12
by Nautilus
mvzut wrote:Finally, I set the original activity devices to "unused" in the devices page.
Hmm, interesting - you can set them to unused and still everything works? I would've assumed you cannot control the activities with them anymore after that. My approach was:

Code: Select all

commandArray = {}
if devicechanged['Media Status'] == 'Off' and otherdevices['Harmony Power Off'] == 'Off' then
    commandArray['Harmony Power Off'] = 'On'
elseif devicechanged['Media Status'] == 'SB' and otherdevices['SqueezeBox'] == 'Off' then
    commandArray['SqueezeBox'] = 'On'
elseif devicechanged['Media Status'] == 'TV' and otherdevices['TV'] == 'Off' then
    commandArray['TV'] = 'On'
elseif devicechanged['Media Status'] == 'SB All' and otherdevices['SqueezeBox All'] == 'Off' then
    commandArray['SqueezeBox All'] = 'On'
elseif devicechanged['Media Status'] == 'HTPC' and otherdevices['HTPC'] == 'Off' and otherdevices['HTPC (TF)'] == 'Off' then
    commandArray['HTPC'] = 'On'
end

if devicechanged['Media'] == 'Off' and otherdevices['Media Status'] ~= 'Off' then
    commandArray['Media Status'] = 'Set Level: 0'
elseif devicechanged['TV'] == 'On' and otherdevices['Media Status'] ~= 'TV' then
    commandArray['Media Status'] = 'Set Level: 10'
elseif devicechanged['SqueezeBox'] == 'On' and otherdevices['Media Status'] ~= 'SB' then
    commandArray['Media Status'] = 'Set Level: 20'
elseif devicechanged['SqueezeBox All'] == 'On' and otherdevices['Media Status'] ~= 'SB All' then
    commandArray['Media Status'] = 'Set Level: 30'
elseif (devicechanged['HTPC'] == 'On' or devicechanged['HTPC (TF)'] == 'On') and otherdevices['Media Status'] ~= 'HTPC' then
    commandArray['Media Status'] = 'Set Level: 40'
end
return commandArray
Which I guess is basically the same as you had except that the above checks also that the action is done only in the case the selector switch and original switch differ in their state (thus avoiding the loop).

Re: Mode-selector / multistate device

Posted: Wednesday 10 February 2016 23:47
by Evelen
Image

Image
 
 
For me this works:
Image
But not this:Image
Why?

Re: Mode-selector / multistate device

Posted: Thursday 11 February 2016 7:23
by bizziebis
When you use SET LEVEL 10, SET LEVEL 20, etc it will work.