nutcase icon indicating copy to clipboard operation
nutcase copied to clipboard

Working nutcase.yml Example?

Open johnnieblows opened this issue 1 year ago • 1 comments

Is there an example available for a working nutcase.yml file?

I've tried the example in the config folder, the wiki and various that I've seen in issues, but get the error below;

2024-08-14T17:15:58.107507577Z [2024-08-14 18:15:58,107] INFO in configuration: Config file is /app/../config/nutcase.yaml
2024-08-14T17:15:58.113245782Z [2024-08-14 18:15:58,113] INFO in configuration: Loaded YAML from /app/../config/nutcase.yaml
2024-08-14T17:15:58.113494059Z Traceback (most recent call last):
2024-08-14T17:15:58.113518047Z   File "/app/nutcase_app_prod.py", line 5, in <module>
2024-08-14T17:15:58.113619722Z     app = create_app(Config_Production)
2024-08-14T17:15:58.113624831Z           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-14T17:15:58.113626408Z   File "/app/app/__init__.py", line 81, in create_app
2024-08-14T17:15:58.113744108Z     configuration.Load_Config()
2024-08-14T17:15:58.113749218Z   File "/app/app/utils/configuration.py", line 442, in Load_Config
2024-08-14T17:15:58.113916660Z     Update_Settings(Config)
2024-08-14T17:15:58.113922128Z   File "/app/app/utils/configuration.py", line 185, in Update_Settings
2024-08-14T17:15:58.113923900Z     'device': Srv['device'],
2024-08-14T17:15:58.113944822Z               ~~~^^^^^^^^^^
2024-08-14T17:15:58.114000034Z KeyError: 'device'
2024-08-14T17:15:58.114002606Z unable to load app 0 (mountpoint='') (callable not found or import error)
2024-08-14T17:15:58.114004178Z *** no app loaded. GAME OVER ***
2024-08-14T17:15:58.114140464Z SIGINT/SIGTERM received...killing workers...

johnnieblows avatar Aug 14 '24 17:08 johnnieblows

Hi, From what I can see you seem to have an issue with you config YAML file. I'd still like to investigate why this is resulting in a crash rather than a debug message though, so would you mind posting your YAML file as a file attachment here please? I'll try and replicate the issue and give you some feedback on the file.

There are quite a few examples for configurations on the wiki, I'd hope you can find enough there to get a basic file working.

As an example, a very basic and cut down file from my own setup would look like this:

settings:
  log_level: debug
  ui_format_runtime: "%-Hh %-Mm %Ss"
servers:
  - server: "10.0.10.180"
    port: 3493
    monitor: true
    devices:
      - device: eaton3s
        power: 850
        displayname: 'Upstairs Eaton'

Please do remember that YAML is super-sensitive to indentation so I'd suggest using the YAML syntax checker web site listed on the configuration section of the wiki to check your file.

ArthurMitchell42 avatar Aug 14 '24 18:08 ArthurMitchell42

@ArthurMitchell42: Thanks for providing a working example. Since the update 4.0, the layout of the configuration has changed and the wiki seems to be missing an update? https://github.com/ArthurMitchell42/nutcase/wiki/The-Configuration-File#3-the-servers-section

Old:

rework:
  - from: battery.runtime
    to: nutcase.battery.runtime
    style: time
    control: "%Mm %Ss"
settings:
  log_level: warning
servers:
  - server: "192.168.3.2"
    port: 3493
    device: 'apc'
    default: true
    power: 300
    username: adanmda,ms
    password: asdlkansdljkasjkdnksja
    displayname: 'UPS'

New:

rework:
  - from: battery.runtime
    to: nutcase.battery.runtime
    style: time
    control: "%Mm %Ss"
settings:
  log_level: warning
servers:
  - server: "192.168.3.2"
    port: 3493
    default: true
    devices:
      - device: 'apc'
        power: 300
        username: klmadlkaslkdslk
        password: adlkasndlasnldas
        displayname: 'UPS'

Meliox avatar Aug 22 '24 15:08 Meliox

I thought I had updated all the entries, let me re-check that.

ArthurMitchell42 avatar Aug 22 '24 15:08 ArthurMitchell42

Thanks, I've corrected that now

ArthurMitchell42 avatar Aug 25 '24 15:08 ArthurMitchell42