Recall/Save dimmer intensity when using on/off variable

Take a look at:

Dokumentation $_IPS[‚OLDVALUE‘]

$_IPS[‚OLDVALUE‘]

Is there someone who could point me in the right direction or tell me how to realise this? Maybe there is some how-to or step-by-step guide?

Hi Dennis,

I think the missing answers are related to your missing input :wink: .

As mentioned by Boui, you can save an old value in symcon and try to set your dimmer to this value, when you switch the dimmer on.
But with this approach it depends on your hardware, which normaly store the last value. If not and you click only on a get 100%, a script can react and set a lower/old stored value. But that will at the end a bit „flashing“ for you bulb.

If you provide some hardware info, we can try to find a „workaround“ :wink: .

Thanks for your reply. The reason for my lack of input is probably because I really don’t now where to begin. My previous home automation software did this out of the box (just a checkbox for the dimmer instance to activate the settings I described).
I’m using an Eltako FUD14 dimactor and I guess it saves the „last known intensity“ somehow. The physical (wireless) switches behave as I described in the 1st post. I hope this helps. If not, ask away :wink:

Isn’t this a standard-function for this dimmer?

„The brightness level is stored on switch-off (memory).
In case of a power failure the switch position and the brightness stage are switch on again.“

I think it is, but how do I use the stored value on the dim actor when switching the dimmer back on in IPS?

That’s a strange use case. Dimmers don‘t have a On/Off-Button. You can create a boolean (your switch) and assign the old value when triggered.
Similar to my motion detectors but I switch to a fixed value.

All my Eltako FUD14 dimactors have two variables:

The wireless pushbuttons sends on/off when pushing the button up/down (using the saved intensity for on), and you have to hold the pushbuttons up/down to increase/decrease the intensity.
I’m trying to Symcon to act in the same as the wireless pushbuttons.

Ok try this;
Create a link (status variable) to use in WebFront. Klick custom action. Variable Actions — IP-Symcon :: Automation Software

That‘s it.

Or RequestAction in script.

I still haven’t got a clue what to do, I’m sorry. :confused:
Something like this?


But than I’m at a loss what to do with this…

<?php

//Documentation: https://www.symcon.de/en/service/documentation/concepts/scripts/action-scripts/
SetValue($_IPS['VARIABLE'], $_IPS['VALUE']);

:grin:

That’s easy

I just tested it for you.
It also works without an action variable.

Create a category in your WebFront. Create a Link in this category (right mouse-click) linked object ist your status variable.

That’s all.

Bild

Example to switch the light on in a script:

<?php
RequestAction(ID-status variable, true);

OK, but if I do this, „On“ is always 100% intensity. That’s the behaviour I want to change.

:upside_down_face:

Okay, I can confirm that. It doesn’t work via the status variable. There are several options. A nice Idee would be to use a virtual button.

yes, your are right. The virtual Button solves this Problem. It works 100% like a Hardware-Pushbutton.
Greatings
Jürgen

While the „Virtual Button“ can be a good work-around, adding „Virtual Buttons“ for every dimactor and integrating these extra Virtual Buttons for all dimactoris is a lot of work. I think I would prefer a solution using the (native) possibilities Symcon has to offer. A „custom action“ that triggers a script executing something like this:
„If requested action is „off“, save Intensity value to some variable, when successful change „status“ to „off“. If requested action is „on“, load intensity value from saved variable. If intensity <> 100 and intensity <> 0 change „intensity“ to „variable“, else change „status“ to „on““.
Is this feasible?

There a a few options. Symcon offers countless possibilities. Good luck

Thanks @Boui , for your replies so far. :smiley:

I don’t think my suggestion (or request?) is that strange. Isn’t there some user who made a script like this before, so I can take a look and learn how to achieve this in Symcon (PHP)?

Take a look at oldvalue. There you can find many examples.

1 „Gefällt mir“

A very helpful Symcon user, @Attain , made two scripts for me. One script used as custom action on the „Status“ variable, and one script triggered on change of the „Intensity“ variable. The two scripts can be used on all the dim instances. @Attain even helped me when the script wasn’t triggered by the „Google Assistant“, and edited the script to provide for „Google Assistant“. The scripts are more complex than I originally anticipated.

Thank you very, very much @Attain. I couldn’t have come up with this fix myself.

At the end, an own action script for the „Status“ variable was needed. We made this generic script that can used for all instances of that type of dimmer device.

<?php

$IdentState = 'StatusVariable';
$IdentIntensity = 'IntensityVariable';

If ($_IPS['SENDER'] == 'Variable' || $_IPS['SENDER'] == 'WebFront' || $_IPS['SENDER'] == 'VoiceControl' ) { // execute this script on variable change only
	$Sender = $_IPS['VARIABLE']; // What variable trigger this script?
	$ParentInstance = IPS_GetParent($Sender); // Who is the parent instance of this variable?
	$ChildsOfInstance = IPS_GetChildrenIDs($ParentInstance); // array of all instance childs
	If (IPS_GetObject($Sender)['ObjectIdent'] == $IdentState) // if the trigger variable is the state variable
	{
		If ($_IPS['VALUE']) // boolean true
		//If requested action is „on“ and current status is „off“, load intensity value from saved variable.
		{
			$Intensity = (int)IPS_GetObject($ParentInstance)['ObjectInfo']; // reading the intensity, stored in the instance info area 
			foreach ($ChildsOfInstance as $Child) //looking for the matching intensity variable, under the instance
			{
				If (IPS_GetObject($Child)['ObjectIdent'] == $IdentIntensity) //found intensity variable
				{
					RequestAction($Child, $Intensity); // send the read intensity value the device
				}
			}
		}
		else // boolean false
		// If requested action is „off“ and current status is „on“, save Intensity value to some variable, when successful change „status“ to „off“
		{
			foreach ($ChildsOfInstance as $Child) //looking for the matching intensity variable, under the instance
			{
				If (IPS_GetObject($Child)['ObjectIdent'] == $IdentIntensity) //found intensity variable
				{
					$Intensity = GetValue($Child); // getting the current value
					IPS_SetInfo($ParentInstance,$Intensity); // store the current intensity into the info area of the instance
					RequestAction($Child, 0); // send intensity 0 to the device to switch it off
				}
			}
		}
	}
}
else
{
	IPS_LogMessage($_IPS['SELF'],'Script can executed on variable change only. Sender was: '.$_IPS['SENDER']);
}

Thanks for the good conversation.

1 „Gefällt mir“