GithubHelp home page GithubHelp logo

christianreiss / go-rscp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spali/go-rscp

0.0 1.0 0.0 239 KB

Go library to communicate with a E3DC system implementing the RSCP (Remote Storage Control Protocol)

Home Page: https://github.com/spali/go-e3dc

License: MIT License

Go 100.00%

go-rscp's Introduction

go-rscp & e3dc command line utility

Go library (rscp) and command line utility (e3dc) to communicate with a E3DC system implementing the RSCP (Remote Storage Control Protocol).

Please be gentle with me, this is my first real go project and it's bigger than I thought ;) There is still a lot to improve to be a good reusable library, but most works for my specific usecase using it as a command line utility. Contributions are very welcome, see also the check TODO or search in the code for TODO: comments.

Usage

All arguments can also be set as E3DC_ prefixed environment variable or in a config file like:

host 127.0.0.1
user myuser
password mypassword
key mykey

request sent, is always last argument or can be piped through stdin as json string.

See the examples below for more information.

Examples

Note: top element has always to be an array

Note: these examples assume you have the default .config file setup or exported the environment variables.

Note: all example use the default output format, check the help ./e3dc -help for other formats.

  • Short tag only notation just request some information

    ./e3dc '[["EMS_REQ_START_MANUAL_CHARGE",0]]' | jq

    Output:

    {
      "EMS_START_MANUAL_CHARGE": true
    }
  • Short tag only notation just request some information

    ./e3dc '["INFO_REQ_MAC_ADDRESS", "INFO_REQ_UTC_TIME"]' | jq

    Output:

    {
      "INFO_MAC_ADDRESS": "00:00:00:00:00:00",
      "INFO_UTC_TIME": "1970-01-01T00:00:00.000000Z"
    }
  • Tuple notation of tag's to request information

    ./e3dc '[["INFO_REQ_MAC_ADDRESS"], ["INFO_REQ_UTC_TIME"]]' | jq

    Output:

    {
      "INFO_MAC_ADDRESS": "00:00:00:00:00:00",
      "INFO_UTC_TIME": "1970-01-01T00:00:00.000000Z"
    }
  • Tuple notation of tag's and values to send information (data type is inferred by the tag)

    ./e3dc '[["EMS_REQ_START_MANUAL_CHARGE", 3000]]' | jq

    Output:

    {
      "EMS_START_MANUAL_CHARGE": true
    }
  • Tuple notation of tag's and values to send information (with explicit data type)

    Note: wrong data type is corrected by inferring it from the tag

    ./e3dc '[["INFO_REQ_MAC_ADDRESS","None",""], ["INFO_REQ_UTC_TIME"]]' | jq

    Output:

    {
      "INFO_MAC_ADDRESS": "00:00:00:00:00:00",
      "INFO_UTC_TIME": "1970-01-01T00:00:00.000000Z"
    }

TODO

  • more testing
  • more documentation
  • check the generic data type logic (i.e. pointer vs value in interface), this should do a pro ;)
  • cmd/e3dc
    • read config file (security)
    • read from environment variables (security)
    • streamline logging
    • optional experimental mode which accepts any custom message (including tag, datatype and value)
    • implement optional (by flag) pair output (same as the tuple input without datatype)
  • rscp
    • cleanup API
      • probably expose Message as interface and make the struct internal (would allow to move the complete cmd/e3dc specific json stuff out)
    • streamline logging
    • client: improve implementation to make it stable for keeping stable and connected when used in a service
    • move cmd/e3dc specific json marshalling out of rscp to command line utility cmd/e3dc
    • move cmd/e3dc specific json unmarshaling out of rscp to command line utility cmd/e3dc

go-rscp's People

Contributors

dependabot[bot] avatar spali avatar

Watchers

 avatar

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.