Synaccess PDU's

Anyone interested in doing an integration? It uses both local web or telnet access for control...I have an NP-05B I could give someone access to...

Web interface directly on unit

The web api Synaccess | Web API

Edit:

Also the available commands in telnet

Looks fairly straight forward, but a lot of depth depending on how far you want to take it. Did you see that they also have a Node Red implementation?

I don't run node red though. I was looking for something I could use to restart it or switch off an individual outlet based on conditions...Not being a programmer I'm not sure what's involved but if you wanna take a stab at it, I could let you vpn in and play...

Couldn't remember if you did Node Red or not - no worries.

Looks like the Personal Access Token might be a slightly easier route from the Auth perspective (doesn't require session management logic). Off the top of my head I'm thinking a master device and possibly a child device for each inlet might be the best approach.

I may have time in the next day or so to get a POC for you. And if that works then we can expand on it.

1 Like

Dude, thanx... Let me know if you need access.

Might need it later, but thinking to start, since we're in the same time zone, I'll put the code out there for you to pull down and look over before installing/testing. It will allow you to get some familiarity with the way the code operates and have more input on how it functions, etc. (And we'll have you programming in no time :smiley: )

1 Like

@rlithgow1

Couple of drivers to try (not completed yet, but should tell us if I've got the foundation right). If you would add these to your Drivers Code section of the hub:

https://raw.githubusercontent.com/thebearmay/hubitat/main/synaccess/pduMaster.groovy

https://raw.githubusercontent.com/thebearmay/hubitat/main/synaccess/pduOutlet.groovy

  1. Log into the PDU Web Interface and create a Personal Access Token.
  2. Create a virtual device using the pduMaster driver
  3. Fill in the path to the PDU (http://someValidIP), and the Personal Access Token. Save Preferences.
  4. Hit Configure and then refresh.

If everything is working correctly you will have a few attributes, some PDU information in the data section of the driver, and one or more child outlet devices.

Edit: Added some functionality , current version should be 0.0.4 on both files. Should be able to:

  1. Turn individual outlets on/off
  2. Poll for current power consumption (returns a JSON string with each outlet and a total usage)
  3. On hub restart should run out and get current power state (on/off) for the outlet(s)

Should be in good enough shape to do some testing. Everything works in sim mode so should work in live mode with maybe a little adjustment.

1 Like

Ok I'll hit it this afternoon... Got side tracked with work

LOL hate it when that happens.

So mine may not actually support the current API... Even trying to run a curl command it tells me I don't have the credentials (even though I do). I put in an email to their support. At worst I'll call them monday. Arrrrrgh Telnet still works well though....

So yeah.... This is what I get when I try to curl the access token. It should provide the token in the header based on my login but doesn't. :frowning: Wanna write a telnet integration? :rofl:

Summary Synaccess netBooter
synaccess netBooter™ Model: NP-05B
Network connection was lost.
<div id="display">
	<b>Device ID: </b>PDU&nbsp;&nbsp;<span align="right" id="tp3"></span>
	<div class="subttl">Power Outlet Status</div>
<span class="errstr" id="err1"></span>
	<table>
		<tr><td>Outlet #</td><td>On/Off</td><td>Reboot</td><td>Status</td><td>Name</td><td>Reservation</td></</td></tr>
		<tr>	<td>1</td>
			<td><a onclick="ajxCmd('cmd.cgi?rly=0');"><img src="btn.gif" /></a></td>			    
		    	<td><a onclick="ajxCmd('cmd.cgi?rb=0');"><img src="btn.gif" /></a></td>
			<td id="rly0"></td>
			<td>Outlet1</td>
			<td></td></tr>
			<td>2</td>
			<td><a onclick="ajxCmd('cmd.cgi?rly=1');"><img src="btn.gif" /></a></td>			    
		    	<td><a onclick="ajxCmd('cmd.cgi?rb=1');"><img src="btn.gif" /></a></td>
			<td id="rly1"></td>
			<td>Outlet2</td>
			<td></td></tr>
		<tr class="lv5">	<td>3</td>
			<td><a onclick="ajxCmd('cmd.cgi?rly=2');"><img src="btn.gif" /></a></td>			    
		    	<td><a onclick="ajxCmd('cmd.cgi?rb=2');"><img src="btn.gif" /></a></td>
			<td id="rly2"></td>
			<td>Outlet3</td>
			<td></td></tr>
		<tr  class="lv5">	<td>4</td>
			<td><a onclick="ajxCmd('cmd.cgi?rly=3');"><img src="btn.gif" /></a></td>			    
		    	<td><a onclick="ajxCmd('cmd.cgi?rb=3');"><img src="btn.gif" /></a></td>
			<td id="rly3"></td>
			<td>Outlet4</td>
			<td></td></tr>
		<tr  class="lv5">	<td>5</td>
			<td><a onclick="ajxCmd('cmd.cgi?rly=4');"><img src="btn.gif" /></a></td>			    
		    	<td><a onclick="ajxCmd('cmd.cgi?rb=4');"><img src="btn.gif" /></a></td>
			<td id="rly4"></td>
			<td>Outlet5</td>
			<td></td></tr>
		<tr  class="lv8">	<td>6</td>
			<td><a onclick="ajxCmd('cmd.cgi?rly=5');"><img src="btn.gif" /></a></td>			    
		    	<td><a onclick="ajxCmd('cmd.cgi?rb=5');"><img src="btn.gif" /></a></td>
			<td id="rly5"></td>
			<td></td>
			<td></td></tr>
		<tr  class="lv8">	<td>7</td>
			<td><a onclick="ajxCmd('cmd.cgi?rly=6');"><img src="btn.gif" /></a></td>			    
		    	<td><a onclick="ajxCmd('cmd.cgi?rb=6');"><img src="btn.gif" /></a></td>
			<td id="rly6"></td>
			<td></td>
			<td></td></tr>
		<tr  class="lv8">	<td>8</td>
			<td><a onclick="ajxCmd('cmd.cgi?rly=7');"><img src="btn.gif" /></a></td>			    
		    	<td><a onclick="ajxCmd('cmd.cgi?rb=7');"><img src="btn.gif" /></a></td>
			<td id="rly7"></td>
			<td></td>
			<td></td></tr>
	</table>
	<div align="right"><font size=0.6em><img src="on.gif" width="16" height="16">Power ON <img src="off.gif" width="16" height="16">Power OFF</font>
		<div id="csSense">
		<font size="5" color="firebrick">&#149;</font>Temperature Controlled </div></div>
	<div class="subttl">Grouped Power Outlet Control</div>
	<table>
		<tr><td></td><td>On</td><td>Off</td><td>Reboot</td><td>Outlet List</td></tr>
		<tr>	<td>Group 1</td>
			<td><a onclick="ajxCmd('cmd.cgi?grp=0');"><img src="btn.gif" /></a></td>			    
			<td><a onclick="ajxCmd('cmd.cgi?grp=30');"><img src="btn.gif" /></a></td>			    
		    	<td><a onclick="ajxCmd('cmd.cgi?rbg=0');"><img src="btn.gif" /></a></td>				
			<td></td></tr>

		<tr  class="lv5">	<td>Group 2</td>
			<td><a onclick="ajxCmd('cmd.cgi?grp=1');"><img src="btn.gif" /></a></td>			    
			<td><a onclick="ajxCmd('cmd.cgi?grp=31');"><img src="btn.gif" /></a></td>			    
		    	<td><a onclick="ajxCmd('cmd.cgi?rbg=1');"><img src="btn.gif" /></a></td>			
			<td></td></tr>

	</table>
AC Current(Amps) Status
AC Current Draw
Max Reading
	<button type="button" onclick="ajxCmd('cmd.cgi?clrR=1');" >Reset</button>
	
	<div class="subttl">Environment Temperature Status</div>
	<table>
	<tr><td>Current Reading (in C/F)</td><td id="tp0"></td></tr>
	<tr><td>Max. Reading </td><td id="tp1"></td></tr>		
	<tr><td>Min. Reading </td><td id="tp2"></td></tr>		
	</table>
	<button type="button" onclick="ajxCmd('cmd.cgi?clrR=2');" >Reset</button>
Autoping/Reboot Status
Destination IP Outlet List Receive Echoes/Total Pings Reboot Times
0.0.0.0 1
0.0.0.0 2
0.0.0.0 3
0.0.0.0 4
0.0.0.0 5
0
0
0
Reset
	</div>

	<div class="subttl">System Status</div>
	<span id="sus">
	<button type="button" onclick="ajxCmd('cmd.cgi?clrR=4');" >Operation Suspension ON/OFF</button>
	</span>
	<table>			
		<tr><td>Uptime(D:H:M)</td><td>0:01:48</td></td></tr>
		<tr><td>IP</td><td>192.168.2.38</td></td></tr>	
		<tr><td>Version</td><td>HW3.2 FW96 WF88</td></td></tr>
		<tr><td>Mac Address</td><td>0c:73:eb:b0:20:09</td></td></tr>	

	</table>
 
Copyright ©2020 Synaccess Networks, Inc. (WF88C)

I’ve done a couple telnet drivers before, so if we can’t make this work we can go there. I could try switching the current code to the session based too.

Did you use the web interface and try and create a personal token first?

To create a personal access token via the web interface. Navigate to Settings-> Manage Users. Click on the user you would like to create a personal access token for. Click on the button named "Create Personal Access Token".

Yeah not available there, that's when I went to the curl...

Hmmmm. I’ll throw something together in the morning to display the headers from the login attempt to see if we can use the session.

1 Like

Add a virtual device with this code:

Header Capture Code
metadata {
    definition (
        name: "Get PDU Headers", 
        namespace: "thebearmay", 
        author: "Jean P. May, Jr.",
        importUrl:"https://raw.githubusercontent.com/thebearmay/hubitat/main/synaccess/pduMaster.groovy"
    ) {
        capability "Actuator"
       
        command "getHeaders"
        
        attribute "headers", "string"
        attribute "props", "string"
    }   
}

preferences {
    input("serverAddr", "text", title:"IP address for PDU:", required: true, submitOnChange:true)
    input("userName", "text", title:"User Name", required: true)
    input("pwd", "text", title:"Password", required: true)
}

@SuppressWarnings('unused')
def getHeaders() {
    Map params = [
        uri    : serverAddr,
        path: "/login%20-i%20-d",
        contentType: "application/json", 
        body: [username:userName, password:pwd]
    ]
    asynchttpPost("getHeaderData", params)
}

def getHeaderData(resp, data){
    sendEvent(name:"headers", value:resp.headers)
    sendEvent(name:"props",value:resp.properties)
}

Fill in the server address, username and password; save preferences and click getHeaders. When it runs it should send the login detail to the server, and the response headers and properties (includes the headers but also potential error data) will be captured in a couple of attributes.

If you’ll PM me a screen shot of the attributes it may tell us what we need.

For anyone following this, the auth with the web interface wasn't responding in a manner that we could test and verify the code - I've left it out there should anyone want to attempt that route. As a result we implemented the telnet interface, current files are at:

https://raw.githubusercontent.com/thebearmay/hubitat/main/synaccess/pduMasterT.groovy
https://raw.githubusercontent.com/thebearmay/hubitat/main/synaccess/pduOutlet.groovy

Installed. Created 5 child devices. Went to outlet 3 and test on/off. Even through current status of the device shows off, this isn't reflected in the web panel even with a refresh....

Edit: Even if I click off (and status switches to off) if I click Refresh on the outlet it changes to on. Debug logging is on and it says it's going off but I don't know if that's a reflection of polling of the device or just the driver saying it turned off

dev:11472022-02-28 11:00:09.185 am debugpowerMode Synaccess PDU-3 off

dev:11472022-02-28 10:57:06.069 am debugpowerMode Synaccess PDU-3 off

Found it, had the on coded correctly but the off wasn't sending the right data. Try pulling a new version of the master.

1 Like

Ok seems to work but this showing in logs

image