Mode-selector / multistate device

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

User avatar
StephaneG
Posts: 19
Joined: Tuesday 17 November 2015 10:10
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: France
Contact:

Re: Mode-selector / multistate device

Post 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
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: Mode-selector / multistate device

Post 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?
Attachments
states-blockly.JPG
states-blockly.JPG (50.2 KiB) Viewed 5548 times
switch-hm.JPG
switch-hm.JPG (57.34 KiB) Viewed 5548 times
pj-r
Posts: 140
Joined: Wednesday 17 December 2014 17:30
Target OS: Linux
Domoticz version: V3.8650
Location: Jyväskylä, Finland
Contact:

Re: Mode-selector / multistate device

Post by pj-r »

elmortero wrote:Does anyone know why?
Use text blocky instead of switch mode blocky.
Attachments
selector_blocky.png
selector_blocky.png (21.98 KiB) Viewed 5537 times
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Mode-selector / multistate device

Post by deennoo »

Is this possible to got selector switch for milight device please ?

This feature is really cool
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: Mode-selector / multistate device

Post by elmortero »

That worked.
Thanks a lot
pj-r
Posts: 140
Joined: Wednesday 17 December 2014 17:30
Target OS: Linux
Domoticz version: V3.8650
Location: Jyväskylä, Finland
Contact:

Re: Mode-selector / multistate device

Post 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
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
pluggin
Posts: 45
Joined: Tuesday 26 May 2015 22:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Argentina
Contact:

Re: Mode-selector / multistate device

Post by pluggin »

JacquesMulders wrote:Works in v 2.4312 :)
:D
Thanks for the info!!
Razberry + 4 Eversrping HSM02 + 2 Aeotec Multi-Sensor + 1 Aeotec Micro Dimmer + 4 Aeotec Micro Smart Energy Switch, 2nd + 1 Remotec ZXT-120 + 1 Aeotec Smart Energy Monitor + 1 Everspring SE812 indoor Siren + 2 fibaro motion sensor + Aeotec water sensor
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Mode-selector / multistate device

Post by deennoo »

OK done thx for my Hyperion selector (milight isn't enought supported)
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Mode-selector / multistate device

Post 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.
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Mode-selector / multistate device

Post 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...:)
robal_k
Posts: 6
Joined: Sunday 09 March 2014 15:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Mode-selector / multistate device

Post 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:
Attachments
Capture.PNG
Capture.PNG (73.26 KiB) Viewed 5347 times
darknico31
Posts: 10
Joined: Saturday 17 October 2015 10:01
Target OS: Linux
Domoticz version: 2.4347
Location: France
Contact:

Re: Mode-selector / multistate device

Post by darknico31 »

EDIT :
Cache issue, nothing to see here :oops:
(not refreshing even with CTRL-F5)
kurniawan77
Posts: 46
Joined: Wednesday 21 January 2015 20:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Mode-selector / multistate device

Post 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'
Last edited by kurniawan77 on Friday 05 February 2016 14:14, edited 1 time in total.
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Mode-selector / multistate device

Post 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 :)
davidlevillain
Posts: 1
Joined: Wednesday 03 February 2016 17:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Mode-selector / multistate device

Post 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 5211 times
niceandeasy
Posts: 102
Joined: Thursday 28 January 2016 22:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: NL
Contact:

Re: Mode-selector / multistate device

Post 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.
mvzut
Posts: 443
Joined: Thursday 12 November 2015 10:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Mode-selector / multistate device

Post 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?
Last edited by mvzut on Wednesday 17 February 2016 13:28, edited 1 time in total.
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Mode-selector / multistate device

Post 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).
Evelen
Posts: 234
Joined: Thursday 09 July 2015 12:03
Target OS: Linux
Domoticz version: 2.4538
Location: Norway
Contact:

Re: Mode-selector / multistate device

Post by Evelen »

Image

Image
 
 
For me this works:
Image
But not this:Image
Why?
User avatar
bizziebis
Posts: 182
Joined: Saturday 19 October 2013 14:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8805
Location: The Netherlands
Contact:

Re: Mode-selector / multistate device

Post by bizziebis »

When you use SET LEVEL 10, SET LEVEL 20, etc it will work.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests