muniter/halinuxcompanion

[BUG] Example config is misleading: refresh_interval should be a number

Closed this issue · 0 comments

Describe the bug
The example config.json within this repo contains this line:

refresh_interval: "15"

Using this line as is or keeping any chosen number quoted makes the app treat it as a string and it then fails to use it where a number is expected instead (see trace below).

To Reproduce
Steps to reproduce the behavior:

  1. Copy the example config.json from the repository to my_config.json (for example).
  2. Make changes to my_config.json, everywhere except in refresh_interval.
  3. Run python3 -m halinuxcompanion --config my_config.json
  4. See error

Expected behavior
refresh_interval is a number and sensor update 2 is done a short while after sensor update 1 is done.

Application Logs

...
INFO:halinuxcompanion.sensor:Sensors update 1 with sensors: ['uptime', 'cpu', 'battery_level', 'status', 'memory', 'battery_state']
INFO:halinuxcompanion.sensor:Sensors update 1 successful
Traceback (most recent call last):
  File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/oranja/Projects/others/halinuxcompanion/halinuxcompanion/__main__.py", line 103, in <module>
    loop.run_until_complete(main())
  File "/usr/lib64/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/oranja/Projects/others/halinuxcompanion/halinuxcompanion/__main__.py", line 99, in main
    await asyncio.sleep(interval)
  File "/usr/lib64/python3.10/asyncio/tasks.py", line 595, in sleep
    if delay <= 0:
TypeError: '<=' not supported between instances of 'str' and 'int'