Recall/Save dimmer intensity when using on/off variable (crosspost)

Hi,

Sorry for this crosspost, I hope someone in this subforum can help me figuring out how to create a working PHP script.
I’m looking for a way when someone activates the „on“ status variable of a dimactor (in webfront) that the on status variable recalls the last known intensity, if the status is „off“. Currently the „on“ status variable always uses an intensity of 100%.
I’ll describe what I think the script should do:
„If requested action is „off“ and current status is „on“, save Intensity value to some variable, when successful change „status“ to „off“. If requested action is „on“ and current status is „off“, load intensity value from saved variable. If saved variable intensity <> 100 and saved variable intensity <> 0 change „intensity“ to saved variable, else change „status“ to „on“.
Maybe someone has already made a similar script? Or can create an example script I can use for learning?
My experience with PHP scripting is second to none. :cry:

Cheers,
Dennis.

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.

1 „Gefällt mir“