[Plugin] Corsair PSU Statistics


Recommended Posts

C3ZIdIV.png

 

I plan on adding progress/percent bars if i figure out how the existing progress bars work on the dashboard

 

not released yet, code is super messy

 

UPDATE:

Now released. please note that currently this uses a bit of a hack to make it work as a dashboard panel, it doesn't currently support moving the panel (well it does move but it wont stick) i know a way to fix this but haven't got the time to do this right now, it's christmas lol.

 

Beta version as shown above can be downloaded from 

https://raw.githubusercontent.com/Cyanlabs/corsairpsu-unraid/beta/corsairpsu.plg

 

 

 

Edited by Fma965
Link to comment
13 hours ago, Fma965 said:

12v is usually mechanical side of the hard drives, graphics cards etc.

5v is the logic controllers of the hard drives usually and sometimes 3.3v aswell

 

I think if you are trying to reduce power only looking at 12V would be your best bet.

 

EDIT: to make sure you have the rails correctly indentified send me the output of corsairmi via ssh/terminal

That would be super cool to have it as a dashboard panel. Here is my output:


name:           'HX1000i'
vendor:         'CORSAIR'
product:        'HX1000i'
powered:        258127 (2d. 23h)
uptime:         250927 (2d. 21h)
temp1:           42.8
temp2:           35.2
fan rpm:          0.0
supply volts:   230.0
total watts:     82.0
output0 volts:   12.1
output0 amps:     4.2
output0 watts:   50.0
output1 volts:    5.0
output1 amps:     3.9
output1 watts:   19.0
output2 volts:    3.3
output2 amps:     3.0
output2 watts:    9.5

hmmm maybe I can use this ssh method to drag some stats into into home assistant 
 

Link to comment
1 hour ago, LintHart said:

That would be super cool to have it as a dashboard panel. Here is my output:


name:           'HX1000i'
vendor:         'CORSAIR'
product:        'HX1000i'
powered:        258127 (2d. 23h)
uptime:         250927 (2d. 21h)
temp1:           42.8
temp2:           35.2
fan rpm:          0.0
supply volts:   230.0
total watts:     82.0
output0 volts:   12.1
output0 amps:     4.2
output0 watts:   50.0
output1 volts:    5.0
output1 amps:     3.9
output1 watts:   19.0
output2 volts:    3.3
output2 amps:     3.0
output2 watts:    9.5

hmmm maybe I can use this ssh method to drag some stats into into home assistant 
 

I would personally pull from http://TOWER/plugins/corsairpsu/status.php instead of ssh

 

Your layout is the same as mine so I expect all PSU will be output 0 is 12v and output 1 is 5v and output 2 is 3.3v. my new dashboard panel version auto detects this anyway

 

 

This is the output of the php page

{
   "temp1":"44.2 \u00b0c",
   "temp2":"37.2 \u00b0c",
   "fan_rpm":"0.0 RPM",
   "capacity":"1000W",
   "12v_watts":"72.0W",
   "5v_watts":"24.5W",
   "3v_watts":"11.0W",
   "watts":"106.0W",
   "load":"11%",
   "vendor":"CORSAIR",
   "product":"RM1000i",
   "uptime":"6d. 12h",
   "poweredon":"159d. 3h"
}

Edited by Fma965
Link to comment
22 minutes ago, Fma965 said:

I would personally pull from http://TOWER/plugins/corsairpsu/status.php instead of ssh

 

Your layout is the same as mine so I expect all PSU will be output 0 is 12v and output 1 is 5v and output 2 is 3.3v. my new dashboard panel version auto detects this anyway

 

 

This is the output of the php page

{
   "temp1":"44.2 \u00b0c",
   "temp2":"37.2 \u00b0c",
   "fan_rpm":"0.0 RPM",
   "capacity":"1000W",
   "12v_watts":"72.0W",
   "5v_watts":"24.5W",
   "3v_watts":"11.0W",
   "watts":"106.0W",
   "load":"11%",
   "vendor":"CORSAIR",
   "product":"RM1000i",
   "uptime":"6d. 12h",
   "poweredon":"159d. 3h"
}

That looks like a game changer thank you! Much research to do to learn how to scrape/utilise that but very excited about the possibility. I agree that would be much nicer than ssh 

Link to comment
6 hours ago, LintHart said:

That looks like a game changer thank you! Much research to do to learn how to scrape/utilise that but very excited about the possibility. I agree that would be much nicer than ssh 

I use home assistant my self. I could potentially implement a .PHP?value=temp1 or .PHP?value=fan_rpm etc but I think ha can just parse the JSON anyway 

Link to comment
5 hours ago, Fma965 said:

I use home assistant my self. I could potentially implement a .PHP?value=temp1 or .PHP?value=fan_rpm etc but I think ha can just parse the JSON anyway 

Any assistance in making it easier for HA would be greatly appreciated. If JSON, would that best using the RESTful sensor?

also just confirming this is expected, the PHP output for me is only showing the actual values, there are no categories/headings (unsure what the correct term is) like temp1. If I go to the URL it gives me: 

 

["3d. 10h","42.2 \/ 34.8","0.0","1000W","50.0W","18.5W","9.5W","78.0W","8%"]

Link to comment
15 hours ago, LintHart said:

Any assistance in making it easier for HA would be greatly appreciated. If JSON, would that best using the RESTful sensor?

also just confirming this is expected, the PHP output for me is only showing the actual values, there are no categories/headings (unsure what the correct term is) like temp1. If I go to the URL it gives me: 

 

["3d. 10h","42.2 \/ 34.8","0.0","1000W","50.0W","18.5W","9.5W","78.0W","8%"]

only my new version supports the new layout

 

my understanding is something like this, replace value_json.temp1 with value_json.XXXX depending on which value you want.

  - platform: rest
    resource: "http://192.168.1.3:965/plugins/corsairpsu/status.php"
    username: root
    password: !secret unraid_password
    authentication: basic
    value_template: '{{ value_json.temp1 }}'
    headers:
      User-Agent: Home Assistant
      Content-Type: application/json

EDIT: just tested it works.

h4sVbVN.png

Edited by Fma965
Link to comment
sensor:
  - platform: rest
    name: Corsair PSU
    json_attributes:
      - temp1
      - temp2
      - fan_rpm
      - capacity
      - 12v_watts
      - 5v_watts
      - 3v_watts
      - watts
      - load
      - uptime
      - poweredon
    resource: "http://TOWER/plugins/corsairpsu/status.php"
    username: root
    password: !secret unraid_password
    authentication: basic
    value_template: '{{ value_json.product }}'
    headers:
      User-Agent: Home Assistant
      Content-Type: application/json

@LintHart This code works and will get all those attributes in to a sensor called sensor.corsair_psu

ti7Bj6Q.png

 

you can also seperate them in to seperate sensors if you wanted with this code

sensor:
  - platform: template
    sensors:
      psu_temp1:
        friendly_name: 'Temperature 1'
        value_template: '{{ states.sensor.corsair_psu.attributes["temp1"] }}'
      psu_temp2:
        friendly_name: 'Temperature 2'
        value_template: '{{ states.sensor.corsair_psu.attributes["temp2"] }}'
      psu_fan_rpm:
        friendly_name: 'Fan Speed'
        value_template: '{{ states.sensor.corsair_psu.attributes["fan_rpm"] }}'
      psu_capactiy:
        friendly_name: 'Capacity'
        value_template: '{{ states.sensor.corsair_psu.attributes["capacity"] }}'
      psu_12v_watts:
        friendly_name: '12v Watts'
        value_template: '{{ states.sensor.corsair_psu.attributes["12v_watts"] }}'
      psu_5v_watts:
        friendly_name: '5v Watts'
        value_template: '{{ states.sensor.corsair_psu.attributes["5v_watts"] }}'
      psu_3v_watts:
        friendly_name: '3v Watts'
        value_template: '{{ states.sensor.corsair_psu.attributes["3v_watts"] }}'     
      psu_watts:
        friendly_name: 'Current Load'
        value_template: '{{ states.sensor.corsair_psu.attributes["watts"] }}'       
      psu_load:
        friendly_name: 'Current Load Percentage'
        value_template: '{{ states.sensor.corsair_psu.attributes["load"] }}'          
      psu_uptime:
        friendly_name: 'Uptime'
        value_template: '{{ states.sensor.corsair_psu.attributes["uptime"] }}'       
      psu_poweredon:
        friendly_name: 'Total Power On Hours'
        value_template: '{{ states.sensor.corsair_psu.attributes["poweredon"] }}'        

I will likely tweak it to add raw values in the php file so you can get temp1 which would be 45°c or you can get temp1_raw which would be just 45 instead of 45°c

Edited by Fma965
Link to comment
18 hours ago, Fma965 said:

sensor:
  - platform: rest
    name: Corsair PSU
    json_attributes:
      - temp1
      - temp2
      - fan_rpm
      - capacity
      - 12v_watts
      - 5v_watts
      - 3v_watts
      - watts
      - load
      - uptime
      - poweredon
    resource: "http://TOWER/plugins/corsairpsu/status.php"
    username: root
    password: !secret unraid_password
    authentication: basic
    value_template: '{{ value_json.product }}'
    headers:
      User-Agent: Home Assistant
      Content-Type: application/json

@LintHart This code works and will get all those attributes in to a sensor called sensor.corsair_psu

ti7Bj6Q.png

 

you can also seperate them in to seperate sensors if you wanted with this code


sensor:
  - platform: template
    sensors:
      psu_temp1:
        friendly_name: 'Temperature 1'
        value_template: '{{ states.sensor.corsair_psu.attributes["temp1"] }}'
      psu_temp2:
        friendly_name: 'Temperature 2'
        value_template: '{{ states.sensor.corsair_psu.attributes["temp2"] }}'
      psu_fan_rpm:
        friendly_name: 'Fan Speed'
        value_template: '{{ states.sensor.corsair_psu.attributes["fan_rpm"] }}'
      psu_capactiy:
        friendly_name: 'Capacity'
        value_template: '{{ states.sensor.corsair_psu.attributes["capacity"] }}'
      psu_12v_watts:
        friendly_name: '12v Watts'
        value_template: '{{ states.sensor.corsair_psu.attributes["12v_watts"] }}'
      psu_5v_watts:
        friendly_name: '5v Watts'
        value_template: '{{ states.sensor.corsair_psu.attributes["5v_watts"] }}'
      psu_3v_watts:
        friendly_name: '3v Watts'
        value_template: '{{ states.sensor.corsair_psu.attributes["3v_watts"] }}'     
      psu_watts:
        friendly_name: 'Current Load'
        value_template: '{{ states.sensor.corsair_psu.attributes["watts"] }}'       
      psu_load:
        friendly_name: 'Current Load Percentage'
        value_template: '{{ states.sensor.corsair_psu.attributes["load"] }}'          
      psu_uptime:
        friendly_name: 'Uptime'
        value_template: '{{ states.sensor.corsair_psu.attributes["uptime"] }}'       
      psu_poweredon:
        friendly_name: 'Total Power On Hours'
        value_template: '{{ states.sensor.corsair_psu.attributes["poweredon"] }}'        

I will likely tweak it to add raw values in the php file so you can get temp1 which would be 45°c or you can get temp1_raw which would be just 45 instead of 45°c

You sir, are my personal hero for the day. Thank you so very much, I’m just thrilled to have this available to me in unraid and home assistant. It’s working great. Thank you also for helping and putting that together over the holidays 

Link to comment
7 hours ago, LintHart said:

You sir, are my personal hero for the day. Thank you so very much, I’m just thrilled to have this available to me in unraid and home assistant. It’s working great. Thank you also for helping and putting that together over the holidays 

No worries, any issues let me know, the code for the redesigned dashboard is janky so if something breaks the dashboard on a new unraid version my first guess would be this plugin if anything.

Link to comment
On 12/27/2019 at 2:24 AM, Fma965 said:

sensor:
  - platform: rest
    name: Corsair PSU
    json_attributes:
      - temp1
      - temp2
      - fan_rpm
      - capacity
      - 12v_watts
      - 5v_watts
      - 3v_watts
      - watts
      - load
      - uptime
      - poweredon
    resource: "http://TOWER/plugins/corsairpsu/status.php"
    username: root
    password: !secret unraid_password
    authentication: basic
    value_template: '{{ value_json.product }}'
    headers:
      User-Agent: Home Assistant
      Content-Type: application/json

@LintHart This code works and will get all those attributes in to a sensor called sensor.corsair_psu

ti7Bj6Q.png

 

you can also seperate them in to seperate sensors if you wanted with this code


sensor:
  - platform: template
    sensors:
      psu_temp1:
        friendly_name: 'Temperature 1'
        value_template: '{{ states.sensor.corsair_psu.attributes["temp1"] }}'
      psu_temp2:
        friendly_name: 'Temperature 2'
        value_template: '{{ states.sensor.corsair_psu.attributes["temp2"] }}'
      psu_fan_rpm:
        friendly_name: 'Fan Speed'
        value_template: '{{ states.sensor.corsair_psu.attributes["fan_rpm"] }}'
      psu_capactiy:
        friendly_name: 'Capacity'
        value_template: '{{ states.sensor.corsair_psu.attributes["capacity"] }}'
      psu_12v_watts:
        friendly_name: '12v Watts'
        value_template: '{{ states.sensor.corsair_psu.attributes["12v_watts"] }}'
      psu_5v_watts:
        friendly_name: '5v Watts'
        value_template: '{{ states.sensor.corsair_psu.attributes["5v_watts"] }}'
      psu_3v_watts:
        friendly_name: '3v Watts'
        value_template: '{{ states.sensor.corsair_psu.attributes["3v_watts"] }}'     
      psu_watts:
        friendly_name: 'Current Load'
        value_template: '{{ states.sensor.corsair_psu.attributes["watts"] }}'       
      psu_load:
        friendly_name: 'Current Load Percentage'
        value_template: '{{ states.sensor.corsair_psu.attributes["load"] }}'          
      psu_uptime:
        friendly_name: 'Uptime'
        value_template: '{{ states.sensor.corsair_psu.attributes["uptime"] }}'       
      psu_poweredon:
        friendly_name: 'Total Power On Hours'
        value_template: '{{ states.sensor.corsair_psu.attributes["poweredon"] }}'        

I will likely tweak it to add raw values in the php file so you can get temp1 which would be 45°c or you can get temp1_raw which would be just 45 instead of 45°c

I think these raw values would assist me with a trouble I’m having with my mini graph cards. Then we can set our own unit of measurement and everything should work smoothly :)

 

Link to comment
5 hours ago, LintHart said:

I love the smell of fresh updates in the morning 😛 (Australia) much appreciated. Btw I’m still using the beta but from community apps 👍

This will allow you to get raw values. i am working on getting the dashboard code working properly, being able to be moved etc and then will release.

 

XpcdcrL.png

Link to comment
12 hours ago, ingux16 said:

Sadly plugin not support AXi psus ,

I got 1500AXi...

i missed your reply, it would seem corsairmi doesn't support it?

 

I think you would literally need to add your ID from system devices e.g and compile the code. assuming it supports corsair link etc.

ID 1b1c:1c0d Corsair...

 

https://github.com/notaz/corsairmi/blob/master/corsairmi.c#L77

 

image.png

Edited by Fma965
Link to comment
  • 2 weeks later...
  • 1 year later...

Since this plugin can be used with json output in Home Assistant etc but 6.8+ preventing Basic Auth, here is a go file tweak you can add to your go file to allow unauthenticated access to this script output and also to the system temperature plugin

 

6.10-RC1 Go File

 

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &

# Add Un-Authenticated access to Unraid 6.10-RC1+ for SystemTemp.php and Status.php (Corsair Plugin)
while [ ! -f /var/run/nginx.pid ]
do
  sleep 2 # or less like 0.2
done

echo -e "# Fma965 Un-Authenticated Access\nlocation ~ /plugins\/corsairpsu\/status.php {\nallow all;\ninclude fastcgi_params;\n}\n\nlocation ~ /plugins\/dynamix.system.temp\/include\/SystemTemp.php {\nallow all;\ninclude fastcgi_params;\n}\n# End Fma965 Un-Authenticated Access\n\n$(cat /etc/nginx/conf.d/locations.conf)" > /etc/nginx/conf.d/locations.conf;
nginx -s reload
# End Un-Authenticated Access

 

Home Assistant preview

image.png.c19d8bd924b78ff6e59950f6a90c0f45.png

 

6.8+ Go File (Patches Basic Auth back in)

 

 

Edited by Fma965
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.