[mh] mqtt_Item not firing state_now/state_changed when state value is 0

Brian Rudy via misterhouse-users <[email protected]> Tue, 22 Apr 2025 13:27:09 -0700
Newsgroups gmane.comp.misc.misterhouse.user
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============0198496894198536709==
Content-Type: multipart/alternative;
 boundary="------------d2EvpH9CFoGXiB1Q3lODG10B"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------d2EvpH9CFoGXiB1Q3lODG10B
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi folks,

I have run into a weird issue with an mqtt_Item which, when changed, 
returns a raw value of 0 or 1 but only fires state_now and state_changed 
if the value is 1. However, in the object log I can see that the state 
is actually changing between 0 and 1.

Code snippet:
/$outer_front_lawn_person_status = new mqtt_Item($mqtt1, 
"frigate/Front_Lawn/person");/
/if (my $state = state_now $outer_front_lawn_person_status) {/
/    print_log "[Frigate Front Lawn Person]: Status changed $state";/
/}/


With mqtt debug enabled, I see the following in the logs:
/04/22/2025 10:55:35  [MQTT D1]: mqtt Rcv'd: R:0 
T:'frigate/Front_Lawn/person' M:'0'
04/22/2025 10:55:35  [MQTT D1]: mqtt_Item nom to MQTT to MH 
$outer_front_lawn_person_status::set(0, mqtt=HASH(0x5a0323b77138))
...
04/22/2025 11:42:12  [MQTT D1]: mqtt Rcv'd: R:0 
T:'frigate/Front_Lawn/person' M:'1'
04/22/2025 11:42:12  [MQTT D1]: mqtt_Item nom to MQTT to MH 
$outer_front_lawn_person_status::set(1, mqtt=HASH(0x5a0323b77138))
04/22/2025 11:42:12  [Frigate Front Lawn Person]: Status changed 1/


In the object logs for /$outer_front_lawn_person_status/ I have:
/04/22/2025 11:42:12 1/
/04/22/2025 10:55:35 0/

/
/

Has anyone run into this before, and if so, how did you work around it?


Cheers!
-Brian
--------------d2EvpH9CFoGXiB1Q3lODG10B
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi folks,</p>
    <p>I have run into a weird issue with an mqtt_Item which, when
      changed, returns a raw value of 0 or 1 but only fires state_now
      and state_changed if the value is 1. However, in the object log I
      can see that the state is actually changing between 0 and 1.</p>
    Code snippet:<br>
    <i>$outer_front_lawn_person_status = new mqtt_Item($mqtt1,
      "frigate/Front_Lawn/person");</i><br>
    <i>if (my $state = state_now $outer_front_lawn_person_status) {</i><br>
    <i>    print_log "[Frigate Front Lawn Person]: Status changed
      $state";</i><br>
    <i>}</i>
    <p><br>
    </p>
    With mqtt debug enabled, I see the following in the logs:<br>
    <i>04/22/2025 10:55:35  [MQTT D1]: mqtt Rcv'd: R:0
      T:'frigate/Front_Lawn/person' M:'0'<br>
      04/22/2025 10:55:35  [MQTT D1]: mqtt_Item nom to MQTT to MH
      $outer_front_lawn_person_status::set(0, mqtt=HASH(0x5a0323b77138))<br>
      ...<br>
      04/22/2025 11:42:12  [MQTT D1]: mqtt Rcv'd: R:0
      T:'frigate/Front_Lawn/person' M:'1'<br>
      04/22/2025 11:42:12  [MQTT D1]: mqtt_Item nom to MQTT to MH
      $outer_front_lawn_person_status::set(1, mqtt=HASH(0x5a0323b77138))<br>
      04/22/2025 11:42:12  [Frigate Front Lawn Person]: Status changed 1</i>
    <p><br>
    </p>
    In the object logs for <i>$outer_front_lawn_person_status</i> I
    have:<br>
    <i>04/22/2025 11:42:12 1</i><br>
    <i>04/22/2025 10:55:35 0</i>
    <p><i><br>
      </i></p>
    <p>Has anyone run into this before, and if so, how did you work
      around it?</p>
    <p><br>
    </p>
    Cheers!<br>
    -Brian<br>
  </body>
</html>

--------------d2EvpH9CFoGXiB1Q3lODG10B--


--===============0198496894198536709==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============0198496894198536709==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users


--===============0198496894198536709==--