NebraLtd / helium-rak

Nebra OpenFleet for RAK v1.5, v2 and MNTD Miners
https://nebra.io/rak
MIT License
14 stars 13 forks source link

Packet forwarder not working #16

Closed uros76 closed 1 year ago

uros76 commented 2 years ago

Hi. I have forked the fleet and added my MNTD blackspot hotspot to the dashboard. However, the miner doesn't seem to be working.

Are there any specific variable settings I need to make?

I get this error:
image

pritamghanghas commented 2 years ago

you need a VARIANT env variable to be defined to match your hardware. Take a look at hardware_definitions.py in hm-pyhelper.

Regards, Nebra

On Tue, 30 Aug 2022 at 14:15, uros76 @.***> wrote:

Hi. I have forked the fleet and added my hotspot to the dashboard. However, the miner doesn't seem to be working.

Are there any specific variable settings I need to make?

I get this error: [image: image] https://user-images.githubusercontent.com/25409772/187390578-61557d95-b153-4ad3-ab67-2f114331ed21.png

— Reply to this email directly, view it on GitHub https://github.com/NebraLtd/helium-rak/issues/16, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABU3SV4L6HVPQXIFJA5PGBDV3XC4FANCNFSM6AAAAAAQAFRUMM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

uros76 commented 2 years ago

Okay, found the value matching RAK/MNTD and now put it as device variable. Now I get this is log... keyerror: variant

Not sure is this correct way? image

Turb0n00by commented 2 years ago

Name Value Service Device overrides Actions VARIANT COMP-RAKHM All services

Sent from my iPhone

On Aug 30, 2022, at 7:29 AM, uros76 @.***> wrote:

 Okay, found the value matching RAK/MNTD and now put it as device variable. Now I get this is log... keyerror: variant

Not sure is this correct way?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

uros76 commented 2 years ago

Awesome! This helped and now it seems the diagnostics container is working.

However, I see now gateway-config container struggling to work. I rebooted it but still see this error in the live log window... RuntimeError: Failed to add edge detection Is there some additional variable I need to set?

image

I can't even connect to it: image

Turb0n00by commented 2 years ago

Nah you're ok there. I thought that was an error sometime ago but you should be ok. Expect a day or so for everything to "settle" The dashboard is a great monitoring tool.

On Tue, Aug 30, 2022 at 7:56 AM uros76 @.***> wrote:

Awesome! This helped and now it seems the diagnostics container is working.

However, I see now gateway-config container struggling to work. I rebooted it but still see this error in the live log window... RuntimeError: Failed to add edge detection Is there some additional variable I need to set?

[image: image] https://user-images.githubusercontent.com/25409772/187442114-c1e48a7d-b958-45cc-b8b6-badda1cf8aaf.png

— Reply to this email directly, view it on GitHub https://github.com/NebraLtd/helium-rak/issues/16#issuecomment-1231629510, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMGFQAURO7NJBONROIWTXS3V3YAHZANCNFSM6AAAAAAQAFRUMM . You are receiving this because you commented.Message ID: @.***>

uros76 commented 2 years ago

Okay will let it work and hope that gateway-config survives :) Thanks again for help

uros76 commented 2 years ago

Hi. I let it run since yesterday and I think there is still something wrong with gateway-config. Device diagnostics on the dashboard says it's failed and restarted many times... image

Any ideas how to get it working? Or this is not really needed?

VeniceInventors commented 1 year ago

Same issue here.

I added the variable and keep getting the gateway-config RuntimeError: Failed to add edge detection error in the log, which then causes the gateway-config service to go in a "stop and restart" loop.

Also packet-forwarder stops and restarts with the error: json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 7 column 28 (char 168)

Here these issues only happen with the image from https://hub.balena.io/organizations/nebraltd/fleets/HELIUM-RAK forked to my own fleet on Balena. When using the (seemingly*) same image from the above URL without forking it, it seems to be fine, or at least the local diagnostic page shows the radio as being operational so the packet forwarder is working, but that's all I know as I can't access the Balena dashboard to see the logs (not sure where to pull the logs from via ssh). [edit] found the logs in /mnt/data/docker/volumes/1914219_miner-log/_data/ and /mnt/data/docker/volumes/1914219_watchdog-log/_data/ [/edit]

*My understanding is that only the config.json differs between my forked balena-cloud-nebra-rak-raspberrypi4-64-2.105.1+rev1-v14.2.0.img and the original balena-cloud-HELIUM-RAK-raspberrypi4-64-2.105.1+rev1-v14.2.0.img so my guess is there must be some additional settings or variables on the HELIUM-RAK fleet that would be missing in the forked fleet, like that VARIANT variable.

uros76 commented 1 year ago

I have this set on the fleet and it works despite endless gateway-config errors image

VeniceInventors commented 1 year ago

I have this set on the fleet and it works despite endless gateway-config errors Are you using the *-raspberrypi4-64-2.105.1+rev1-v14.2.0.img image?

My understanding is that the gateway-config is only used access to the diagnostics and wifi config via bluetooth so the hotspot would still be able to witness and transfer data. however with the current image it looks like the packet forwarder is broken too so the radio is down. https://github.com/NebraLtd/hm-pktfwd/issues/108

uros76 commented 1 year ago

Ok, that's new for me. I have my fleet on this image

VeniceInventors commented 1 year ago

Ah yes that's why, your screenshot shows firmware 2022.08.17.5, while the latest is 2022.08.17.6-2 but the last working one appears to be 2022.08.17.6

uros76 commented 1 year ago

Ah yes that's why, your screenshot shows firmware 2022.08.17.5, while the latest is 2022.08.17.6-2 but the last working one appears to be 2022.08.17.6

That is exactly the reason I am letting mine keep running on 2022.08.17.5. They work just fine with the previous fw. My fleet on balena dashboard has this old release and I can add future release to existing fleet anytime. I wish there would be a way to share my old forked release with you?

Turb0n00by commented 1 year ago

Ah yes that's why, your screenshot shows firmware 2022.08.17.5, while the latest is 2022.08.17.6-2 but the last working one appears to be 2022.08.17.6

That is exactly the reason I am letting mine keep running on 2022.08.17.5. They work just fine with the previous fw. My fleet on balena dashboard has this old release and I can add future release to existing fleet anytime. I wish there would be a way to share my old forked release with you?

You can revert to older images assuming you have ran/forked them in the past.

Select your device

Screenshot 2022-10-07 at 6 08 19 AM

Select Pin to release

Screenshot 2022-10-07 at 6 08 24 AM

Select version

Screenshot 2022-10-07 at 6 08 31 AM
VeniceInventors commented 1 year ago

Good to know, unfortunately I only forked the current fleet release so the menu only shows that one.

However it's possible to switch the GitHub repo URL when forking the nebra-rak fleet image

so I've forked their GitHub repository and edited the docker-compose.yml, to make it match the sept. 9 version from their repo's history. I'll try that to see what happens. [edit] That didn't work, I'm still getting FIRMWARE_VERSION=2022.08.17.6-2 Either balena built the image from the parent repo instead of the forked one, or the hotspot automatically updated itself to the latest firmware after booting. [/edit] [edit2] Got the packet forwarder working with the previous release. I do get the gateway-config errors but that issue seems to have been there in release 2022.08.17.5 already. I'll try to find the cause, [/edit2]

Turb0n00by commented 1 year ago

Your variable should read as: COMP-RAKHM

Sent from my iPhone

On Aug 30, 2022, at 7:29 AM, uros76 @.***> wrote:

 Okay, found the value matching RAK/MNTD and now put it as device variable. Now I get this is log... keyerror: variant

Not sure is this correct way?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

shawaj commented 1 year ago

@uros76 do you still get these gateway config errors on this RAK firmware?

uros76 commented 1 year ago

@uros76 do you still get these gateway config errors on this RAK firmware?

No, once I setup correct variable on fleet it works fine. I also recently updated fleet with latest release, all works ok.

shawaj commented 1 year ago

Awesome, will close this issue then 🙂

VeniceInventors commented 1 year ago

Awesome, will close this issue then slightly_smiling_face

The packet forwarder is working but the gateway config error remains here with RAK v2 (mntd blackspot). It keeps causing the python script to abort and restart. The gpio pin number used for the side button seems to be cause of the problem, or something else is preventing the GPIO.add_event_detect() function from succeeding. See the gateway-config log below. I could be wrong but it seems the button is connected to the RAK2003 Pi HAT's MCU rather than one of the GPIO pins.

22.04.23 04:34:12 (-0700)  gateway-config  Waiting to connect to bluetoothd..
Agent registered
[CHG] Controller E4:5F:01:B2:FD:12 Pairable: yes
22.04.23 04:34:12 (-0700)  gateway-config  [bluetooth]# pairable off
22.04.23 04:34:12 (-0700)  gateway-config  [bluetooth]# quit
FREQ variable is already set as N/A (Non Nebra Miner).
22.04.23 04:34:12 (-0700)  gateway-config  VARIANT variable is already set as COMP-RAKHM.
22.04.23 04:34:12 (-0700)  gateway-config  All required environment variables have been set.
22.04.23 04:34:12 (-0700)  gateway-config  method return time=1682163252.036938 sender=org.freedesktop.DBus -> destination=:1.127 serial=3 reply_serial=2
22.04.23 04:34:12 (-0700)  gateway-config     array [
22.04.23 04:34:12 (-0700)  gateway-config        string "org.freedesktop.DBus"
22.04.23 04:34:12 (-0700)  gateway-config        string ":1.127"
22.04.23 04:34:12 (-0700)  gateway-config     ]
22.04.23 04:34:12 (-0700)  gateway-config  DBus is now accepting connections
22.04.23 04:34:12 (-0700)  gateway-config  libmraa[11]: libmraa version v2.1.0-24-gbd91964 initialised by user 'root' with EUID 0
22.04.23 04:34:12 (-0700)  gateway-config  libmraa[11]: gpio: platform doesn't support chardev, falling back to sysfs
22.04.23 04:34:12 (-0700)  gateway-config  libmraa[11]: libmraa initialised for platform 'Raspberry Pi Model B Rev 1' of type 5
22.04.23 04:34:13 (-0700)  gateway-config  2023-04-22 11:34:13,213 - [DEBUG] - __main__ - (__main__.py).validate_env -- /opt/gatewayconfig/__main__.py:(34) - Starting with the following ENV:
22.04.23 04:34:13 (-0700)  gateway-config          SENTRY_DSN=None
22.04.23 04:34:13 (-0700)  gateway-config          BALENA_APP_NAME=balenamntd
22.04.23 04:34:13 (-0700)  gateway-config          BALENA_DEVICE_UUID=e62a463a5d15eeecf078862dd4bb0823
22.04.23 04:34:13 (-0700)  gateway-config          VARIANT=COMP-RAKHM
22.04.23 04:34:13 (-0700)  gateway-config          ETH0_MAC_ADDRESS_FILEPATH=/sys/class/net/eth0/address
22.04.23 04:34:13 (-0700)  gateway-config          WLAN0_MAC_ADDRESS_FILEPATH=/sys/class/net/wlan0/address
22.04.23 04:34:13 (-0700)  gateway-config          DIAGNOSTICS_JSON_URL=http://diagnostics/json
22.04.23 04:34:13 (-0700)  gateway-config          ETHERNET_IS_ONLINE_FILEPATH=/sys/class/net/eth0/carrier
22.04.23 04:34:13 (-0700)  gateway-config          FIRMWARE_VERSION=v1.0.2-3
22.04.23 04:34:13 (-0700)  gateway-config  
22.04.23 04:34:13 (-0700)  gateway-config  Traceback (most recent call last):
22.04.23 04:34:13 (-0700)  gateway-config    File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
22.04.23 04:34:13 (-0700)  gateway-config      return _run_code(code, main_globals, None,
22.04.23 04:34:13 (-0700)  gateway-config    File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
22.04.23 04:34:13 (-0700)  gateway-config      exec(code, run_globals)
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/gatewayconfig/__main__.py", line 77, in <module>
22.04.23 04:34:13 (-0700)  gateway-config      main()
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/gatewayconfig/__main__.py", line 30, in main
22.04.23 04:34:13 (-0700)  gateway-config      start()
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/gatewayconfig/__main__.py", line 57, in start
22.04.23 04:34:13 (-0700)  gateway-config      config_app = GatewayconfigApp(
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/gatewayconfig/gatewayconfig_app.py", line 43, in __init__
22.04.23 04:34:13 (-0700)  gateway-config      self.init_gpio(variant)
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/gatewayconfig/gatewayconfig_app.py", line 136, in init_gpio
22.04.23 04:34:13 (-0700)  gateway-config      self.user_button = Button(btn, hold_time=USER_BUTTON_HOLD_SECONDS)
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/venv/lib/python3.9/site-packages/gpiozero/devices.py", line 108, in __call__
22.04.23 04:34:13 (-0700)  gateway-config      self = super(GPIOMeta, cls).__call__(*args, **kwargs)
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/venv/lib/python3.9/site-packages/gpiozero/input_devices.py", line 414, in __init__
22.04.23 04:34:13 (-0700)  gateway-config      super(Button, self).__init__(
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/venv/lib/python3.9/site-packages/gpiozero/mixins.py", line 433, in __init__
22.04.23 04:34:13 (-0700)  gateway-config      super(HoldMixin, self).__init__(*args, **kwargs)
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/venv/lib/python3.9/site-packages/gpiozero/input_devices.py", line 171, in __init__
22.04.23 04:34:13 (-0700)  gateway-config      self.pin.when_changed = self._pin_changed
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/venv/lib/python3.9/site-packages/gpiozero/pins/__init__.py", line 432, in <lambda>
22.04.23 04:34:13 (-0700)  gateway-config      lambda self, value: self._set_when_changed(value),
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/venv/lib/python3.9/site-packages/gpiozero/pins/pi.py", line 319, in _set_when_changed
22.04.23 04:34:13 (-0700)  gateway-config      self._enable_event_detect()
22.04.23 04:34:13 (-0700)  gateway-config    File "/opt/venv/lib/python3.9/site-packages/gpiozero/pins/rpigpio.py", line 226, in _enable_event_detect
22.04.23 04:34:13 (-0700)  gateway-config      GPIO.add_event_detect(
22.04.23 04:34:13 (-0700)  gateway-config  RuntimeError: Failed to add edge detection
shawaj commented 1 year ago

@VeniceInventors please create a new issue if you still have something not working.

shawaj commented 1 year ago

Also @VeniceInventors FYI the issue you describe with the config container is usually because you haven't configured the config variables correctly.

Specifically the spi0-1cs one

VeniceInventors commented 1 year ago

Also @VeniceInventors FYI the issue you describe with the config container is usually because you haven't configured the config variables correctly.

Specifically the spi0-1cs one

@shawaj Thanks for the hint.

I didn't know about that variable, I'm using the nebra-helium-rak balena image 2.113.18, and the only variables I see that came pre-defined are:

FREQ -> N/A (Non Nebra Miner) HELIUM_MINER_HEIGHT_URL -> https://api.helium.io/v1/blocks/height VARIANT -> COMP-RAKHM

Is there a document somewhere which covers the spi0-1cs variable? I don't want to take up your time if I can figure it out by reading some docs.

Should I create a new issue as well? Since it happens with the stock image, I'm guessing it happens to all the RAK users.

shawaj commented 1 year ago

@VeniceInventors where did you get that image from?

And how did you install on BalenaCloud?

Easiest way is using the deploy with Balena button here... https://github.com/NebraLtd/helium-rak#forking-fleet-installation-requires-updating-manually--setting-up-own-automations

shawaj commented 1 year ago

Also FYI you can see all the required variables here: https://github.com/NebraLtd/helium-rak/blob/17ae057412f819180878a621d899bc0057df2416/balena.yml#L26-L43

VeniceInventors commented 1 year ago

@VeniceInventors where did you get that image from?

And how did you install on BalenaCloud?

Easiest way is using the deploy with Balena button here... https://github.com/NebraLtd/helium-rak#forking-fleet-installation-requires-updating-manually--setting-up-own-automations @shawaj That's how I deployed it, from the link above, downloaded the image from https://dashboard.balena-cloud.com/deploy?repoUrl=https://github.com/NebraLtd/helium-rak and flashed it, and added it to my balena hub fleet.

VeniceInventors commented 1 year ago

@shawaj I found the RESIN_HOST_CONFIG_dtoverlay: '"spi0-1cs","vc4-kms-v3d"' setting in the "Device Configuration" tab of balena.

It was set to "spi0-1cs","vc4-kms-v3d" for the fleet, but only to "vc4-kms-v3d" for the device itself. I don't know why as I didn't touch these variables. I added the "spi0-1cs" and rebooted, and now the gateway-config is working as intended.

Thank you for your help!