Corsair RMi, HXi, AXi PSU Statistics - CyanLabs's fork


Fma965

Recommended Posts

So if you have been following this plugin you will know that it was originally created by realies 

 

I have since decided to improve upon this and have made multiple tweaks including adding support for the new Unraid Dashboard and a better JSON layout for easier access from Home Assistant etc.

 

Unlike the original this version now also supports AXi PSU's via the command line tool cpsumoncli

 

I decided it was best to start a separate thread for this as i don't want to continue to hijack the original creators old thread incase he returns.

 

Quote

It is a wrapper for the corsairmi binary which reads out monitoring information for Corsair RMi and HXi power supplies. Works cool in conjunction with an UPS plugin.

 

Current PSU's supported by corsairmi are

0x1c09, /* RM550i */

0x1c0a, /* RM650i */

0x1c0b, /* RM750i */

0x1c0c, /* RM850i */

0x1c0d, /* RM1000i */

0x1c03, /* HX550i */

0x1c04, /* HX650i */

0x1c05, /* HX750i */

0x1c06, /* HX850i */

0x1c07, /* HX1000i */

0x1c08, /* HX1200i */

 

As far as i know all AXi PSU's are supported via cpsumoncli

 

If your PSU is compatible with Link / iCUE and not in the list above let me know the Device ID and i will see what i can do.
You can find the device id at http://TOWER//Tools/SysDevs and then under "USB Devices" look for something like this

Bus 001 Device 002:	ID 1b1c:1c0d Corsair

 

Please see screenshots below of the new design on the Unraid Dashboard, 

 

9L7H2Xy.png

 

FHseBQO.png

KypyrHW.png

 

  Plugin can be installed from the Community Apps plugin or from the Install URL below.

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

 

Home Assistant example code

  

57 minutes ago, Fma965 said:

This has been mentioned multiple times but i'll mention it again.

 

 

1. Unraid now uses form auth not basic auth therefore the direct access to the json wont work

2. PSU's that are not supported use a completely different protocol, if a CLI exists for slackware/linux that reads the data maybe i'll consider adding it

 

sensor:
  - platform: rest
    name: Corsair PSU
    json_attributes:
      - temp1
      - temp2
      - fan_rpm
      - capacity
      - 12v_watts
      - 5v_watts
      - 3v_watts
      - watts
      - load
      - 12v_load
      - 5v_load
      - 3v_load
      - uptime
      - poweredon
      - efficiency
    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
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_12v_load:
        friendly_name: '12v Load'
        value_template: '{{ states.sensor.corsair_psu.attributes["12v_load"] }}'
      psu_5v_load:
        friendly_name: '5v Load'
        value_template: '{{ states.sensor.corsair_psu.attributes["5v_load"] }}'
      psu_3v_load:
        friendly_name: '3v Load'
        value_template: '{{ states.sensor.corsair_psu.attributes["3v_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"] }}'
      psu_efficiency:
        friendly_name: 'Efficiency'
        value_template: '{{ states.sensor.corsair_psu.attributes["efficiency"] }}' 

 

fT63fj3.png

Edited by Fma965
  • Like 2
Link to comment
17 minutes ago, LintHart said:

Beta removed 👍

awesome this is released now and to be honest as long as there are no issues i doubt i will update it too much, i may try and add compatibility with othe PSU's if people provide me with the device id. Unfortunately though at the current state of unraid 6.8 with no basic auth or any public information about an API this will stop being accessible from Home Assistant in Unraid 6.8 unless ofcourse a API is implemented.

Link to comment
23 minutes ago, buggex said:

nice plugin, any chance it will get AX support?nice plugin, any chance it will get AX support?

Tell me the device id from the system devices page assuming it has a USB interface and works in iCue / Link it should be the same code as the other devices and just needs the device ID adding to it.

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

Tell me the device id from the system devices page assuming it has a USB interface and works in iCue / Link it should be the same code as the other devices and just needs the device ID adding to it.

Corsair homepage say that it is "Compatible with CORSAIR iCUE" so hopefully it should work:

0x1c11 AX1600i

Link to comment
24 minutes ago, buggex said:

Corsair homepage say that it is "Compatible with CORSAIR iCUE" so hopefully it should work:

0x1c11 AX1600i

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

Please try the above URL. paste it in the install plugin section of Unraid. I would suggest removing the current version first although shouldn't technically be needed.

 

Technically although untested the following devices should be compatible in the ax-text build

	0x1c09, /* RM550i */
	0x1c0a, /* RM650i */
	0x1c0b, /* RM750i */
	0x1c0c, /* RM850i */
	0x1c0d, /* RM1000i */
	0x1c03, /* HX550i */
	0x1c04, /* HX650i */
	0x1c05, /* HX750i */
	0x1c06, /* HX850i */
	0x1c07, /* HX1000i */
	0x1c08, /* HX1200i */
	0x1c0e, /* AX850i */	
	0x1c0f, /* AX1000i */	
	0x1c10, /* AX1200i */	
	0x1c02, /* AX1500i */
	0x1c11, /* AX1600i */	

I have no idea if AXi devices use the same protocols so people with these units will need to test.

Thanks to this file for the list of Device ID's https://github.com/audiohacked/OpenCorsairLink/blob/testing/device.c

Edited by Fma965
Link to comment
2 minutes ago, buggex said:

unfortunately the test build does not seam to work with my ax1600i, no data is shown on the dashboard.

dashboard.PNG

Can you run corsairmi via SSH / console and show me the output. i'm guessing based on my research that the AXi devices use different code, C/C++ is way beyond me so thats not something i would be able to do and it looks like the dev of corsairmi itself is no longer active.

Link to comment
51 minutes ago, Fma965 said:

Can you run corsairmi via SSH / console and show me the output. i'm guessing based on my research that the AXi devices use different code, C/C++ is way beyond me so thats not something i would be able to do and it looks like the dev of corsairmi itself is no longer active.

Did some digging, so corsairmi use the HID protocol to communicate with the PSU see, since rm and hx psu are HID's see:
https://forum.corsair.com/forums/showthread.php?p=663107&p=663107

 

my ax1600i does not report as a HID, so corsairmi will unfortunately not work. corsairmi would need to be rewritten to support what ever communication protocol the ax psu's uses.
 

Edited by buggex
Link to comment
7 minutes ago, buggex said:

Did some digging, so corsairmi use the HID protocol to communicate with the PSU see, since rm and hx psu are HID's see:
https://forum.corsair.com/forums/showthread.php?p=663107&p=663107

 

my ax1600i does not report as a HID, so corsairmi will unfortunately not work. corsairmi would need to be rewritten to support what ever communication protocol the ax psu's uses.
 

Yeah thought as much, was worth a try though. not sure why Corsair decided to change the way their PSU's worked for certain models but it's typical of companies.

Link to comment
On 12/31/2019 at 9:00 AM, Fma965 said:

awesome this is released now and to be honest as long as there are no issues i doubt i will update it too much, i may try and add compatibility with othe PSU's if people provide me with the device id. Unfortunately though at the current state of unraid 6.8 with no basic auth or any public information about an API this will stop being accessible from Home Assistant in Unraid 6.8 unless ofcourse a API is implemented.

All peachy on my end :D many, many thanks

Screenshot 2020-01-01 at 9.57.39 pm.png

Link to comment
            cards:
              - type: custom:mini-graph-card
                entities:
                  - sensor.psu_watts
#                   - sensor.psu_3v_watts
#                   - sensor.psu_5v_watts
#                   - sensor.psu_12v_watts
                icon: mdi:power-socket
                line_color: '#00778a'
                line_width: 3
                font_size: 75
  

                show:
                  extrema: true

          - type: horizontal-stack
            cards:
              - type: custom:mini-graph-card
                entities:
                  - sensor.psu_3v_watts
                name: 3v
                line_color: blue
                line_width: 8
                font_size: 75
                show:
                  extrema: true
                  icon: false
              - type: custom:mini-graph-card
                entities:
                  - sensor.psu_5v_watts
                name: 5v
                line_color: '#e74c3c'
                line_width: 8
                font_size: 75
                show:
                  extrema: true
                  icon: false
              - type: custom:mini-graph-card
                entities:
                  - sensor.psu_12v_watts
                name: 12v
                line_color: orange
                line_width: 8
                font_size: 75
                show:
                  extrema: true
                  icon: false

Requires mini graph card from HACS :)

Link to comment
2 hours ago, LintHart said:

            cards:
              - type: custom:mini-graph-card
                entities:
                  - sensor.psu_watts
#                   - sensor.psu_3v_watts
#                   - sensor.psu_5v_watts
#                   - sensor.psu_12v_watts
                icon: mdi:power-socket
                line_color: '#00778a'
                line_width: 3
                font_size: 75
  

                show:
                  extrema: true

          - type: horizontal-stack
            cards:
              - type: custom:mini-graph-card
                entities:
                  - sensor.psu_3v_watts
                name: 3v
                line_color: blue
                line_width: 8
                font_size: 75
                show:
                  extrema: true
                  icon: false
              - type: custom:mini-graph-card
                entities:
                  - sensor.psu_5v_watts
                name: 5v
                line_color: '#e74c3c'
                line_width: 8
                font_size: 75
                show:
                  extrema: true
                  icon: false
              - type: custom:mini-graph-card
                entities:
                  - sensor.psu_12v_watts
                name: 12v
                line_color: orange
                line_width: 8
                font_size: 75
                show:
                  extrema: true
                  icon: false

Requires mini graph card from HACS :)

Nice :) 

Link to comment

For those wanted to access the json externally and are on 6.8+ i have made a quick hack to bring back Basic Auth. if you visit /login the form will still work but it won't auto redirect and force form auth any more. you need to create a htpasswd file in /boot/config/htpasswd https://www.htaccesstools.com/htpasswd-generator/ and then set your go file in /boot/config/go to be this

 

This will patch a few lines in the nginx emhttp-servers.conf file allowing Basic Auth once again.

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

# Wait for Nginx to be running before patching Basic Auth
while [ ! -f /var/run/nginx.pid ]
do
  sleep 2 # or less like 0.2
done

# Patch Basic Auth back in to Unraid 6.8+ (Make sure /boot/config/htpasswd exists and is valid)
cp /boot/config/htpasswd /etc/nginx/basic
sed -i 's%return 302 \$scheme:\/\/\$http_host\/login;%# return 302 \$scheme:\/\/\$http_host\/login;%' /etc/nginx/conf.d/emhttp-servers.conf
sed -i '/^auth_request\ \/auth_request.php;/a auth_basic "Unraid";\nauth_basic_user_file  /etc/nginx/basic;' /etc/nginx/conf.d/emhttp-servers.conf
nginx -s reload
# End Nginx Basic Auth Patch

 

Link to comment

Hi my PSU RM550i does not work so please can you add:

 

.vendor_id = 0x1b1c,

.product_id = 0x1c09,

.device_id = 0xFF,

.name = "RM550i",

.read_endpoint = 0x01 | LIBUSB_ENDPOINT_IN,

.write_endpoint = 0x01 | LIBUSB_ENDPOINT_OUT,

.driver = &corsairlink_driver_rmi,

.lowlevel = &corsairlink_lowlevel_rmi,

.led_control_count = 0,

.fan_control_count = 1,

.pump_index = 0,

 

Thanks

Link to comment
16 minutes ago, Jure said:

Hi my PSU RM550i does not work so please can you add:

 

.vendor_id = 0x1b1c,

.product_id = 0x1c09,

.device_id = 0xFF,

.name = "RM550i",

.read_endpoint = 0x01 | LIBUSB_ENDPOINT_IN,

.write_endpoint = 0x01 | LIBUSB_ENDPOINT_OUT,

.driver = &corsairlink_driver_rmi,

.lowlevel = &corsairlink_lowlevel_rmi,

.led_control_count = 0,

.fan_control_count = 1,

.pump_index = 0,

 

Thanks

try the test version

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

0x1c09, /* RM550i */

0x1c0a, /* RM650i */

0x1c0b, /* RM750i */

0x1c0c, /* RM850i */

0x1c0d, /* RM1000i */

0x1c03, /* HX550i */

0x1c04, /* HX650i */

0x1c05, /* HX750i */

0x1c06, /* HX850i */

0x1c07, /* HX1000i */

0x1c08, /* HX1200i */

Link to comment
11 hours ago, Fma965 said:

try the test version


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

0x1c09, /* RM550i */

0x1c0a, /* RM650i */

0x1c0b, /* RM750i */

0x1c0c, /* RM850i */

0x1c0d, /* RM1000i */

0x1c03, /* HX550i */

0x1c04, /* HX650i */

0x1c05, /* HX750i */

0x1c06, /* HX850i */

0x1c07, /* HX1000i */

0x1c08, /* HX1200i */

Yes I tried but it does not work 😞

Link to comment
On 12/31/2019 at 5:59 AM, Fma965 said:

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

Please try the above URL. paste it in the install plugin section of Unraid. I would suggest removing the current version first although shouldn't technically be needed.

 

Technically although untested the following devices should be compatible in the ax-text build


	0x1c09, /* RM550i */
	0x1c0a, /* RM650i */
	0x1c0b, /* RM750i */
	0x1c0c, /* RM850i */
	0x1c0d, /* RM1000i */
	0x1c03, /* HX550i */
	0x1c04, /* HX650i */
	0x1c05, /* HX750i */
	0x1c06, /* HX850i */
	0x1c07, /* HX1000i */
	0x1c08, /* HX1200i */
	0x1c0e, /* AX850i */	
	0x1c0f, /* AX1000i */	
	0x1c10, /* AX1200i */	
	0x1c02, /* AX1500i */
	0x1c11, /* AX1600i */	

I have no idea if AXi devices use the same protocols so people with these units will need to test.

Thanks to this file for the list of Device ID's https://github.com/audiohacked/OpenCorsairLink/blob/testing/device.c

I have the AX1200i and it's showing up as 0x1c00. I passed it to a windows vm and it's working with corsair link. If you can update the device id I can test. 

Link to comment
22 minutes ago, cpthzrd said:

I have the AX1200i and it's showing up as 0x1c00. I passed it to a windows vm and it's working with corsair link. If you can update the device id I can test. 

AX PSU's won't work as discussed previously in this thread, they work on completely different protocols, the ones in that list you quoted are already in the ax-test build so if it's not working then it's not supported.

  • Like 1
Link to comment

Hey @Fma965 I asked willnnotdan on discord how he tackled the new auth on 6.8 for Unraid-API if you ever think you’d like to give it a go. 
 

“Hey, I got it working with the new Auth but it was a pain! Essentially it makes a post request to /login and blocks the attempt to redirect (it'll redirect to main, find you don't have the cookie and then redirect you back to login) it then grabs the cookie from the headers and stores it so it can be used in future requests. Happy for him to message me directly if I can be of assistance :)”

 

https://discord.gg/Qa3Bjr9

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