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

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 »

bizziebis wrote:When you use SET LEVEL 10, SET LEVEL 20, etc it will work.
will try after work :)
StanHD wrote: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.
Me too as you can see in my previous post. But have you managed to change the color without changing DIM?
see viewtopic.php?f=4&t=10487
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 »

@Evelen,

I think the Dim Level is set using the scene like this:-

Image

Maybe I am not understanding your question. :?
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
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 »

StanHD wrote:@Evelen,
....
Maybe I am not understanding your question. :?
I meen, if i use JSON to change color like this:

Code: Select all

json.htm?type=command&param=setcolbrightnessvalue&idx=84&hue=323&brightness=100&iswhite=false
hue=323 represent the color
brightness=100 represent the dim level.

somtimes the color is blue and the dim is 50%, when I use the above JSON the color will be pink AND the dim will change to 100%, I want to just change color, not dim at the same time.

If i remove the "brightness=100" from JSON url it don't work
RobertH
Posts: 12
Joined: Sunday 15 November 2015 19:10
Target OS: Windows
Domoticz version:
Location: Norway, Kongsberg
Contact:

Re: Mode-selector / multistate device

Post by RobertH »

Nautilus wrote:
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).
Thanks this works perfectly for me with my Harmony! Also this is on a Domoticz install wich runs on Windows Server if anyone is still wondering if the selector switches is working there.
Domoticz running on Windows Server 2008 in VMware (ESXi), UZB1 stick, 3x FIBARO FGD212 Dimmer, 1x FIBARO RGBW Controller FGRGBWM-441, 2x FIBARO FGMS001 Motion Sensor and 2x Popp 009006 Plug-in Switch
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 »

Weird problem with this selector switch...

This is the case:
Running Domoticz 2.4552 on a RPI2, using RFXTRX433E.
1 have a 3-speed fan. The motor is supplied by two 'hot' leads and one 'neutral'. I use 2 KAKU switches for it: Fan 1 and Fan 2. If only one of them is on, the fan runs at speed 1 or 2. If both are on, it's running at speed 3.
I control this fan by a 4-state Selector switch:
Off, low, medium, high
I also use a KAKU remote, named 'Kitchen Fan'. By pushing the On button, the fan cycles through speed 1, 2, 3. By pushing Off, the fan turns off.
Selector switch is called 'Fan'
A section of my master LUA script is handling the logic.

The weird part: when the fan is turned off, the LUA script keeps on looping: the selector switch keeps on triggering. It is not looping in any of the other states: low, medium, high.
To solve this issue.. (even weirder).. In the selector switch's options, I have hidden the built-in 'Off' state and I created a new state, called 'off'. (without capital O)
After adjusting my LUA script for this, everything works as a charm.

Here's part of my LUA script (current, working version)

Code: Select all

commandArray = {}
local dev=next(devicechanged)
local cmd=devicechanged[dev]
--Left out some code that's not relevant to the fan, here--
--Kitchen fan
if dev=='Kitchen Fan' and cmd=='On' and otherdevices['Fan']=='off' then 
	dev='SetFan'
	cmd='Set Level: 20'
end
if dev=='Kitchen Fan' and cmd=='On' and otherdevices['Fan']=='low' then 
	dev='SetFan'
	cmd='Set Level: 30'
end
if dev=='Kitchen Fan' and cmd=='On' and otherdevices['Fan']=='medium' then 
	dev='SetFan'
	cmd='Set Level: 40'
end
if dev=='Kitchen Fan' and cmd=='On' and otherdevices['Fan']=='high' then 
	dev='SetFan'
	cmd='Set Level: 20'
end
if dev=='Kitchen Fan' and cmd=='Off' and otherdevices['Fan']~='off' then
	dev='SetFan'
	cmd='Set Level: 10'
end
if dev=='SetFan' or dev=='Fan' then
	cmdarr='Fan'
end
if cmdarr=='Fan' then
	if cmd=='low' or cmd=='Set Level: 20' then
		commandArray[1]={['Fan 2']='Off'}
		commandArray[2]={['Fan 1']='On'}
	end
	if cmd=='medium' or cmd=='Set Level: 30' then
		commandArray[1]={['Fan 1']='Off'}
		commandArray[2]={['Fan 2']='On'}
	end
	if cmd=='high' or cmd=='Set Level: 40' then
		commandArray[1]={['Fan 1']='On'}
		commandArray[2]={['Fan 2']='On'}
	end
	if cmd=='off' or cmd=='Set Level: 10' then
		commandArray[1]={['Fan 1']='Off'}
		commandArray[2]={['Fan 2']='Off'}
	end
end

--output
if (cmdarr~=nil) and (cmd~=nil) then
	commandArray[cmdarr]=cmd
end
return commandArray
Dummy selector switch settings:
Fan icon, states: Off, off, low, medium, high
Off state hidden
No actions

Did I run into a bug, here? Has anyone else seen LUA looping at the built-in 'Off' state?
ricorico94
Posts: 94
Joined: Monday 26 October 2015 10:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Mode-selector / multistate device

Post by ricorico94 »

Hi,

I'd love using the selector feature, but I can't make it work so far..
I have heaters with Qubino ZMNHJD1 Flush Dimmer which have been installed as dimmers last year. I tried to modify one of those by "Edit" in ths switch menu: instead of "Dimmer" I selected "Selector", then added several "levels" and clicked on "save".
But in switch menu that device only shows 1 level "Off", and when I click "edit" again, I can only see "seector" in list box but none of the levels I had defined.
-> Is it possible or impossible to change the type from Dimmer to Selector ?
Or are we forced to create a new dummy device, then a dummy switch, then create Blockly rules for each individual status level of each indidivual Selector ?

Another question, in case I can make it work: is it possible to define the value of each level (like, instead of having 0;10;20;30;.., can I set it up as 0;25; 50; 75 ?

ricorico94
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 »

ricorico94 wrote:I tried to modify one of those by "Edit" in ths switch menu: instead of "Dimmer" I selected "Selector", then added several "levels" and clicked on "save".
Perhaps the problem is that this device type is not intended to use that way?
You can create dummy device and use json, blocky, lua or something else to make needed "linking" between the dummy and the real device.
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Mode-selector / multistate device

Post by Westcott »

I wasn't able to edit a regular switch into a selector.
Although I could set the type to Selector and add levels to it, the GUI for adding level actions did not appear, and the levels I did add were not saved.
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Mode-selector / multistate device

Post by nayr »

yeah I dont think having selector in the drop down of subtypes is a good idea, this is not a Switch Subtype is it? I thought it was a whole new type of Switch..
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
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 »

I find that the Mode selector / multistate device uses much longer time to perform tasks than usual on / off or RGBW switch, have any of you noticed this?
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Mode-selector / multistate device

Post by nayr »

not at all, and I currently have 7 selector switches being used for all sorts of things, they all respond instantly as expected.. have you tried clearing your appcache?
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
ricorico94
Posts: 94
Joined: Monday 26 October 2015 10:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Mode-selector / multistate device

Post by ricorico94 »

Hi,

Isn't it weird that any dimmer device can not be managed through a multi state selector ? I could udnerstand that a multistate can not be handled via a dimmer as some values would be missing, but any selector value can be applied to a dimmer, so we should be able to manage a dimmer through a multiselector.
The constraint of adding extra switches and extra blockly events to add a layer of multi-state selector on top of dimmer will add unnecessary load (and complexity) to the system, no ?


Also, anyone found a way to change the values of each state ?

br,
ricorico94
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 »

nayr wrote:yeah I dont think having selector in the drop down of subtypes is a good idea, this is not a Switch Subtype is it? I thought it was a whole new type of Switch..
Thats correct!
Wondering if its that way to make changing icon possible?
ricorico94 wrote:The constraint of adding extra switches and extra blockly events to add a layer of multi-state selector on top of dimmer will add unnecessary load (and complexity) to the system, no ?
Use json in state action fields. Then the event system wont have to do extra work. But still its not that heavy operation.
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Mode-selector / multistate device

Post by nayr »

ah yeah that could be the reason, the custom icon implementation needs to be expanded to all switch types pretty desperately.. heck cant even do custom icons for dimmers.

I've found these selector switches are ideal for AutoTracking a PTZ.
Image

I have reconfigured all my desktop hotkeys, etc to make the call to domoticz selector now instead of directly to the camera.. also disabled the built in idle-preset function and implemented my own on domoticz.. since I make all my preset calls via Domoticz now it always knows what the PTZ is looking at, I am working on setting up a script to poll the camera and sync the selector switch from time to time just to ensure it keeps synced even if I use the native phone app over VPN.

https://github.com/nayrnet/domoticz-scr ... estptz.lua

That little script changes my idle preset depending if its Daytime or Nighttime, in the Day the camera is on a preset that can see the entire yard, street and sidewalks.. but at night Ive had multiple attempts to break into my car so the preset changes after sunset to a zoomed in view optimized for getting the best image of anyone trying to open the door handles.

Also use GeoFence app on my phone to set my presence in Domoticz to away, so when I am on vacation or something my PTZ will know that my car is not on the street and never bother zooming in on an empty piece of asphault.

Overall my tracking scripts are much smarter and easier to maintain now, instead of a bunch of url requests I simply tell the selector to set a level and I can check what its already looking at before telling it to look at something that may be less important than what it was already viewing, the PTZ can overlap many of my Fixed camera's views so events in those areas are less of a priority if something is going on in an area only the PTZ can see.

Ive noticed that associating Selector Switches with Security Cameras does not give you the webcam link to view an image, and when I get an email with the camera image attached the Subject reads: West PTZ Status: Set Level: 60 %, instead of ideally: West PTZ Status: Road Parking, so it looks like the Camera system needs to be made aware of Selector Switches.

Image
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
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 »

nayr wrote:not at all, and I currently have 7 selector switches being used for all sorts of things, they all respond instantly as expected.. have you tried clearing your appcache?
nop, how?
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: Mode-selector / multistate device

Post by nayr »

oh common now, you can search the internet right? wipe out all your browser's caches, if you use chrome try: chrome://appcache-internals/

or see if it works better a private browser window..
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
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 »

nayr wrote:oh common now, you can search the internet right? wipe out all your browser's caches, if you use chrome try: chrome://appcache-internals/

or see if it works better a private browser window..
oh, the browser cashe, done. thought you meant a separate Catche in domoticz

anyway, the switch is slow if blockly etc interfere with it as well
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Mode-selector / multistate device

Post by remb0 »

Who want to filter all the info about this great feature into a new wiki page? and contribute this way if you don't code and love domoticz? :)
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 »

I am missing the selector levels when i want to create a scene with a selector. Is this in the scope of future updates?

Or is there an other way of inserting a selector into a scene. For the time being i created a virtual switch with the same action commands
dSceneMissingSelectorLevels.png
dSceneMissingSelectorLevels.png (70.13 KiB) Viewed 4586 times
cherowley
Posts: 65
Joined: Tuesday 24 February 2015 15:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Mode-selector / multistate device

Post by cherowley »

Hi!

Just tried the selectors and they are great except for one bug which makes it unusable in one case:

The Off delay doesn't work. At least it will not retain the number I type in when save is clicked :(

Domoticz details (running on synology) :

Version: 2.4799
Build Hash: 37350e2-modified
Compile Date: 2016-02-27 09:43:23
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest