Powermax Alarm Panel Status change notification

Hello,

I have been using the plugin for my PowerMax Pro for some time now and I am very satisfied with it. And I have to give big thanks for the developer.
But I have a request, if it is possible of course.
I have 2 partitions which it is known not to be supported for PowerMax Pro as separate ones. So there is only one partition created for both. The problem is that the only way to separate them is through the status of the panel.
I have some actions triggered according to the Partition status (Device is Armed, Device is Disarmed), but unfortunately if one partition is armed, the trigger “Device is Disarmed” is not recognized since the device is already armed.
The only way to overcome this problem and being able to trigger actions for each partition separately, is through the Panel status. But the panel does not have support for that as the only triggers/notifications are “Alarm Type” and “Trouble Type”.

Is it possible to add a triggers/notifications at the panel device for status change? It would be very helpful for for a lot of things.

Thank you in advance.

@barsam: There are so many different values possible for the status, that it is impossible to make a notification with such an event list. You need to build some logic on what you want to capture in the status. This can be done with some lua.

function calledOnStatusChange(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
   ...
end

luup.variable_watch("calledOnStatusChange", "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", "PanelStatusData", <device_id>)

Thank you nlrb for your response.
I understand what you are saying and I see the logic behind the code, but my question is, how can I trigger the event?
Or is it a code that needs to be at the start up LUA that will be watching the variable at the background?

It is indeed the latter. The code should be put as part of the startup and all changes to the PanelStatusData variable will call the calledOnStatusChange function.