Jump to content
We're Hiring! Full Stack Developer ×

Start/Pause/Resume/Stop parity checks via User Script (Python)


Recommended Posts

I'm living in Europe/Germany and because of the current situation prices for Gas and Power are exploding currently. New customers experience a price increase of 70-100% or even more. I ordered a solar battery for our solar roof but all I got was some laughs because of the current situation. Something around summer next year I should expect the ordered things.

 

So I would like to start/pause/resume parity checks depending on the power my solar roof is producing. It's not a fixed schedule as it would be possible with Unraid or one of the plugins. I would create a dynamic process instead, avoiding fast spinups/-downs of the drives, etc.

 

I can query my solar roof (in fact the converter) if it's producing power and how many power it's producing. It's a simple URL of the converter I can call and I can interpret the result.

 

Yesterday morning I did start a parity check manually when the solar roof started to produce enough power and it began to sell the excessive power at an incredible low price (sell: EUR 0,10, buy: EUR 0,49) to the power company. I paused that parity check in the evening when there was not enough power from the roof. Today I will resume manually when the sun shines - in fact it's cloudy, perhaps tomorrow.

 

One thing I would like to add to my list of Python and Bash User Scripts is the one that handles parity checks based on solar power.

 

Are the following calls already possible to be issued from within a user script?

 

- Query the state of a current parity check (is one running, paused or stopped)

- Query the history of parity checks

- Start a parity check

- Pause a running parity check

- Resume a paused parity check

 

I have to confess that I'm not running any Smart Home things. In fact I removed many of them because of their own power draw.

 

Thanks in advance.

 

Link to comment

To save you starting completely from basics you could try installing the Parity Check Tuning plugin to see if the CLI interface it provides as part of the installation will help.  The current implementation provides the following:

Usage: parity.check <action>
where action is one of
  pause            Pause a running array operation
  resume           Resume a paused array operation
  analyze          Analyze results from an array operation
  check            Start a parity check with scheduled settings
  correct          Start a correcting parity check
  nocorrect        Start a non-correcting parity check
  status           Show the status of a running parity check
  cancel           Cancel a running parity check
Version: 2022.04.12

There are some undocumented options not listed above that I use during testing but they are less likely to be of interest I would think as they are very plugin specific.  I am receptive to any suggestions for additions that might be worth adding or making changes/improvements to the above existing CLI options.

 

The source for the plugin is available on github if you want to consider delving under the covers to see how the above are achieved.  It includes some design notes that might be of interest if you do not want to use the plugin CLI interface. 

 

You mentioned Python as the scripting/programming language  You may want to consider PHP instead (which is what the plugin uses) as that is a standard part of Unraid as it what is used for most of the GUI functionality.  

 

 

  • Thanks 1
Link to comment

The Parity Check Tuning plugin has a lot more options than the built-in parity check functionality, and this allows you to do advanced scenarios, if this is your interest.

 

The built-in function does have a simple mechanism to pause or resume a running parity-check operation, by calling

 

/usr/local/emhttp/webGui/scripts/parity_control pause|resume

 

  • Like 1
  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...