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

Mesh Monitor with Heartbeat Messages

Hey, I want to create a Mesh Monitor, to do this I want to create the follow setup:

Mesh consist of Several servers with Heartbeat message Tx/Rx enabled  send periodically heartbeat messages and also receive periodically heartbeat messages. Each node creates a list of his neighbors with help of this heartbeat messages. In the mesh network is also one client implemented on the Host-PC with help of interactive.py and serial-node(serial node is interface between mesh and the  python-client on pc) The client knows all the uni-cast addresses and send get_list messages to all  nodes in the mesh.

Some Specification I found for Bluetooth Mesh v.1.0 (maybe someone will use it )

#####################################

several servers configuration

Heartbeat Publication: composite state that controls sending of periodical Heartbeat transport control messages.
    Heartbeat Publication Destination: determines the destination address for Heartbeat messages.
        shall be the unassigned address, a uni-cast address, or a group address
    Heartbeat Publication Count Log:controls the number of periodical Heartbeat transport control messages to be sent
        0x00  Heartbeat messages are not being sent periodically
        0x01–0x11  Number of Heartbeat messages, 2 (n-1) , that remain to be sent
        0x12-0xFE  Prohibited
        0xFF  Heartbeat messages are being sent indefinitely
        Heartbeat Publication Count Log and Heartbeat Publication Count with the value 0x00 and 0x0000 are equivalent.
    Heartbeat Publication Period Log: 8-bit value that controls the cadence of periodical Heartbeat transport control messages
        0x00  Heartbeat messages are not being sent periodically
                0x01–0x11  Period in 2 (n-1) seconds for sending periodical Heartbeat messages
        0x12–0xFF  Prohibited
        The value is represented as 2 (n-1) seconds
        For example, the value 0x04 would have a publication period of 8 seconds
    Heartbeat Publication TTL:The Heartbeat Publication TTL state determines the TTL value used when sending Heartbeat messages:
        0x00–0x7F  The Heartbeat Publication TTL state
        0x80–0xFF  Prohibited
    Heartbeat Publication Features: determines the features that trigger sending Heartbeat messages when changed
        0  Relay  Relay feature change triggers a Heartbeat message: 0 = False, 1 = True
        1  Proxy  Proxy feature change triggers a Heartbeat message: 0 = False, 1 = True
        2  Friend  Friend feature change triggers a Heartbeat message: 0 = False, 1 = True
        3  Low Power  Low Power feature change triggers a Heartbeat message: 0 = False, 1 = True
        4–15  RFU  Reserved for Future Use
    Heartbeat Publication NetKey Index:determines the global NetKey Index of the NetKey used to send Heartbeat messages

Heartbeat Subscription:
    Heartbeat Subscription Source:
        can be the unassigned address or a unicast address
        If the Heartbeat Subscription Source is set to the unassigned address, the Heartbeat messages are not being processed
    Heartbeat Subscription Destination: determines the destination address for Heartbeat messages
        unassigned address, the primary unicast address of the node, or a group address, all other values are Prohibited.    

    Heartbeat Subscription Count Log: number of periodical Heartbeat transport control messages received since receiving the most recent Config Heartbeat
                Subscription Set message (what is it ?)
        0x0000–0xFFFE  Number of Heartbeat messages received
        0xFFFF  More than 0xFFFE messages have been received
    Heartbeat Subscription Period Log: controls the period for processing periodical Heartbeat transport control messages
        0x00  Heartbeat messages are not being processed
        0x01–0x11  Remaining period in 2 (n-1) seconds for processing periodical Heartbeat messages
        0x12-0xFF  Prohibited
    Heartbeat Subscription Min Hops:determines the minimum hops value registered when receiving Heartbeat messages since receiving the most recent Config Heartbeat Subscription Set message
        0x00  No Heartbeat messages have been received
        0x01–0x7F  The Heartbeat Subscription Min Hops state
        0x80–0xFF  Prohibited    
    Heartbeat Subscription Max Hops: determines the maximum hops value registered when receiving Heartbeat messages since receiving the most recent Config Heartbeat Subscription Set message
        0x00  No Heartbeat messages have been received.
        0x01–0x7F  The Heartbeat Subscription Max Hops state
        0x80–0xFF  Prohibited



Config Heartbeat Publication Get:is an acknowledged message used to get the current Heartbeat Publication state of an element
The response to a Config Heartbeat Publication Get message is a Config Heartbeat Publication Status message.

Config Heartbeat Publication Set:  is an acknowledged message used to set the current Heartbeat Publication state of an element
The response to a Config Heartbeat Publication Set message is a Config Heartbeat Publication Status

Config Heartbeat Publication Status:  is an unacknowledged message used to report the Heartbeat Publication state of a node

Config Heartbeat Subscription Get: is an acknowledged message used to get the current Heartbeat Subscription state of an element
The response to a Config Heartbeat Subscription Get message is a Config Heartbeat Subscription Status message

Config Heartbeat Subscription Set: is an acknowledged message used to set the current Heartbeat Subscription state of an element

Config Heartbeat Subscription Status:is an unacknowledged message used to report the Heartbeat Subscription state of a node

opcodes:

Config Heartbeat Publication Get  0x80 0x38
Config Heartbeat Publication Set  0x80 0x39
Config Heartbeat Publication Status  0x06
Config Heartbeat Subscription Get  0x80 0x3A
Config Heartbeat Subscription Set  0x80 0x3B
Config Heartbeat Subscription Status  0x80 0x3C


############################################


so to configure  the Configuration Server model I want to use the interactice.py (pyACI) http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v2.0.1%2Fmd_scripts_interactive_pyaci_doc_demo_configuration.html&cp=4_1_0_2_0_2

the Idea is to  send some messages from ConfigurationClient(db) on the host pc to the Configuration Server model on the nodes.

1) Will such a constellation and code work with conjunction with the pyACI ?

cc = ConfigurationClient(db)
device.model_add(cc) cc.publish_set(8, 0)
cc.heartbeat_publication_set(dest,count,period,ttl,features, netkey_index) // for Tx heartbeat messages
cc.heartbeat_subscription_set(src,dst,period) // for Rx heartbeat messages from other nodes

2) i want make a friend_list in each node and than to send it to the host_client are there more elegant ways to implement a mesh monitor just with the heartbeat messages without such a list to see which node has which neighbors ?

3) i want Transmit heartbeat  messages and also Receive from another nodes how to do this at the same time , is it possible at all ?

4) i see in the ConfigurationClient the relay_set(..) and other features that means I can control the feature state(on off) via pyACI ? because someone said me it is not possible in the current implementation.

update:

the above command seems to work:

In [13]: cc.heartbeat_publication_set(db.groups[0].address,0xFF,0x04,0x02,0, 0)

2018-08-07 11:18:44,384 - INFO - COM10: Success
In [14]: 2018-08-07 11:18:44,417 - INFO - COM10.ConfigurationClient: Heartbeat publication status: AccessStatus.SUCCESS
2018-08-07 11:18:44,418 - INFO - COM10.ConfigurationClient: Heartbeat publication state: dst: c001, count: 128, period: 4s, features: {'relay': False, 'proxy': False, 'friend': False, 'lowPower': Fals
e}, subnet: 0


5) which  Function in simple onoff server node is called if the node receives the heartbeat message ?

Parents
  • I am confused about the heartbeat_suscription_set(src,dst,period)

    7) this is the function to suscribe to receive heartbeat messages right ?

    Heartbeat Subscription Source:
            can be the unassigned address or a uni-cast address
            If the Heartbeat Subscription Source is set to the unassigned address, the Heartbeat messages are not being processed

    Heartbeat Subscription Destination: determines the destination address for Heartbeat messages
            unassigned address, the primary uni-cast address of the node, or a group address, all other values are Prohibited.

    8) the mesh specification says that source address has to be a unicast address  but in a Mesh Monitor I cannot know the uni-cast address of the nodes (which potentially send the heartbeat messages ) which appear randomly in proximity of the node. What do I understand wrong ?

Reply
  • I am confused about the heartbeat_suscription_set(src,dst,period)

    7) this is the function to suscribe to receive heartbeat messages right ?

    Heartbeat Subscription Source:
            can be the unassigned address or a uni-cast address
            If the Heartbeat Subscription Source is set to the unassigned address, the Heartbeat messages are not being processed

    Heartbeat Subscription Destination: determines the destination address for Heartbeat messages
            unassigned address, the primary uni-cast address of the node, or a group address, all other values are Prohibited.

    8) the mesh specification says that source address has to be a unicast address  but in a Mesh Monitor I cannot know the uni-cast address of the nodes (which potentially send the heartbeat messages ) which appear randomly in proximity of the node. What do I understand wrong ?

Children
  • Sorry for the delayed response. 

    1) Yes, this should work. You should be able to subscribe & publish to heartbeat messages right after configuration like you have shown above. 

    2) If I understand this correctly, you want to have a list of all of the nodes & each neighbor to all of the nodes in a list, correct?

    3) Yes, you should be able to send & subscribe to heartbeat messages concurrently (not exactly at the same time). It should be quite similar to sending & receiving regular mesh messages.

    4) Yes, you can control the on/off state of the light bulbs via PyACI.

    5) Update from the developer: "The heartbeat messages are handled at the transport layer level. The heartbeat.c module is the one responsible for handling them & generating appropriate events to the application".

    7) Yes

    8) The mesh monitor should be running on the PC side of things, correct? As far as I understand, the mesh monitor will be running separately from the provisioner, correct? The mesh monitor will also not be a part of the mesh network, but should be able to read all of the mesh messages in that network, correct?

Related