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

Some ideas for juicepassproxy refactor #102

Open
ivanfmartinez opened this issue Oct 7, 2024 · 0 comments
Open

Some ideas for juicepassproxy refactor #102

ivanfmartinez opened this issue Oct 7, 2024 · 0 comments

Comments

@ivanfmartinez
Copy link
Contributor

ivanfmartinez commented Oct 7, 2024

Here some suggestions for JPP structure rewrite, that probably will be better if made initially by experienced python developers after the merge of command branches

  • configuration control class / wrapper

    • started on first version that can control current locally without enelx servers #69 but need improvements
    • to be able to use config file on other places of JPP
    • we can stay with the YAML configuration file now
    • should be possible to only write to file when changes are made, current code write the file every time, using this for other data like the per device offline current can have impacts on flash devices, the data should be saved only when changed
    • configuration can be made per device or globally as default like
      • [THE_SERIAL_NUMBER]_MAX_CURRENT = 20 or MAX_CURRENT[THE_SERIAL_NUMBER] = 20
      • MAX_CURRENT = 32 (global for all that does not have specific values
      • YAML structured data can be used also for per device config
  • follow folder structure indicated here : first version that can control current locally without enelx servers #69 (comment)

  • check if we can use previous values as initial_state on ha-mqtt-discoverable library

    • this will make possible to dont store preivous state for current_max_offline_set and use the retained topic on MQTT
  • single thread to receive UDP packets (bigger rewrite)

    • can respond at multiple ports like 8042 and 8047
      • this can simplify as juicebox device can use multiple ports, and some users does not have how do simple redirect destination
      • for docker the server can just respond a single port and multiple ports can be redirected on the configuration (this will work on current version also)
    • decode message using the new classes from command branch
    • based on device serial select a instance object or create a new one
    • use instance object to process
    • preparation to remove the old enelx proxy code
      • default can be to ignore_enelx
      • at this moment it works in some countries and some users may want
        to keep it working just as a proxy to send data to HA
  • instance object

    • serial number that will be used as an id for the object
    • only after first status message received should create mqtt entities
      • MQTT use as optional / configurable (for now default to enabled)
        • MQTT/HA entities should use serial number as part of unique id to keep then stable and allow multiple devices
        • MQTT topic default can be changed to use serial instead of name (JuiceBox), but the use of name should be configured. Theis make easier for multiple devices usage.
      • use current_rating to define max_current on entities
      • dont create current_max for devices that uses protocol version older than v09u
      • keep state of configured values on file
    • when we get debug messages from device we can save the versions for future use and detection of features
      • the messages that indicate software version are sent at device power on or reboot
      • we can ask user to reboot or try to reboot using telnet
    • control charging session time like the old juicebox API have
      • easy to control connected time, charging time have some issues when session is paused
      • maybe the session energy can be used, restart session time when session energy goes down
  • This will not scale for hundreds/thousands of devices, but will work fine for less than a hundred per server easily

  • OCPP Gatteway

  • Some other refactors that can be made for better user experience :

    • standarize environment names
      • LOCAL_PORT to JPP_PORT (to be more like JPP_HOST)
  • Discovery Listener : Auto-discovery of JuiceBoxes On the Network and Additional Sensor Data #108

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

No branches or pull requests

1 participant