Skip to content

Commit

Permalink
Add endpoint option to RAM Input for when using non-standard IP/port
Browse files Browse the repository at this point in the history
  • Loading branch information
kizniche committed Jan 6, 2024
1 parent 07729af commit 12813e0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- Add Step Line Series Type to Graph (Synchronous) Widget

### Miscellaneous

- Add endpoint option to RAM Input for when using non-standard IP/port


## 8.15.13 (2023.12.24)

Expand Down
2 changes: 1 addition & 1 deletion mycodo/inputs/atlas_o2.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
'ftdi_location': '/dev/ttyUSB0',

'custom_options': [
{
{
'id': 'temperature_comp_meas',
'type': 'select_measurement',
'default_value': '',
Expand Down
17 changes: 16 additions & 1 deletion mycodo/inputs/mycodo_ram.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@

'dependencies_module': [
('pip-pypi', 'psutil', 'psutil==5.9.4')
],

'custom_options': [
{
'id': 'endpoint_frontend_ram',
'type': 'text',
'default_value': 'https://127.0.0.1/ram',
'required': False,
'name': 'Mycodo Frontend RAM Endpoint',
'phrase': 'The endpoint to get Mycodo frontend ram usage'
}
]
}

Expand All @@ -57,7 +68,11 @@ def __init__(self, input_dev, testing=False):

self.control = None

self.endpoint_frontend_ram = None

if not testing:
self.setup_custom_options(
INPUT_INFORMATION['custom_options'], input_dev)
self.try_initialize()

def initialize(self):
Expand All @@ -84,7 +99,7 @@ def get_measurement(self):
if self.is_enabled(3):
try:
import requests
response = requests.get('https://127.0.0.1/ram', verify=False)
response = requests.get(self.endpoint_frontend_ram, verify=False)
self.value_set(3, float(response.content))
except:
self.logger.exception("getting frontend ram usage")
Expand Down

0 comments on commit 12813e0

Please sign in to comment.