How to use physical push button with boolean variable and action script

Hi,

I’m trying to change a write only variable, using a physical push button (EnOcean PTM200) and action script, however with little succes. if someone could point me in the right direction I would be very grateful. Here’s the link to my endeavors:

Cheers,
Dennis.

Hi Dennis,

I’m not too deep into homematic, but one thing that might help you in general:

If you want to modify a variable that has an Action assigned (e.g. can be switched in the web frontend) the method of choice is RequestAction()

It provides a nice abstraction, so you do not need to fiddle with the details of each HW module type.

So if your Homematic device has a variable STATE that can be switched on and off the way to do this via RequestAction() is:

$varIdState = 12345; // The object ID of the STATE variable

// turn on
$resultOn = RequestAction($varIdState, true);

// turn off
$resultOff = RequestAction($varIdState, false);

It works with all kind of variables, not just switches:

$varIdIntensity = 12346; // The object ID of the Intensity variable of a dimmer

// dim to 20%
$resultDim = RequestAction($varIdIntensity, 20);

I only fall back to the native functions if I really need some hw specific, granular control (e.g. the DimSetEx fuction of Z-Wave).

Sorry, I had a deeper look into article that you linked and I realized that your use case is different to what I expected.

Can you detail results of your PMT200 and how you can detect that a button was pressed? Maybe a screenshot of the instance and all variables attached to it.

Hi @Augustinus ,

If I push the top rocker button the boolean variable changes to ‚false‘, if I push the bottom rocker button the boolean variable changes to ‚true‘.

What I’m trying to do is to change a write only integer variable using the button. The ‚Status‘ variable changes when using the button, so the button has been discovered correctly in IP-Symcon.

Cheers,
Dennis.