# propertyChange is not being triggered

**URL:** <https://forum.inductiveautomation.com/t/propertychange-is-not-being-triggered/93004>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [July 10, 2024, 12:00pm UTC](https://forum.inductiveautomation.com/t/propertychange-is-not-being-triggered/93004 "2024-07-10T12:00:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [July 10, 2024, 12:00pm UTC](https://forum.inductiveautomation.com/t/propertychange-is-not-being-triggered/93004/1 "2024-07-10T12:00:43Z")

</div>

hello everyone,

I have an "image" component where I want it to be shown when some values change, but it is not being executed.

```python
# Read custom property values
sp_p = event.source.SP_P
active_power = event.source.Active_Power
timer_value = event.source.timer

# Calculate the condition
#condition_met = (abs((sp_p - active_power) / active_power) * 100 > 115) and (sp_p_2 > 0.25)
condition_met = sp_p > active_power

if condition_met:
    timer_value += 1
else:
    timer_value = 0

# Updating the timer
event.source.timer = timer_value

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/1/c1c4a678198f6e73ffe9ad92c10fec0d3f6b9da6.png)

what am I doing wrong?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 10, 2024, 12:44pm UTC](https://forum.inductiveautomation.com/t/propertychange-is-not-being-triggered/93004/2 "2024-07-10T12:44:14Z")

</div>

You aren't checking the property name. You won't make much progress until you indent everything and put `if event.propertyName == 'something':` ahead of it. In Vision, property change scripts run for **every** property that fires changes. You **must** filter for the properties of interest.

---

<div class="post-metadata">

**Author:** ![Miguel\_Cimildoro](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@Miguel\_Cimildoro](https://forum.inductiveautomation.com/u/Miguel_Cimildoro)\
**Post date:** [July 11, 2024, 8:28am UTC](https://forum.inductiveautomation.com/t/propertychange-is-not-being-triggered/93004/3 "2024-07-11T08:28:04Z")

</div>

> [@pturmel](#):
>
> if event.propertyName == 'something'

Thanks, Phil. Initially, it worked for me by adding the condition:

`if event.propertyName == 'something' `

and that 'something' would be a custom property. It ended up like this:

```python
sp_p = event.source.SP_P
active_power = event.source.active_power
timer_value = event.source.timer
counter = event.source.counter

if event.propertyName == "counter":
    if sp_p >= active_power:
        timer_value += 1
    else:
        timer_value = 0

    event.source.timer = timer_value

```

the counter is incrementing every second, I did this from the gateway event script.

What I wanted was for the component to be visible only if the condition is met for more than 10 seconds; otherwise, it should not be shown. By doing this and adding a visible expression, it worked:

{[PROJECT]System/TEST/Temp\_condition\_Timer/Condition\_Timer\_2\_2\_1} \>= 10

thanks again.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 11, 2024, 12:39pm UTC](https://forum.inductiveautomation.com/t/propertychange-is-not-being-triggered/93004/4 "2024-07-11T12:39:06Z")

</div>

Note that even your other property accesses should be inside the `if`, for best performance of all the events that you _don't_ process.
