linuxkidd / coachproxy-os

Open Source version of CoachProxy software
GNU General Public License v3.0
36 stars 19 forks source link

added reset switch function to generator enable #10

Closed cterwilliger closed 4 years ago

cterwilliger commented 4 years ago

Generator enable switch doesn't turn back off after the 5 second countdown. added a function to the flow to look at genset_countdown output and turn off the switch when the countdown ends. also switch modified to indicate state of input.

greendog99 commented 4 years ago

Will take a look this week... thanks.

greendog99 commented 4 years ago

Not sure why the generator switch isn't working correctly in coachproxy-os, but the same code works find in the original coachproxy. It would take a lot of research to figure out when/why it stopped working, so I'll just merge in this fix. Thanks...

cterwilliger commented 4 years ago

I just got around to forking your repo so I can add some changes and keep track of things. I fixed this locally in 1.1 and then again in 1.1.1 after the fork. I have several other changes and additions in the works also if you want to discuss. Its kind of a pain to work on the flow and commit, was wondering what your workflow is for making changes...

Sent from my iPhone

On Aug 3, 2020, at 10:22 AM, Mike Fischer notifications@github.com wrote:

 Not sure why the generator switch isn't working correctly in coachproxy-os, but the same code works find in the original coachproxy. It would take a lot of research to figure out when/why it stopped working, so I'll just merge in this fix. Thanks...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

greendog99 commented 4 years ago

I usually keep a separate node-red instance running somewhere (e.g. on my laptop or in a docker container) with the flows_coachproxy-template.json file loaded. Once I am happy with my "live" edits on a CoachProxy device, I make the same changes on the laptop's copy of node-red with flows_coachproxy-template.json (usually by using the "export/import" options in the node-red editor). Then I copy the template over to the CoachProxy and do a "reconfigure" to ensure that it creates the flows.json correctly.

I also turn on "pretty print" mode in settings.js so that the diff is readable and github doesn't think the entire file has changed. I just made that settings.js change in the master repository, so if you update yours, then future commits should just be small diffs which area a lot easier to review. For example, here's what your pull request looks like with "pretty print" turned on in settings.js:

ss-20200803-181649

I tried to get github to let me replace your commit (listed as a 22,000 line change) with this, but my git-foo isn't strong enough so I eventually gave up.

Happy to discuss other changes. Probably easiest to open an issue for each change or group of changes and we can chat about them there?

greendog99 commented 4 years ago

Had to back this out, as I couldn't get cp_config.pl to successfully create a new flows_coachproxy.json from this flows_coachproxy-template.json file.

If possible, can you re-submit your flows changes based on the pretty-printed version of the latest "official" flows? Here's a suggested process, but feel free to improvise:

  1. Ensure you have "pretty print" enabled in /coachproxy/node-red/settings.js line 72.
  2. Bring up your current flows_coachproxy-template.json in the node-red editor. I assume you normally edit it by copying it from /coachproxy/configurator/flows_coachproxy-template.json to /coachproxy/node-red/flows_coachproxy.json and then sudo systemctl restart nodered.
  3. Download the "pretty printed" version of the last "official" flows_coachproxy-template.json from https://github.com/rvc-proxy/coachproxy-os/blob/master/roles/coachproxy/files/configurator/flows_coachproxy-template.json (I usually right-click on the Raw button in the file header, and then wget that URL on my RPi).
  4. Launch this flows file in node-red (e.g. copy it to /coachproxy/node-red/flows_coachproxy.json and restart node-red again) and open it in different browser window or tab.
  5. Transfer your edits to this flows file. You can select some nodes from your first window/tab, export them to clipboard (via hamburger menu next to the "Deploy" button) and import them into the second window/tab.
  6. Deploy new flows.
  7. Copy the new /coachproxy/node-red/flows_coachproxy.json to /coachproxy/configurator/flows_coachproxy-template.json.
  8. Test it by running /coachproxy/configurator/cp_config.pl --debug. FYI this will overwrite your /coachproxy/node-red/flows_coachproxy.json and restart node-red.
  9. If all is good, resubmit pull request with this new /coachproxy/configurator/flows_coachproxy-template.json.

Hopefully this method will also make the git diff very small so it's easy to see what changed. If the process works well I can add it to some documentation here for anyone to use when submitting changes to the flows file.