diff --git a/hm_pyhelper/sbc.py b/hm_pyhelper/sbc.py index 741e443..38cc307 100644 --- a/hm_pyhelper/sbc.py +++ b/hm_pyhelper/sbc.py @@ -41,6 +41,53 @@ class DeviceVendorID(Enum): DeviceVendorID.RASPBERRY_PI: BALENA_ENV_RASPBERRY_PI_MODELS } +COMMERCIAL_FLEETS = [ + 156, # Bobcat + 56, # Controllino + 106, # COTX, + 53, # Finestra + 31, # Nebra Indoor 868MHz + 40, # Nebra Indoor RockPi 868MHz + 119, # Nebra Indoor 915MHz + 58, # Nebra Indoor RockPi 915MHz + 62, # Linxdot + 42, # Linxdot RKCM3 + 143, # Midas + 145, # Nebra indoor1 + 147, # Nebra indoor2 + 148, # Nebra outdoor1 + 149, # Nebra outdoor2 + 52, # Helium OG + 80, # Nebra Outdoor 868MHz + 107, # Nebra Outdoor 915MHz + 47, # PantherX + 66, # Pisces + 73, # Pycom + 88, # RAK + 114, # RisingHF + 124, # Sensecap + 90, # Syncrobit + 126, # Syncrobit RKCM3 + 98, # Nebra Indoor Testing + 158, # Bobcat Testing + 127, # Controllino Testing + 87, # COTX Testing, + 76, # Finestra Testing + 132, # Linxdot Testing + 84, # Linxdot RKCM3 Testing + 144, # Midas Testing + 128, # Helium OG Testing + 41, # PantherX Testing + 43, # Pisces Testing + 116, # Pycom Testing + 113, # RAK Testing + 103, # RisingHF Testing + 60, # Nebra RockPi Testing + 137, # Sensecap Testing + 57, # Syncrobit Testing + 111, # Syncrobit RKCM3 Testing + 2006816, # Rob Testing +] def device_model(): with open('/proc/device-tree/model', 'r') as f: @@ -76,3 +123,17 @@ def is_sbc_type(device_id: DeviceVendorID) -> bool: # honor env override return device_type in BALENA_MODELS.get(device_id, []) + + +def is_commercial_fleet() -> bool: + ''' + Return true if the device is in a commercial fleet. Otherwise return false. + ''' + fleet_name = os.environ.get('BALENA_APP_NAME') + fleet_id = int(os.environ.get('BALENA_APP_ID')) + + if not fleet_name.endswith('-c') or fleet_id not in COMMERCIAL_FLEETS: + return False + + return True + diff --git a/pyproject.toml b/pyproject.toml index 9f2d3b1..bd578f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "hm_pyhelper" -version = "0.14.14" +version = "0.14.15" description = "Helium Python Helper" authors = ["Nebra Ltd "] readme = "README.md"