Away time in Home Assistant and surviving reboots

One of the biggest reasons I wanted to set up Home Assistant was to be able to handle a “vacation mode” for my house to change things like the thermostats and lighting.  The addition of an input_boolean for this is really straight forward.  However reminding myself to set vacation mode if we are away for a long period of time is something a bit harder.  To do this, we need to calculate the away time for each user.

The Problem

The linchpin for knowing if I should send a reminder is around how long a person has been away.  Originally thought I could just use my Ubiquiti access point’s last_seen time and calculate hours from there.  However this field disappears after about 10 minutes of the user being disconnected from the access point.  So I needed to find a way to persist the last_seen time event after the access point removes the data from the device_tracker entry.

Continue reading

Posted in Home Automation | Tagged , | Leave a comment

PMD and Salesforce: Clean Code is Awesome

If you’re not aware, having clean code is more than just about readability.  It’s about sustainability, re-usability and knowing that your code is doing what you want it to do.  This is where PMD comes into the picture.  PMD is a static code analysis tool that takes code from many different languages, analyzes it and provides you with feedback.  Fortunately for the Salesforce world PMD now supports Apex as one of it’s languages.  So, let’s dive into how to set it up, run it and then how to use some of the rules included.

Continue reading

Posted in Development, Salesforce | Leave a comment

Turning off a warmer: An intro to home automation

Now this little warmer may look innocent enough, but it’s a disaster waiting to happen.  If you leave it alone, it will kill your whole family without remorse.  Ok, that may be a bit hyperbolic, but these things can be kind of dangerous.  According to the National Fire Protection Association in 2013 seven people died each day in the US due to home fires.  And half of those deaths occurred between the hours of 11 pm and 7 am.  Now, how many were caused by this cute little scooter, probably not many.  But devices like this can cause fires.  This scooter is a wax warmer.  It heats up a tray that melts wax and makes your house smell lovely.  But if you leave it on too long (by lets say forgetting about it and leaving it on for 48 hours) you get a different result.  This has happened more than once in our household, and that’s what leads me to my first real world application of home automation.

Continue reading

Posted in Home Automation | Tagged , , | Leave a comment

Postman – Logging in to Salesforce

Logging into Salesforce with Postman
We’ve been slowly replacing all of our SOAP endpoints with REST endpoints inside of Salesforce.  The upside of this is that they are much easier to use.  The downside is that they are harder to functionally test without a bunch of work to generate session Ids.  (This was made even more frustrating by a recent change that obfuscates out the session id in debug logs)  So, I decided to figure out how to run a Postman request that would then store the session id and server url for later requests to use.  This post will cover how to set that up and use this one request.  I plan on writing more in-depth blog later about how to use Postman to test custom REST endpoints later.

Continue reading

Posted in Development, Salesforce | Tagged , | Leave a comment

JMeter – Logging Into Salesforce for Automated Testing

JMeter and Salesforce
I’ve written quite a few web services in Salesforce, and I’ve written about them a couple of times.  And my love of testing is pretty well known.  One thing that’s always been a problem is testing the web services in an automated fashion as a real consumer would.  I’ve talked about manually testing them with SoapUI before, and while useful doesn’t fit into an automated process well.  So let’s jump into the world of JMeter and how we can automate our web service testing for Salesforce.

Continue reading

Posted in Development, Salesforce | Tagged , , , | Leave a comment

Jira Attachments: Getting an attachment from a Jira


I previously did a post on writing Jira Attachments from Salesforce, and the question has come up of how to write Jira Attachments into Salesforce.  This is actually WAAAAY easier than it was to write attachments out.  The way that the data is structured from the Jira, we can get a list of all the attachments and the link to it’s content directly from the Jira GET request.  This makes for way fewer calls to get the actual content of the attachment.

Continue reading

Posted in Development, Salesforce | Leave a comment

Milestone Trigger Time Calculator


I recently stumbled upon a “new” feature in Salesforce that allows you to use an Apex class to calculate your milestone trigger time for entitlement processes.  Given a new feature that I’m working on for our entitlement process, I thought to myself that this could be a good chance to play with it and see what I could do.  If you’re not familiar with the entitlement process in Salesforce, take a chance to look over (or run through) my hands-on training for entitlements so that you’re familiar with the terminology and the concepts since I’ll be jumping right in.

Continue reading

Posted in Development, Salesforce | Tagged , , | Leave a comment

VPN Setup and Auto Connect from Command-line

New servers mean new things to play with and new setups that have to be done.  I set up a new VM that I wanted to always be connected to a VPN and for that VPN to come up whenever the system is started.  The biggest “problem” here is that this VM is running in runlevel 3 so no GUI is available.  So let’s jump into setting up an OpenVPN client using network manger’s command line interface

While these instructions are written for Fedora 25, they should work on any system using NetworkManager.  You will have to figure out what packages you need and how to install them if you are not using an RPM (and probably Red Hat based) system.

Continue reading

Posted in Computers, Linux | Leave a comment

Javascript and Visualforce: Tips and Tricks


In the web 7.0 or whatever version of the web we’re in, Javascript is king. Now, there’s lots of stuff you can do directly with Visualforce (like dynamic picklists) but sometimes for the best user experience you’ll want to use Javascript to make it even better. There are lots of Javascript tutorials out there and there are lots of Visualforce tutorials out there (don’t forget Trailhead) so I’m going to talk about some tricks that people should know when working with Javascript on Visualforce

Continue reading

Posted in Development, Salesforce | Tagged , , | Leave a comment

Managing reports and dashboards programatically

One of the challenges you get when you have a special snowflake org is lots of people want to write lots of reports and lots of dashboards for each of their special use cases.  Now, lots of times reports aren’t the right way to go with this so you have to educate your users on the right way to do this and their old reports get abandoned.  Or a user will create a one off report and never look at it again.  As it stands right now, we have several thousand reports that haven’t been looked at in more than 90 days.

Continue reading

Posted in Development, Salesforce | Tagged , , , | Leave a comment