Skip to content

[Bug] rx_log_data is empty when a message is sent using a region scope #237

@RikoDEV

Description

@RikoDEV

I created a bot for my community using automation, and during testing we encountered an issue with region scope handling in this integration.

If a user sends a message with region scope, the data from trigger.event.data.rx_log_data is empty in the meshcore_message event with the channel message_type. When sending the same message without a region scope, I have access to path data and other information from rx_log_data.

Example automation to replay:

alias: "MeshCore Bot: Trace Route"
description: Responds to `es trace` on channel with hop/signal info
triggers:
  - trigger: event
    event_type: meshcore_message
    event_data:
      message_type: channel
      channel_idx: 2
conditions:
  - condition: template
    value_template: >-
      {{ (trigger.event.data.message | default('') | lower).startswith('es
      trace') }}
actions:
  - delay:
      seconds: 2
  - variables:
      d: "{{ trigger.event.data }}"
      rx0: >
        {{ d.rx_log_data[0] if (d.rx_log_data is defined and d.rx_log_data |
        length > 0) else {} }}
      rssi_val: "{{ rx0.rssi if rx0.rssi is defined else 'n/a' }}"
      snr_val: "{{ rx0.snr if rx0.snr is defined else 'n/a' }}"
      path_hex: "{{ rx0.path if rx0.path is defined else '' }}"
      path_len: "{{ rx0.path_len if rx0.path_len is defined else 0 }}"
      path_step: >
        {% set pl = path_len | int %} {% set hex_len = path_hex | length %} {{
        ((hex_len // pl) if pl > 0 else (6 if hex_len % 6 == 0 and hex_len > 0
        else (4 if hex_len % 4 == 0 and hex_len > 0 else 2))) }}
      path_nodes: |
        {% set step = path_step | int %}
        {% if path_hex | length >= 2 %}
          {% set ns = namespace(nodes=[]) %}
          {% for i in range(0, path_hex | length, step) %}
            {% set ns.nodes = ns.nodes + [path_hex[i:i+step]] %}
          {% endfor %}
          {{ ns.nodes | join(' → ') }}
        {% else %}
          ⚡ direct or empty
        {% endif %}
      reply_text: >
        📡 @[{{ d.sender_name }}] RSSI: {{ rssi_val }} dBm | SNR: {{ snr_val }} dB Hops: {{ path_len }} | Path: {{ path_nodes }}
  - data:
      channel_idx: 2
      message: "{{ reply_text | trim }}"
    action: meshcore.send_channel_message

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions