Home Assistant: Change Binary Sensor from on/off to open/close

I use Home Assistant to tie all of the devices in my house together. I recently purchased a z-wave sensor for my garage door to tell if it was open or closed. Home Assistant would show the sensor as either being on or off. Since it represented a door I wanted Home Assistant to show it as open or closed.

Below is how I did it. My sensor’s entity is binary_sensor.garage_door.


  friendly_name: 'Garage Door'
  device_class: garage_door


Getting Started with Modding a PlayStation 2

I recently decided to buy a used PlayStation 2 and try my hand at modding it to play backups. Unlike the original XBOX, which has loads of good articles on modding, the PS2 was very lacking. Not that there isn’t some good information out there, just nothing boiled down into bullet points for a country boy such as myself.

Step 1: Get a PS2

Ebay was my first choice. Premodded PlayStation 2s go for 6-7 times what an unmodded PlayStation goes for. This is a little sad as what you need to do the mod costs very little. You’re pretty much buying a PS2 with a memory card when you buy one premodded.

You need a PS2 which has a model number that does NOT start with a 9. These unmoddable PS2s are ‘slims’ and have a shiny top.

I bought a SCPH-39001 from Ebay, commonly referred to as a fat PS2. It came with two controllers and a memory card.

Step 2: Do the Mod

Free McBoot is an exploit/mod you install on a PS2 memory card. It allows you to run unsigned code on the PS2, meaning you can run what ever you want, like game backups.

Long story short on this one, buy a memory card that already has the mod installed.

I bought a pre-installed memory card from Ebay. 

Step 3: Buy some other stuff

You’ll want the PS2 to look its best on your TV. Buy some component video cables. This is the same cable a PS3 uses for component out.

With what you purchased in steps 1 and 2, you can load games from a burned DVD or a USB hard drive. Having a ton of burned discs laying around is lame and since the PS2 only has USB 1.0 ports, a USB hard drive is going to be very slow, slower than a disc. You want to buy a SATA hard disk interface.

The SATA hard drive interface is normally part of a network adapter, though you can buy just the drive interface alone. Get a SATA interface, not IDE. With IDE you’ll be relying on old used drives, while SATA drives are modern and easy to buy new. Don’t bother with an SSD, its expensive overkill.

I bought a SATA adapter with no network interface. I also bought a 320GB SATA hard drive. Outside of my cheapness, there was no reason I could not have went with a larger drive.

Step 4: Using It

Modding the PS2 is simple enough, insert your Free McBoot memory card. That’s it. You’ll see a Free McBoot splash screen on boot and the main menu will have some more options, one of which will be Open PS2 Loader. This is the program you’ll use to launch backup ISOs from your hard drive.

You’ll need to get some backups of your games. The easiest way is to make a copy using ImgBurn. This is identical to the process you would use to make an ISO of any CD/DVD you have laying around.

Next up you’ll format your hard drive and load some ISOs onto it. For this you’ll need Winhiip and some way to connect the drive to your PC. I used a SATA to USB adapter.

Get your drive connected and run Winhiip. The first thing is you’ll need to do is to format the drive for 48 bits. After that load your ISOs.

Now plug the drive into the PS2, start Open PS2 Loader, hit O, and you should see your games.

Tip: R1+R2+L1+L2+Start+Select restarts the PS2. No need to get up to change games.

Step 5: Nice clean silence

The PS2 I purchased was dusty as hell. Gross even. The cooling fan was also loud. After taking the PS2 apart and giving every thing a good dusting and cleaning, the fan was still loud. 

I replaced the cooling fan with a Noctua 60x25mm fan. I followed this guide. I deviated from it some and connected the fan to the power supply to motherboard connector. This causes the fan to run whenever the rear power switch is on, but the fan does get the full 12v… sort of. Directly connecting the fan to the 12v made it run louder than I liked. I ended up using one of the noise suppressors that came with the fan. This made it silent. I probably could have saved some effort and connected it to the original fan’s leads.

The fan’s connection to the power supply connector.

The End

All said I spent less than $75 and took about three hours start to finish. Not too shabby.


UNRAID is Slow, What to do?

I recently built an UNRAID server for use as backup storage. The plan was to build a computer and then shuck and use the many USB drives I already had for storage. This mostly went to plan.

TLDR: Network equipment lies about connection speed.

I went with UNRAID because it boots off of a USB drive; saving a SATA port, works well with mixed drive types and sizes, and you can take a drive out of the array and read/write to it from any other PC.

The build:

Case: Cooler Master Elite 342 RC-342-KKRJ-GP 400W
CPU: Intel Celeron 2.90 GHz Dual Core FCLGA1151
Motherboard: MSI Pro Series Intel B250
Memory: Corsair Vengeance LPX 16GB (2x8GB) DDR4 DRAM 2400MHz
Boot Drive: SanDisk Cruzer Fit CZ33 16GB
Misc Items likes fans and cables I already had.

I had five 4TB Western Digital drives in USB enclosures that I planned on using in UNRAID. I bought a 4TB SATA drive, getting me a total of six drives. All of the USB drives appeared to work fine in their enclosures, no SMART errors, no problems reading and writing to them. After taking the drives out of their enclosures and putting them into the new server, three of them started reporting SMART errors. I wasn’t happy about this, but figured I would load them up and see what happens, only buying new drives if they actually failed.

Right off my transfer speeds were limited to 10-12MB/s. I was expecting more like 100MB/s, being on a gigabit network. After fiddling around for a bit I did a restart, UNRAID refused to boot. I got a monitor on it and saw in the message buffer that one of the drives was freaking out. I removed the drive and UNRAID booted up. I still had the slow transfer speeds though.

I disconnected the other two SMART error reporting drives. It was still slow. I logged in via the command line and did an rsync between one of the formerly USB drives and the new drive, still slow, albeit I was getting 15MB/s now. I put the two SMART error reporting drives back in.

I was a little lost at this point. If rsync between two sata drives was only getting me 15MB/s, something was seriously up. I figured the former USB drives were crappy and bought another new 4TB SATA drive. A day later I tried another rsync between the new drives. Same problem.

Now I started down the horrible path of googling ‘UNRAID slow.’ There wasn’t much to see here. Lots of posts about parity drives causing slow downs; I wasn’t using a parity drive. Lots of posts about using a cache drive; also not relevant since I’m not using parity.

I kept pounding my head trying everything and anything I could think of until I stumbled onto a problem with rsync. I was using the -z option, this compresses the files before they are copied. This is all good when sending files over the Internet like I normally would, but when going disk to disk the overhead kills the transfer speed. I ditched the -z option from my rsync command and I was getting full speed between all of my disks. 140MB/s+

Then I tried to do a copy from my Windows desktop to UNRAID’s windows share. Slow again. 10-12MB/s. I tried FTP, same deal. I tried rsync (no -z), same deal. Now I had a network problem.

My desktop, the unraid server, and my router all had gigabit ports. My desktop could do 100MB/s (Gigabit speeds, bit vs byte) to other devices in my house. Nothing could do better than 12MB/s to UNRAID though. UNRAID and my router both showed that UNRAID was connected at 1Gbp/s. Something was a liar.

I tried my laptop on the same ethernet cable and wall jack that UNRAID was using. The speed was bad. I tried UNRAID on a different cable and wall jack. The speed was great. Something was wrong with my cabling.

I swapped cables, redid did the wall jacks, no luck. I then tried making a simple network between my desktop and UNRAID, just a switch and two ethernet cables. The speed was great. There was only one thing left that could be the problem, the switch built into my router.

In the end, it ended up being a dodgy port in the router’s switch. Even though it says devices are connected at gigabit speeds, they are not. It works fine as a 100mbp/s port. No latency or dropped packet problems. I plugged the UNRAID server into a different port on the router, problem solved.

That’s my UNRAID saga. Hopefully my experience will help someone else.

Almost as a side note, I’ve been very happy with UNRAID. I have a 24TB array about 1/3 full. I have this 24TB array split into two 12TB user shares. I sync up the shares with rsync now and again as a backup. I’m not using parity. If a drive fails in the array I’ll either replace it with live data or use the backup in the other share to replace it. I still have a good collection of USB drives and I plug those in and rsync to them too, making for a nice third backup.

Here are some of the scripts I use to keep everything synced.

Syncing between the user shares:

rsync -Wa –delete –progress /mnt/user/UNRAID/* /mnt/user/UNRAID-BK/

Syncing between internal disks and USB disks:

dmesg | tail -10
echo -n “Mount which device? ”
echo “Mounting $DEVICE”
mkdir /root/disk
mount $DEVICE /root/disk
if [ $? -gt 0 ]
echo “Could not mount $DEVICE”
echo -n “Which disk to sync? ”
read DISK
echo “SYNCING disk$DISK!”
rsync -aW –delete –progress /mnt/disk$DISK/* /root/disk
umount $DEVICE
rmdir /root/disk

Original XBOX: Your XBOX requires service – No Error Code

I managed to mess up the files in my original XBOX’s C: drive. The XBOX would boot to this error:

According to the Internet there should have been an error code in the top corner to tell me what was going on.  I did a good enough job on it I wasn’t getting any error at all.

I had a backup of my XBOX’s drive and eeprom. What I needed to do was get access to the C: drive so I could copy over the backed up files. My first thought was to boot off of a DVD and FTP the files over. I tried Slayers and Hexen, neither would boot. Seems the XBOX needs something on the C: drive to be able to boot a DVD.

My next plan was to plug the drive into a PC. There were a few problems with that. I didn’t have anything with an IDE interface like the XBOX’s drive uses. The drive is locked to the XBOX, meaning I would have to unlock it to use it on another computer. The XBOX’s drive uses the FATX file system and I didn’t think anything supported that.

The first problem was solved by a USB to IDE adapter. I ordered a Vantec CB-ISATAU2 SATA/IDE. It also supports SATA drives. It’s pretty nice.

The second problem is solved by xboxhdm23usb. Among many other useful things, it will lock and unlock drives.

The third problem was solved by Xplorer360. It will allow you to copy to/from the FATX file system.

Here is what I did:

  1. Removed the hard drive from the XBOX.
  2. Changed jumper on the drive from master with slave to single/master.
  3. Plugged the drive into the USB adapter and plugged it into my PC.
  4. Placed my eeprom backup in the same folder as xboxhdm23usb.
  5. Used xboxhdm23usb to unlock the drive.
  6. Opened Xplorer360 and use it to copy in your backup.
  7. Locked the drive
  8. Put the jumper on the drive back to master with slave.
  9. Put the XBOX back together.

Some gotchas that I ran into:

The USB adapter was very flaky when connected to the front USB ports on my computer. It would only get recognized half the time and when recognized would sometimes just drop out. It worked fine when connected to the rear USB ports. This is the only device I’ve ever hard problems with on my front ports. The front ports are USB 2.0 while the rear ports are 3.0, maybe the problem, maybe not.

Don’t forget to lock the drive when you are done. I had it my head the drive starts locked and you have to unlock it to use  it, that is not right. The drive is unlocked until locked and then locked until unlocked.

In the end it worked out for me and my XBOX is working properly again.


Cheap DIY treadmill desk that won’t murder your wrists.

I sit at a computer the better part of my day. I try to mitigate this some by walking around (pacing) while I’m on the phone. On days I work I’m lucky to get in 7,500 steps, this is below the 10,000 generally considered to be healthy.

One day I stumbled across an article about a DIY treadmill desk, essentially you bungie cord a board to your treadmill, set your laptop on it, and then walk and work. That piqued my interest, but my first thought was that it would kill my wrists. If I don’t keep my hand level with my wrist/arm I feel it very quickly. I’m well aware of the permanent damage you can do to yourself by keeping poor wrist posture.

You can buy some really good looking treadmill desks that can be adjusted up and down, but its a large expense for something I wasn’t sure I would even be able to use. I was on the fence if I could even walk and type at the same time.

I wanted something I could try out cheaply. I built a reasonable facsimile for about $50.

My idea was this:

  • Use a TV wall mount to attach a spare monitor to the wall in front of the treadmill
  • Set my laptop on a table next to the treadmill.
  • Build a raised desk attached to the treadmill’s rails. This would be where the keyboard and mouse would sit.

Parts I had to buy:

Total: $51.50

Parts I already had:

  • Treadmill
  • laptop
  • extra monitor
  • keyboard
  • mouse and pad
  • build tools and fasteners
  • table to put laptop on

Building it

The general idea is that you’re going cut one of the shelf boards into legs and attach them to the intact board.

The top of the desk should be level with your elbow when held at your side. I stood on the treadmill and measured the difference between my elbow and the top of the rail, this was 7.5 inches. My U-bolts were 2.5 inches wide. To give myself some room I took the elbow measurement and added 4 inches (U-bolts size plus extra) to it. 11.5 inches was the length of my desk legs.

After cutting the legs I needed to know where to drill holes for the U-bolts to go. I measured from the top of the leg down 7.5 inches and made a mark, this was where I needed to drill for the first hole for the U-bolt.

I assembled the desk in place. I attached the legs to the treadmill with the U-bolts, and then placed the remaining board on top and screwed it into the legs.

My last step was mounting the monitor to the wall. I followed the instructions that came with the mount. You’ll want the monitor to be positioned in such away that you don’t have to look up or down to see it.

Below is what it looks like completed. Not the prettiest project I’ve ever done, but functional. Fortunately I work at home and no one ever sees my office.

20141023_215456727_iOS20141023_215517791_iOS desk2

How does it work?

Surprisingly well. I set the treadmill to 1.6 MPH. I’m able to walk and type and use the mouse OK. Walking doesn’t mess with my concentration. I gave Kerbal Space Program, Team Fortress, and DOTA a try, no problems at all. I did have to train myself a bit not to step off of the treadmill when circle strafing in Team Fortress.. I would naturally step to the side and eventually make it off of the treadmill.

I don’t use the treadmill desk full time. I have a normal sit down desk that I use for the majority of the day. I use the walking desk for an hour or so to make sure I meet my 10,000 step goal for the day. I do roughly 1,000 steps each ten minutes I walk at 1.6 MPH.

Future Improvements/If I did it again

If I had to do it over again I would use actual real solid wood for the desk. It would look better, be stronger, and last much longer. Engineered wood was some good uses, furniture isn’t one of them. Especially furniture built by a guy like me.

I would take off the control console of the treadmill and run all of my wires through the middle of the metal support posts.

I would also think long an hard about a better mounting method than the U-bolts… they’re ugly.

 Three Week Update (11/10/14)

After three weeks I still use the treadmill desk everyday. My goal is to have 10,000 steps walked out before 5PM. This usually results in me walking on the desk for an hour or so starting at 3PM.

I normally walk at 1.6 miles and hour. I can walk at 2.5 miles an hour and still work, but at anything over 1.6 miles an hour I tend to think more about walking than what’s on the monitor.

Instead of continuing to use my laptop, I purchased a 25 feet long HDMI cable and connected the treadmill’s monitor to my office PC. I have a wireless keyboard and mouse, so when I want to walk on the treadmill I just move them over there. This works better as there is no loss of continuity when switching from my usual desk to the treadmill. I also do not have to plug in and unplug my laptop every day.

I also took the time to bundle up all of the cables and hide them. This did a lot for improving the appearance, but I still wouldn’t call the setup an attractive piece of furniture. If the particle board were to deteriorate or I were to break the desk I would definitely spend the money on a commercially made desk for the appearance alone.