Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for complex types in config #154

Merged
merged 4 commits into from
Jul 2, 2020

Conversation

helto4real
Copy link
Collaborator

Proposed change

NetDaemon now supports usage of complex types in configurations.

Example:

complex_app:
    class: AppComplexContif
    a_string: hello world
    an_int: 10
    a_bool: true
    a_string_list:
    - this
    - is
    - cool!
    devices:
    - name: tv
        commands:
        - name: command1
            data: some code
        - name: command2
            data: some code2";
public class AppComplexConfig : NetDaemonApp
{
    public string? AString { get; set; }
    public int? AnInt { get; set; }
    public bool? ABool { get; set; }
    public IEnumerable<string>? AStringList { get; set; }
    public IEnumerable<Device>? Devices { get; set; }
    public override Task InitializeAsync()
    {
        // Do nothing

        return Task.CompletedTask;
    }
}

public class Device
{
    public string? name { get; set; }
    public IEnumerable<Command>? commands { get; set; }
}
public class Command
{
    public string? name { get; set; }
    public string? data { get; set; }
}

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]
  • [] The code compiles without warnings (code quality chek)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated

@helto4real helto4real merged commit 1a5ebf3 into dev Jul 2, 2020
@helto4real helto4real deleted the yaml_configuration_deep_objects branch July 2, 2020 14:25
@helto4real helto4real changed the title Added support for comples types in config Added support for complex types in config Jul 2, 2020
Ikcelaks pushed a commit to Ikcelaks/netdaemon that referenced this pull request Dec 23, 2022
* Added support for comples types in config

* Fix test timing

* Test timing

* Test fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

in NetDaemonRxApp application support receiving dynamic yaml in initialize method
1 participant