Closed jfcloutier closed 3 years ago
I ran the specified instructions on an empty project, filled accordingly. Used JITR (self-signed CA auto registration). But it runs the publish command without throwing any errors but it does not send a successful request. Can you check it? Thanks
There are a lot of factors at play here. Does the socket connect, but the registration never happens? Does it connect, drop, then repeat? I would expect some errors here. If not in Jackalope, then at least in AWS.
This case of "connect without failure" is most commonly related to JITR setup. Either on the AWS side or a bad/malformed/mismatched/missing signer CA in the request cacerts
option
I tried the same scenario without JITR (manually registered the device certificate on AWS) but still no publishing event occurs. I didn't see any connection drops, nor error messages. Here are the logs
00:18:12.338 [info] [Jackalope] Starting Jackalope.Session...
00:18:12.341 [info] [Jackalope] Starting supervisor
00:18:12.349 [info] [Jackalope] Starting Tortoise client with [handler: {Tortoise.Handler.Logger, []}, client_id: "testdev2", connection_options: [server: {Tortoise.Transport.SSL, [verify: :verify_peer, host: 'redacted-ats.iot.eu-central-1.amazonaws.com', port: 443, alpn_advertised_protocols: ["x-amzn-mqtt-ca"], server_name_indication: '*.iot.eu-central-1.amazonaws.com', cert: <<xxxxxxxxxxxxxxxxxxx, 72, 134, ...>>, keyfile: "/srv/erlang/lib/network_led-0.1.0/priv/testdev01.private.key", cacerts: [<<xxxx, ...>>], versions: [:"tlsv1.2"], partial_chain: #Function<0.11060291/1 in NetworkLed."-fun.partial_chain/1-">]}, will: nil, backoff: [min_interval: 100, max_interval: 30000]]]
00:18:12.350 [info] [Jackalope] Spawning Tortoise connection
00:18:12.352 [info] [Jackalope] Starting Tortoise watchdog
00:18:12.698 [debug] wpa_supplicant: wlan0: Trying to associate with SSID 'WifiTest'
00:18:12.816 [info] WPASupplicant ignoring {:event, "WPS-AP-AVAILABLE"}
00:18:12.817 [info] wpa_supplicant(wlan0): Trying to associate with SSID 'WifiTest'
00:18:13.334 [debug] wpa_supplicant: wlan0: Associated with 00:00:00:00
00:18:13.336 [debug] wpa_supplicant: wlan0: CTRL-EVENT-CONNECTED - Connection to 00:00:00:00 completed [id=0 id_str=]
00:18:13.343 [info] wpa_supplicant(wlan0): Associated with 00:00:00:00
00:18:13.354 [info] Connected to AP: 00:00:00:00
00:18:13.367 [info] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
00:18:13.380 [info] WPASupplicant ignoring {:event, "CTRL-EVENT-SUBNET-STATUS-UPDATE", %{"status" => "0"}}
00:18:13.383 [info] WPASupplicant ignoring {:event, "CTRL-EVENT-REGDOM-CHANGE", %{"alpha2" => "TR", "init" => "COUNTRY_IE", "type" => "COUNTRY"}}
00:18:13.785 [debug] udhcpc(wlan0): udhcpc: sending discover
00:18:14.027 [debug] udhcpc(wlan0): udhcpc: sending select for 192.168.1.23
00:18:17.075 [debug] udhcpc(wlan0): udhcpc: sending select for 192.168.1.23
00:18:17.172 [debug] udhcpc(wlan0): udhcpc: lease of 192.168.1.23 obtained, lease time 86400
00:18:17.212 [info] RouteManager: set_route wlan0 -> :lan
00:18:20.945 [info] RouteManager: set_connection_status wlan0 -> :internet
00:18:22.384 [info] Connected.
00:18:22.384 [info] Start publishing.
00:18:22.385 [info] Finish publishing.
And here is the piece of code I'm using to publish messages
Logger.info("Connected.")
Logger.info("Start publishing.")
Jackalope.publish("sensor/test", "Hello from Nerves")
Logger.info("Finish publishing.")
Which runs every 10 seconds on a GenServer. Could it be related to handler?
This is replaced by a forthcoming Nerves example (hello_mqtt
) that will be found under nerves-project
I don't have a strong opinion either way. What do you see as the incentives?