This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Heartbeat publication set sets wrong parameters using interactive pyaci

Hi Folks,

I found that the interactive pyaci is setting wrong parameters if I try to set the heartbeat publication.

What I did:

Python:

cc.heartbeat_publication_set(0xfffe,0xdd,0xcc,0x64,0x0000,0x0000)
Response: ttyACM0.ConfigurationClient: Heartbeat publication state: dst: fffe, count: 128, period: 128s, features: {'relay': False, 'proxy': False, 'friend': False, 'lowPower': False}, subnet: 0
Internally this packet is then generated: "00feff08086400000000"

On the mesh device side I receive this:
"00FEFF08086400000000"

So the transfer was correct but the packet was build wrong. I think it should be like this according to the specification:
"00feffddcc6400000000"

So to me it looks like the CountLog and PeriodLog are not set properly.

Is there anything I got wrong maybe?

Thank you in advance for your help!

Bye
Andrej

Parents
  • Hi Andrej,

    Inspecting the heartbeat_publication_set() method, I see you’ve uncovered a small bug. I’ve reported (and fixed) this internally, here’s the diff:

    modified   scripts/interactive_pyaci/models/config.py
    @@ -387,7 +387,7 @@ class ConfigurationClient(Model):
                                       feature_bitfield=0, netkey_index=0):
             message = bytearray()
             message += struct.pack(
    -            "<HBBBHH", dst, log2b(count), log2b(count), ttl, feature_bitfield, netkey_index)
    +            "<HBBBHH", dst, log2b(count), log2b(period), ttl, feature_bitfield, netkey_index)
             self.send(self._HEARTBEAT_PUBLICATION_SET, message)
    

    Notice that this method takes count and period and packs them according to spec (p. 147 of the Mesh Profile specification v1.0) using the log2b() function. This limits the list of valid values to only be those that is a power of 2. Your 0xdd (221) is rounded down to 0x80 (2(8-1) = 128). In the data sent to the mesh device, you’ll see that the count and period is sent as 0x08 and 0x08, this gives 28-1 = 128.

    Please let me know if anything is unclear.

    Hope this helps,
    Thomas

Reply Children
No Data
Related