Hi There, I can’t figure it out what is missing or if I did something wrong, I use the migration tool and everything went well, before migrating all my devices were up and running, now my gateway can’t connect, I am using a pygate with a lopy4 for an as923 band. and few pysense’s with lopy4’s as my nodes here are my configurations if somebody could help me
Chirpstack.toml:
# Logging.
[logging]
# Log level.
#
# Options are: trace, debug, info, warn error.
level="info"
json=false
# PostgreSQL configuration.
[postgresql]
# PostgreSQL DSN.
#
# Format example: postgres://<USERNAME>:<PASSWORD>@<HOSTNAME>/<DATABASE>?sslmode=<SSLMODE>.
#
# SSL mode options:
# * disable - no SSL
# * require - Always SSL (skip verification)
# * verify-ca - Always SSL (verify that the certificate presented by the server was signed by a trusted CA)
# * verify-full - Always SSL (verify that the certification presented by the server was signed by a trusted CA and the server host name matches the one in the certificate)
dsn="postgres://chirpstack:chirpstack@localhost/chirpstack?sslmode=disable"
# Max open connections.
#
# This sets the max. number of open connections that are allowed in the
# PostgreSQL connection pool.
max_open_connections=10
# Min idle connections.
#
# This sets the min. number of idle connections in the PostgreSQL connection
# pool (0 = equal to max_open_connections).
min_idle_connections=0
# Redis configuration.
[redis]
# Server address or addresses.
#
# Set multiple addresses when connecting to a cluster.
servers=[
"redis://localhost/",
]
# Redis Cluster.
#
#
# Set this to true when the provided URLs are pointing to a Redis Cluster
# instance.
cluster=false
# Network related configuration.
[network]
# Network identifier (NetID, 3 bytes) encoded as HEX (e.g. 010203).
net_id="000000"
# Enabled regions.
#
# Multiple regions can be enabled simultaneously. Each region must match
# the 'name' parameter of the region configuration in '[[regions]]'.
enabled_regions=[
"as923",
]
# API interface configuration.
[api]
# interface:port to bind the API interface to.
bind="0.0.0.0:8080"
# Secret.
#
# This secret is used for generating login and API tokens, make sure this
# is never exposed. Changing this secret will invalidate all login and API
# tokens. The following command can be used to generate a random secret:
# openssl rand -base64 32
secret="you-must-replace-this"
[integration]
enabled=["mqtt"]
[integration.mqtt]
event_topic="as923/application/{{application_id}}/device/{{dev_eui}}/event/{{event}}"
command_topic="as923/application/{{application_id}}/device/{{dev_eui}}/command/{{command}}"
server="tcp://localhost:1883/"
json=true
chirpstack-gateway-bridge.toml:
# This configuration provides a Semtech UDP packet-forwarder backend and
# integrates with a MQTT broker. Many options and defaults have been omitted
# for simplicity.
#
# See https://www.chirpstack.io/gateway-bridge/install/config/ for a full
# configuration example and documentation.
# Gateway backend configuration.
[backend]
# Backend type.
type="semtech_udp"
# Semtech UDP packet-forwarder backend.
[backend.semtech_udp]
# ip:port to bind the UDP listener to
#
# Example: 0.0.0.0:1700 to listen on port 1700 for all network interfaces.
# This is the listener to which the packet-forwarder forwards its data
# so make sure the 'serv_port_up' and 'serv_port_down' from your
# packet-forwarder matches this port.
udp_bind = "0.0.0.0:1700"
# Fake RX timestamp.
#
# Fake the RX time when the gateway does not have GPS, in which case
# the time would otherwise be unset.
fake_rx_time=false
# Integration configuration.
[integration]
# Payload marshaler.
#
# This defines how the MQTT payloads are encoded. Valid options are:
# * protobuf: Protobuf encoding
# * json: JSON encoding (easier for debugging, but less compact than 'protobuf')
marshaler="protobuf"
# MQTT integration configuration.
[integration.mqtt]
# Event topic template.
event_topic_template="as923/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
# Command topic template.
command_topic_template="as923/gateway/{{ .GatewayID }}/command/#"
# MQTT authentication.
[integration.mqtt.auth]
# Type defines the MQTT authentication type to use.
#
# Set this to the name of one of the sections below.
type="generic"
# Generic MQTT authentication.
[integration.mqtt.auth.generic]
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://127.0.0.1:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
region_as923.toml:
# This file contains an example AS923 configuration.
[[regions]]
# ID is an user-defined identifier for this region.
id="as923"
# Description is a short description for this region.
description="AS923"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="AS923"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Topic prefix.
#
# The topic prefix can be used to define the region of the gateway.
# Note, there is no need to add a trailing '/' to the prefix. The trailing
# '/' is automatically added to the prefix if it is configured.
topic_prefix="as923"
# Event topic template.
event_topic="as923/gateway/+/event/+"
# Command topic template.
command_topic="as923/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://localhost:1883"
# This file contains an example AS923 configuration.
[[regions]]
# ID is an user-defined identifier for this region.
id="as923"
# Description is a short description for this region.
description="AS923"
# Common-name refers to the common-name of this region as defined by
# the LoRa Alliance.
common_name="AS923"
# Gateway configuration.
[regions.gateway]
# Force gateways as private.
#
# If enabled, gateways can only be used by devices under the same tenant.
force_gws_private=false
# Gateway backend configuration.
[regions.gateway.backend]
# The enabled backend type.
enabled="mqtt"
# MQTT configuration.
[regions.gateway.backend.mqtt]
# Topic prefix.
#
# The topic prefix can be used to define the region of the gateway.
# Note, there is no need to add a trailing '/' to the prefix. The trailing
# '/' is automatically added to the prefix if it is configured.
topic_prefix="as923"
# Event topic template.
event_topic="as923/gateway/+/event/+"
# Command topic template.
command_topic="as923/gateway/{{ gateway_id }}/command/{{ command }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
# Quality of service level
#
# 0: at most once
# 1: at least once
# 2: exactly once
#
# Note: an increase of this value will decrease the performance.
# For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
qos=0
# Clean session
#
# Set the "clean session" flag in the connect message when this client
# connects to an MQTT broker. By setting this flag you are indicating
# that no messages saved by the broker for this client should be delivered.
clean_session=false
# Client ID
#
# Set the client id to be used by this client when connecting to the MQTT
# broker. A client id must be no longer than 23 characters. If left blank,
# a random id will be generated by ChirpStack.
client_id=""
# Keep alive interval.
#
# This defines the maximum time that that should pass without communication
# between the client and server.
keep_alive_interval="30s"
# CA certificate file (optional)
#
# Use this when setting up a secure connection (when server uses ssl://...)
# but the certificate used by the server is not trusted by any CA certificate
# on the server (e.g. when self generated).
ca_cert=""
# TLS certificate file (optional)
tls_cert=""
# TLS key file (optional)
tls_key=""
# Gateway channel configuration.
#
# Note: this configuration is only used in case the gateway is using the
# ChirpStack Concentratord daemon. In any other case, this configuration
# is ignored.
# [[regions.gateway.channels]]
# frequency=923200000
# bandwidth=125000
# modulation="LORA"
# spreading_factors=[7, 8, 9, 10, 11, 12]
#[[regions.gateway.channels]]
# frequency=923400000
# bandwidth=125000
# modulation="LORA"
# spreading_factors=[7, 8, 9, 10, 11, 12]
# Region specific network configuration.
[regions.network]
[[regions.network.extra_channels]]
frequency=922200000
[[regions.network.extra_channels]]
frequency=922400000
[[regions.network.extra_channels]]
frequency=922600000
[[regions.network.extra_channels]]
frequency=922800000
[[regions.network.extra_channels]]
frequency=923000000
[[regions.network.extra_channels]]
frequency=923200000
[[regions.network.extra_channels]]
frequency=923400000
[[regions.network.extra_channels]]
frequency=923600000
# Installation margin (dB) used by the ADR engine.
#
# A higher number means that the network-server will keep more margin,
# resulting in a lower data-rate but decreasing the chance that the
# device gets disconnected because it is unable to reach one of the
# surrounded gateways.
installation_margin=10
# RX window (Class-A).
#
# Set this to:
# 0: RX1 / RX2
# 1: RX1 only
# 2: RX2 only
rx_window=0
# RX1 delay (1 - 15 seconds).
rx1_delay=1
# RX1 data-rate offset
rx1_dr_offset=0
# RX2 data-rate
rx2_dr=2
# RX2 frequency (Hz)
rx2_frequency=923200000
# Prefer RX2 on RX1 data-rate less than.
#
# Prefer RX2 over RX1 based on the RX1 data-rate. When the RX1 data-rate
# is smaller than the configured value, then the Network Server will
# first try to schedule the downlink for RX2, failing that (e.g. the gateway
# has already a payload scheduled at the RX2 timing) it will try RX1.
rx2_prefer_on_rx1_dr_lt=0
# Prefer RX2 on link budget.
#
# When the link-budget is better for RX2 than for RX1, the Network Server will first
# try to schedule the downlink in RX2, failing that it will try RX1.
rx2_prefer_on_link_budget=false
# Downlink TX Power (dBm)
#
# When set to -1, the downlink TX Power from the configured band will
# be used.
#
# Please consult the LoRaWAN Regional Parameters and local regulations
# for valid and legal options. Note that the configured TX Power must be
# supported by your gateway(s).
downlink_tx_power=-1
# ADR is disabled.
adr_disabled=false
# Minimum data-rate.
min_dr=0
# Maximum data-rate.
max_dr=5
# Rejoin-request configuration (LoRaWAN 1.1)
[regions.network.rejoin_request]
# Request devices to periodically send rejoin-requests.
enabled=false
# The device must send a rejoin-request type 0 at least every 2^(max_count_n + 4)
# uplink messages. Valid values are 0 to 15.
max_count_n=0
# The device must send a rejoin-request type 0 at least every 2^(max_time_n + 10)
# seconds. Valid values are 0 to 15.
#
# 0 = roughly 17 minutes
# 15 = about 1 year
max_time_n=0
# Class-B configuration.
[regions.network.class_b]
# Ping-slot data-rate.
ping_slot_dr=3
# Ping-slot frequency (Hz)
#
# set this to 0 to use the default frequency plan for the configured region
# (which could be frequency hopping).
ping_slot_frequency=0
the code and configuration of my pygate:
global_config.json:
{
"SX1301_conf": {
"lorawan_public": true,
"clksrc": 1,
"clksrc_desc": "radio_1 provides clock to concentrator for most devices except MultiTech. For MultiTech set to 0.",
"antenna_gain": 0,
"antenna_gain_desc": "antenna gain, in dBi",
"lbt_cfg": {
"enable": true,
"rssi_target": -80,
"chan_cfg":[
{ "freq_hz": 923200000, "scan_time_us": 128 },
{ "freq_hz": 923400000, "scan_time_us": 128 },
{ "freq_hz": 922200000, "scan_time_us": 128 },
{ "freq_hz": 922400000, "scan_time_us": 128 },
{ "freq_hz": 922600000, "scan_time_us": 128 },
{ "freq_hz": 922800000, "scan_time_us": 128 },
{ "freq_hz": 923000000, "scan_time_us": 128 },
{ "freq_hz": 922000000, "scan_time_us": 128 }
],
"sx127x_rssi_offset": -4
},
"radio_0": {
"enable": true,
"type": "SX1257",
"freq": 923000000,
"rssi_offset": -166.0,
"tx_enable": true,
"tx_freq_min": 920000000,
"tx_freq_max": 923400000
},
"radio_1": {
"enable": true,
"type": "SX1257",
"freq": 922000000,
"rssi_offset": -166.0,
"tx_enable": false
},
"chan_multiSF_0": {
"desc": "Lora MAC, 125kHz, all SF, 923.2 MHz",
"enable": true,
"radio": 0,
"if": 200000
},
"chan_multiSF_1": {
"desc": "Lora MAC, 125kHz, all SF, 923.4 MHz",
"enable": true,
"radio": 0,
"if": 400000
},
"chan_multiSF_2": {
"desc": "Lora MAC, 125kHz, all SF, 922.2 MHz",
"enable": true,
"radio": 1,
"if": 200000
},
"chan_multiSF_3": {
"desc": "Lora MAC, 125kHz, all SF, 922.4 MHz",
"enable": true,
"radio": 1,
"if": 400000
},
"chan_multiSF_4": {
"desc": "Lora MAC, 125kHz, all SF, 922.6 MHz",
"enable": true,
"radio": 0,
"if": -400000
},
"chan_multiSF_5": {
"desc": "Lora MAC, 125kHz, all SF, 922.8 MHz",
"enable": true,
"radio": 0,
"if": -200000
},
"chan_multiSF_6": {
"desc": "Lora MAC, 125kHz, all SF, 923.0 MHz",
"enable": true,
"radio": 0,
"if": 0
},
"chan_multiSF_7": {
"desc": "Lora MAC, 125kHz, all SF, 922.0 MHz",
"enable": true,
"radio": 1,
"if": 0
},
"chan_Lora_std": {
"desc": "Lora MAC, 250kHz, SF7, 922.1 MHz",
"enable": true,
"radio": 1,
"if": 100000,
"bandwidth": 250000,
"spread_factor": 7
},
"chan_FSK": {
"desc": "FSK 50kbps, 921.8 MHz",
"enable": true,
"radio": 1,
"if": -200000,
"bandwidth": 125000,
"datarate": 50000
},
"tx_lut_0": {
"desc": "TX gain table, index 0",
"pa_gain": 0,
"mix_gain": 8,
"rf_power": -6,
"dig_gain": 0
},
"tx_lut_1": {
"desc": "TX gain table, index 1",
"pa_gain": 0,
"mix_gain": 10,
"rf_power": -3,
"dig_gain": 0
},
"tx_lut_2": {
"desc": "TX gain table, index 2",
"pa_gain": 0,
"mix_gain": 12,
"rf_power": 0,
"dig_gain": 0
},
"tx_lut_3": {
"desc": "TX gain table, index 3",
"pa_gain": 1,
"mix_gain": 8,
"rf_power": 3,
"dig_gain": 0
},
"tx_lut_4": {
"desc": "TX gain table, index 4",
"pa_gain": 1,
"mix_gain": 10,
"rf_power": 6,
"dig_gain": 0
},
"tx_lut_5": {
"desc": "TX gain table, index 5",
"pa_gain": 1,
"mix_gain": 12,
"rf_power": 10,
"dig_gain": 0
},
"tx_lut_6": {
"desc": "TX gain table, index 6",
"pa_gain": 1,
"mix_gain": 13,
"rf_power": 11,
"dig_gain": 0
},
"tx_lut_7": {
"desc": "TX gain table, index 7",
"pa_gain": 2,
"mix_gain": 9,
"rf_power": 12,
"dig_gain": 0
},
"tx_lut_8": {
"desc": "TX gain table, index 8",
"pa_gain": 1,
"mix_gain": 15,
"rf_power": 13,
"dig_gain": 0
},
"tx_lut_9": {
"desc": "TX gain table, index 9",
"pa_gain": 2,
"mix_gain": 10,
"rf_power": 14,
"dig_gain": 0
},
"tx_lut_10": {
"desc": "TX gain table, index 10",
"pa_gain": 2,
"mix_gain": 11,
"rf_power": 16,
"dig_gain": 0
},
"tx_lut_11": {
"desc": "TX gain table, index 11",
"pa_gain": 3,
"mix_gain": 9,
"rf_power": 20,
"dig_gain": 0
},
"tx_lut_12": {
"desc": "TX gain table, index 12",
"pa_gain": 3,
"mix_gain": 10,
"rf_power": 23,
"dig_gain": 0
},
"tx_lut_13": {
"desc": "TX gain table, index 13",
"pa_gain": 3,
"mix_gain": 11,
"rf_power": 25,
"dig_gain": 0
},
"tx_lut_14": {
"desc": "TX gain table, index 14",
"pa_gain": 3,
"mix_gain": 12,
"rf_power": 26,
"dig_gain": 0
},
"tx_lut_15": {
"desc": "TX gain table, index 15",
"pa_gain": 3,
"mix_gain": 14,
"rf_power": 27,
"dig_gain": 0
}
},
"gateway_conf": {
"gateway_ID": "32e35818f2fb812b",
"server_address": "10.1.1.97",
"serv_port_up": 1700,
"serv_port_down": 1700,
/* adjust the following parameters for your network */
"keepalive_interval": 10,
"stat_interval": 30,
"push_timeout_ms": 100,
/* forward only valid packets */
"forward_crc_valid": true,
"forward_crc_error": false,
"forward_crc_disabled": false,
"autoquit_threshold": 6,
"servers": [ {
"gateway_ID": "32e35818f2fb812b",
"server_address": "10.1.1.97",
"serv_port_up": 1700,
"serv_port_down": 1700,
"serv_enabled": true
} ]
}
}
main.py
from network import ETH
import time
from machine import RTC
import machine
eth = ETH()
eth.init()
#Conect to network
while not eth.isconnected():
print(‘Connecting to Ethernet…’)
time.sleep(1)
print(“ifconfig”,eth.ifconfig())
print(" OK\n")
Sync time via NTP server for GW timestamps on Events
print(‘Syncing RTC via ntp…’, end=‘’)
rtc = RTC()
rtc.ntp_sync(server=“pool.ntp.org”)
while not rtc.synced():
print(‘.’, end=‘’)
time.sleep(.5)
print(" OK\n")
Read the GW config file from Filesystem
fp = open(‘/flash/global_config.json’, ‘r’)
buf = fp.read()
Start the Pygate
machine.pygate_init(buf)
disable degub messages