Giter Club home page Giter Club logo

Comments (2)

kodonnell avatar kodonnell commented on June 18, 2024

Thanks for looking into this and the PR @rrooggiieerr - I'll try to look in the next few days. If I remember correctly, what you want is something like this

--set single_phase_radian_inverters[2].config.aux_control="RadianInverterConfigurationModel.aux_control.options['On']"

or (possibly equivalently)

--set single_phase_radian_inverters[2].config.aux_control="client.devices.single_phase_radian_inverters[2].config.aux_control.field.options['On']"

Just a note though - as per the readme, it's encouraged to use the Python API for writing if you can, as this one isn't great given the eval etc. Edit - just realised you've already tried the API = )

Are there just some imports missing and is the way it was intended to work, or should I do something else?

I'm not sure - what errors are you getting? If the first one fails due to RadianInverterConfigurationModel not being found (which, looking at it, seems likely) then that might be a case for a star import in main.py.

Generally, if you've got ideas to make it better, let me know (or submit a PR!) - the main problem is there's just such a large number of different fields and devices, and when coupled with enums, values just get pretty long.

from mate3.

rrooggiieerr avatar rrooggiieerr commented on June 18, 2024

@kodonnell I'm aware of the eval in the CLI, how about extending FieldValue with the possible options for that field. These options can then be referred to when setting the field value.

like

field = get_field(client.devices, attr_idx_pattern.findall(path))
value = field.options[value]
field.write(value)

The argument to the CLI to set a field would then become

--set single_phase_radian_inverters[2].config.aux_control=On

from mate3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.