Created
February 21, 2024 23:24
-
-
Save ternus/e75f260a45c09419cb16daaae8b41432 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================================================================== | |
# Packages / M3000 | |
# @file packages/m3000.yaml | |
# Adapted from https://gist.github.com/dale3h/b1c4e571947438728164dbe2ead728ec | |
# IMPORTANT: Enable packages in `configuration.yaml` | |
# @see https://www.home-assistant.io/docs/configuration/packages/ | |
# | |
# @notes Set `input_text.m3000_host` to the IP address of your Verizon | |
# Jetpack hotspot. | |
# @notes Set `input_number.m3000_data_cap` to the amount of data that | |
# you are allotted. This is usually either 100GB or 150GB in the US. | |
# ============================================================================== | |
# ============================================== | |
# Input Text | |
# ============================================== | |
input_text: | |
m3000_host: | |
name: M3000 Host | |
icon: mdi:server | |
initial: 192.168.10.1 | |
# ============================================== | |
# Input Number | |
# ============================================== | |
input_number: | |
m3000_data_cap: | |
name: M3000 Data Cap | |
icon: mdi:swap-horizontal | |
initial: 150 | |
min: 0 | |
max: 1000 | |
step: 1 | |
mode: box | |
unit_of_measurement: GB | |
# ============================================== | |
# Sensor | |
# ============================================== | |
sensor: | |
# ============================== | |
# Usage Info | |
# ============================== | |
- platform: rest | |
name: M3000 Usage | |
unique_id: m3000_usage | |
resource_template: "http://{{ states('input_text.m3000_host') }}/apps_home/usageinfo/" | |
value_template: "OK" | |
json_attributes: | |
- allowance | |
- barLevelLineUsage | |
- barLevelTotalShrUsage | |
- barPercentageLineUsage | |
- barPercentageTotalShrUsage | |
- cycleEndDt | |
- daysLeft | |
- gBaseAssetsPath | |
- gHelpURL | |
- gHtmlLang | |
- gIsLoggedIn | |
- gLangDirection | |
- gLocale | |
- gPageId | |
- gProductName | |
- gProductNumber | |
- gSecureToken | |
- isHidden | |
- lineUsage | |
- planType | |
- remainingUsage | |
- totalShrUsage | |
- unit | |
- usageInformationState | |
- usageTimestamp | |
# ============================== | |
# Status Info | |
# ============================== | |
- platform: rest | |
name: M3000 Status | |
unique_id: m3000_status | |
resource_template: "http://{{ states('input_text.m3000_host') }}/srv/status" | |
value_template: "OK" | |
json_attributes_path: "$.statusData" | |
json_attributes: | |
- statusBarAirplaneMode | |
- statusBarBatteryChargingSource | |
- statusBarBatteryChargingState | |
- statusBarBatteryDetection | |
- statusBarBatteryPercent | |
- statusBarBand | |
- statusBarBandwidth | |
- statusBarBytesReceived | |
- statusBarBytesTotal | |
- statusBarBytesTransmitted | |
- statusBarClientListSize | |
- statusBarConnectionDuration | |
- statusBarConnectionState | |
- statusBarFemtoCellStatus | |
- statusBarGpsStatus | |
- statusBarGuestClientListSize | |
- statusBarGuestWifiEnabled | |
- statusBarMaxWiFiClientListSize | |
- statusBarMnsAvailable | |
- statusBarMnsInUse | |
- statusBarMnsScan | |
- statusBarMobileDataEnabled | |
- statusBarNetwork | |
- statusBarNetworkID | |
- statusBarNotificationFlag | |
- statusBarPrimaryClientListSize | |
- statusBarPCI | |
- statusBarRoaming | |
- statusBarSdCardFreeSpace | |
- statusBarSdCardInUse | |
- statusBarSdCardStatus | |
- statusBarSdCardUsedSpace | |
- statusBarSignalBars | |
- statusBarSimStatus | |
- statusBarSNR | |
- statusBarSmsUnreadCount | |
- statusBarTechnology | |
- statusBarTechnologyText | |
- statusBarTrafficStatus | |
- statusBarWiFiClientListSize | |
- statusBarWiFiEnabled | |
# ============================================== | |
# Template | |
# ============================================== | |
template: | |
# ============================== | |
# Status Info Sensors | |
# ============================== | |
- sensor: | |
# ============== | |
# Battery | |
# ============== | |
- name: M3000 Battery Charging Source | |
unique_id: m3000_status_BatteryChargingSource | |
icon: >- | |
{% set icon_key = state_attr('sensor.m3000_status', 'statusBarBatteryChargingSource') | lower %} | |
{% set icons = { | |
'chargingsourceac': 'mdi:power-plug', | |
'chargingsourceusb': 'mdi:usb-port', | |
'chargingsourcenone': 'mdi:power-plug-off' | |
} %} | |
{{ icons[icon_key] | default('mdi:power-plug-off') }} | |
state: >- | |
{% if is_state_attr('sensor.m3000_status', 'statusBarBatteryChargingSource', 'ChargingSourceAC') %} | |
AC | |
{% elif is_state_attr('sensor.m3000_status', 'statusBarBatteryChargingSource', 'ChargingSourceUSB') %} | |
USB | |
{% elif is_state_attr('sensor.m3000_status', 'statusBarBatteryChargingSource', 'ChargingSourceNone') %} | |
None | |
{% else %} | |
{{ state_attr('sensor.m3000_status', 'statusBarBatteryChargingSource') }} | |
{% endif %} | |
- name: M3000 Battery Level | |
unique_id: m3000_status_BatteryPercent | |
unit_of_measurement: "%" | |
device_class: battery | |
state_class: measurement | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarBatteryPercent') }} | |
# ============== | |
# Connection | |
# ============== | |
- name: M3000 Connection Duration | |
unique_id: m3000_status_ConnectionDuration | |
icon: mdi:web-clock | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarConnectionDuration') }} | |
unit_of_measurement: seconds | |
- name: M3000 Connection State | |
unique_id: m3000_status_ConnectionState | |
icon: >- | |
{% set icon_key = state_attr('sensor.m3000_status', 'statusBarConnectionState') | lower %} | |
{% set icons = { | |
'initializing': 'mdi:web-sync', | |
'searching': 'mdi:web-sync', | |
'ready': 'mdi:web-check', | |
'connecting': 'mdi:web-sync', | |
'connected': 'mdi:web-check', | |
'dormant': 'mdi:web-clock', | |
'disconnecting': 'mdi:web-minus', | |
'activation in progress': 'mdi:web-sync', | |
'no service': 'mdi:web-off', | |
'unactivated': 'mdi:web-off', | |
'account restricted (pco 2)': 'mdi:web-cancel', | |
'account restricted (pco 2) disconnected': 'mdi:web-cancel', | |
'account out of credit (pco 3)': 'mdi:web-cancel', | |
'account not active (pco 5)': 'mdi:web-cancel', | |
} %} | |
{{ icons[icon_key] | default('mdi:web-remove') }} | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarConnectionState') }} | |
- name: M3000 Traffic Status | |
unique_id: m3000_status_TrafficStatus | |
icon: >- | |
{% set icon_key = state_attr('sensor.m3000_status', 'statusBarTrafficStatus') | lower %} | |
{% set icons = { | |
'none': 'mdi:wifi-remove', | |
'uplink': 'mdi:wifi-arrow-up', | |
'downlink': 'mdi:wifi-arrow-down', | |
'uplinkdownlink': 'mdi:wifi-arrow-up-down', | |
} %} | |
{{ icons[icon_key] | default('mdi:wifi-arrow-up-down') }} | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarTrafficStatus') }} | |
# ============== | |
# WiFi / Devices / Clients | |
# ============== | |
- name: M3000 Clients | |
unique_id: m3000_status_ClientListSize | |
icon: mdi:devices | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarClientListSize') }} | |
state_class: measurement | |
- name: M3000 Primary Clients | |
unique_id: m3000_status_PrimaryClientListSize | |
icon: mdi:devices | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarPrimaryClientListSize') }} | |
state_class: measurement | |
- name: M3000 Guest Clients | |
unique_id: m3000_status_GuestClientListSize | |
icon: mdi:devices | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarGuestClientListSize') }} | |
state_class: measurement | |
- name: M3000 WiFi Clients | |
unique_id: m3000_status_WiFiClientListSize | |
icon: mdi:devices | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarWiFiClientListSize') }} | |
state_class: measurement | |
- name: M3000 Max WiFi Clients | |
unique_id: m3000_status_MaxWiFiClientListSize | |
icon: mdi:devices | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarMaxWiFiClientListSize') }} | |
state_class: measurement | |
# ============== | |
# GPS | |
# ============== | |
- name: M3000 GPS Status | |
unique_id: m3000_status_GpsStatus | |
icon: mdi:crosshairs-gps | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarGpsStatus') | replace('GpsOff', 'Off') }} | |
# ============== | |
# Network | |
# ============== | |
- name: M3000 Network | |
unique_id: m3000_status_Network | |
icon: mdi:signal | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarNetwork') }} | |
- name: M3000 Network ID | |
unique_id: m3000_status_NetworkID | |
icon: mdi:signal | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarNetworkID') }} | |
- name: M3000 Band | |
unique_id: m3000_status_Band | |
icon: mdi:radio-tower | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarBand')|trim }} | |
- name: M3000 PCI | |
unique_id: m3000_status_PCI | |
icon: mdi:radio-tower | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarPCI') }} | |
- name: M3000 Bandwidth | |
unique_id: m3000_status_Bandwidth | |
icon: mdi:signal | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarBandwidth').rstrip().split(' ')[1] }} | |
device_class: frequency | |
unit_of_measurement: MHz | |
- name: M3000 Signal | |
unique_id: m3000_status_SignalBars | |
icon: >- | |
{% set signal = state_attr('sensor.m3000_status', 'statusBarSignalBars') | int(0) %} | |
{% if signal >= 3 %} | |
mdi:signal-cellular-3 | |
{% elif signal >= 2 %} | |
mdi:signal-cellular-2 | |
{% elif signal >= 1 %} | |
mdi:signal-cellular-1 | |
{% else %} | |
mdi:signal-cellular-outline | |
{% endif %} | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarSignalBars') }} | |
unit_of_measurement: bars | |
# device_class: signal_strength | |
state_class: measurement | |
- name: M3000 SNR | |
unique_id: m3000_status_SNR | |
icon: mdi:signal | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarSNR') | int(0) }} | |
# device_class: signal_strength | |
state_class: measurement | |
unit_of_measurement: dBm | |
- name: M3000 Bytes Received | |
unique_id: m3000_status_bytes_received | |
icon: mdi:signal | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarBytesReceived') | int(0) }} | |
state_class: total_increasing | |
unit_of_measurement: B | |
device_class: data_size | |
- name: M3000 Bytes Transmitted | |
unique_id: m3000_status_bytes_sent | |
icon: mdi:signal | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarBytesTransmitted') | int(0) }} | |
unit_of_measurement: B | |
state_class: total_increasing | |
device_class: data_size | |
- name: M3000 Bytes Total | |
unique_id: m3000_status_bytes_received | |
icon: mdi:signal | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarBytesTotal') | int(0) }} | |
state_class: total_increasing | |
unit_of_measurement: B | |
device_class: data_size | |
- name: M3000 Technology | |
unique_id: m3000_status_Technology | |
icon: mdi:signal | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarTechnology') }} | |
- name: M3000 Technology Text | |
unique_id: m3000_status_TechnologyText | |
icon: mdi:signal-cellular-3 | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarTechnologyText') }} | |
# ============== | |
# SIM | |
# ============== | |
- name: M3000 SIM Status | |
unique_id: m3000_status_SimStatus | |
icon: mdi:sim | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarSimStatus') }} | |
# ============== | |
# Notifications | |
# ============== | |
- name: M3000 SMS Unread Count | |
unique_id: m3000_status_SmsUnreadCount | |
icon: >- | |
{% if state_attr('sensor.m3000_status', 'statusBarSmsUnreadCount') | int(0) %} | |
mdi:message-alert | |
{% else %} | |
mdi:message | |
{% endif %} | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarSmsUnreadCount') }} | |
# ============================================== | |
# Usage Info Binary Sensors | |
# ============================================== | |
- binary_sensor: | |
- name: M3000 Usage Information State | |
unique_id: m3000_usage_usageInformationState | |
icon: >- | |
{% set icon_key = state_attr('sensor.m3000_usage', 'usageInformationState') | lower %} | |
{% set icons = { | |
'unavailable': 'mdi:close-network', | |
'available': 'mdi:check-network', | |
} %} | |
{{ icons[icon_key] | default('mdi:help-network') }} | |
state: >- | |
{{ is_state_attr('sensor.m3000_usage', 'usageInformationState', 'available') }} | |
# ============================================== | |
# Status Info Binary Sensors | |
# ============================================== | |
- binary_sensor: | |
# ============== | |
# Network | |
# ============== | |
- name: M3000 Airplane Mode | |
unique_id: m3000_status_AirplaneMode | |
icon: >- | |
{% set icon_key = state_attr('sensor.m3000_status', 'statusBarAirplaneMode') | lower %} | |
{% set icons = { | |
'airplanemodeon': 'mdi:airplane', | |
'airplanemodeoff': 'mdi:airplane-off', | |
'lowbatteryoff': 'mdi:airplane-alert' | |
} %} | |
{{ icons[icon_key] | default('mdi:airplane') }} | |
state: >- | |
{{ not is_state_attr('sensor.m3000_status', 'statusBarAirplaneMode', 'AirplaneModeOff') }} | |
- name: M3000 Mobile Data Enabled | |
unique_id: m3000_status_MobileDataEnabled | |
icon: >- | |
{% if state_attr('sensor.m3000_status', 'statusBarMobileDataEnabled') | int(0) %} | |
mdi:access-point-network | |
{% else %} | |
mdi:access-point-network-off | |
{% endif %} | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarMobileDataEnabled') }} | |
# ============== | |
# Battery | |
# ============== | |
- name: M3000 Battery Charging State | |
unique_id: m3000_status_BatteryChargingState | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarBatteryChargingState') }} | |
device_class: battery_charging | |
- name: M3000 Battery Detection | |
unique_id: m3000_status_BatteryDetection | |
icon: >- | |
{% set icon_key = state_attr('sensor.m3000_status', 'statusBarBatteryDetection') | lower %} | |
{% set icons = { | |
'present': 'mdi:battery-check', | |
'notpresent': 'mdi:battery-remove', | |
'invalid': 'mdi:battery-alert-variant' | |
} %} | |
{{ icons[icon_key] | default('mdi:battery-alert-variant') }} | |
state: >- | |
{{ is_state_attr('sensor.m3000_status', 'statusBarBatteryDetection', 'Present') }} | |
device_class: power | |
# ============== | |
# WiFi | |
# ============== | |
- name: M3000 WiFi Enabled | |
unique_id: m3000_status_WiFiEnabled | |
icon: >- | |
{% if state_attr('sensor.m3000_status', 'statusBarWiFiEnabled') | int(0) %} | |
mdi:wifi | |
{% else %} | |
mdi:wifi-off | |
{% endif %} | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarWiFiEnabled') }} | |
- name: M3000 Guest WiFi Enabled | |
unique_id: m3000_status_GuestWifiEnabled | |
icon: >- | |
{% if state_attr('sensor.m3000_status', 'statusBarGuestWifiEnabled') | int(0) %} | |
mdi:wifi | |
{% else %} | |
mdi:wifi-off | |
{% endif %} | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarGuestWifiEnabled') }} | |
# ============== | |
# Notifications | |
# ============== | |
- name: M3000 Notification Flag | |
unique_id: m3000_status_NotificationFlag | |
icon: >- | |
{% if state_attr('sensor.m3000_status', 'statusBarNotificationFlag') | int(0) %} | |
mdi:message-alert | |
{% else %} | |
mdi:message | |
{% endif %} | |
state: >- | |
{{ state_attr('sensor.m3000_status', 'statusBarNotificationFlag') }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment