[RELEASE 10/26/2017] BitBar V2: Display & Control SmartThings from the macOS Menubar

BitBar V2: Display & Control SmartThings from the macOS Menubar

Overview

ST BitBar V2 can monitor SmartThings devices/sensors from the Apple macOS Top Menu Bar using freeware BitBar software and installing this customized SmartThings integrated BitBar plugin and legacy mobile ST SmartApp.

ST BitBar V2 can display and control your SmartThings thermostats, locks, switches, dimmers, routines and modes. It also displays temperature, contact, presence, motion sensors along with battery levels and historical events for selected devices. There is now extensive control of menu & submenu titles, emojis, fonts, colors, pitches and battery warning levels defined by the user in the SmartThings mobile client.

How to Install/Upgrade:

New Users

Existing STBitBarApp V1 Users

  • Update your SmartThings IDE GitHub REPO name in the SmartThings IDE “My SmartApps” under settings as follows.

    Name Value
    Owner kurtsanders
    Name: STBitBarApp-V2
    Branch master
  • Perform an Update from Repo to install and publish BitBar Output App .

  • If you upgrade SmartApps manually, replace the V1 bitbar-output-app.groovy with the new version. Save and Publish.

  • Replace the following local files (located in your Mac BitBar Plugin Directory on your Mac ) with same files for previous release. Rename if needed.

ST_Python_Logic.py
ST.1M.sh

Do Not replace your ST_Python_Logic.cfg file which contains your personal SmartThings URL and Secret.

Features added in Versions 2.xx & 3.xx

  1. Added Past Device History Events to selected devices (Motion Sensors, Presence Sensors) and modified the GUI with user options for control of the number of past events displayed and date-time format (12/24)
  2. Added support for Extended ASCII Characters in Main Menu, Modes and Routine Names
  3. Added additional control of Font Names, Font Colors and Font Pitch Sizes in the GUI used by the Apple BitBar display
  4. Added logic for Low Battery Warning Level and Emoji Selection in the GUI when Mac Option key is held and BitBar is displayed
  5. Better formatting of the API URL and Secret displayed in the ST Live Logging Screen and GUI
  6. Redesigned the GUI into more Sections with Links to valid Apple Font Names and Emoji names
  7. Added new Program Version Information and Read-Only view of GUI Active Options from the BitBar Actions & Shortcuts menu (at bottom on BitBar)
  8. Cleaned up the Thermostat Display Controls
  9. Added control of section horizontal bars
  10. Changed display format for Modes and Routines
  11. Redesigned BitBar Actions & Shortcuts menu (at bottom on BitBar)
  12. GitHub ReadMe file enhanced to help with new user installation

New Features in Beta 4.x.x : :new:

  1. Allow one ST device of either a lock, contact, switch, or temperature sensor to be designated in the BitBar Top Menu. Red & green emoji’s will be shown in the top Mac menu bar for the selected device status with a lock, contact or switch. A integer value will be displayed when a temperature sensor is designated.
  2. Provide a MacOS right sidebar notification alert when:
  • Acknowledging a requested device change from the BitBar Menu Bar
  • Showing the timed device status refresh
  1. Allow user to turn On|Off MacOS sidebar notifications for routine status polling and device changes
  2. Provide an user defined automatic device refresh after a ST device change from BitBar Output (default 5 sec after device change which allows time for the device to report status to ST Cloud API)
  3. Allow the secret API strings to be SMS delivered (unencrypted) to a USA mobile phone number from the API Setup Page for new users to copy to the ST_Python_Logic.cfg file.
  4. Added the following information in the mobile ST BitBar Output SmartApp main menu for:
  • ST BitBar Output SmartApp Version
  • ST_Python_Logic.py Version
  • ST.xm.sh Version (where ‘x’ is an integer number (default is now 1) reflecting the number of minutes for normal pooling of devices defined to BitBar Output App. Please do not change this to less than 1m which pools to frequently and will impact Mac performance. If you would like a slower polling rate, I recommend ‘3m’ or ‘5m’ for ‘x’ in ST.xm.sh file
  • BitBar Plugin Folder Location
9 Likes

I just updated and noticed in the Version Information of the BitBar app, it shows Not Installed for the ST_Python_Logic.py and BitBar Plugin Directory. Did I do something wrong or is that a feature coming in a future release?

1 Like

Answer: That extended version information gets populated when the new V2.3 ST_Python_Logic.py file gets installed in your local BitBar Plugins directory and runs/refreshes for the first time which sends this Python version version information to the SmartThings SmartApp. Here is my SmartApp screen when both are at 2.3.

still getting the same. Under STBitBarApps Actions and Shortcuts: Your Current Running Program Version Information shows BitBar OutPut App v2.30 and ST_Python_Logic.py v.2.30. Tried refresh, quitting the bitbar app, quitting the ST app and reloading it.

Also, Under STBitBarApps Actions and Shortcuts: Launch Browser to View BitBarApp v2.30 Github Software Resp takes me to the old Resp @ https://github.com/kurtsanders/STBitBarApp

@jkp: Thank for finding this: I just updated the ST_Python_Logic.py incorrect link “Under STBitBarApps Actions and Shortcuts” to the correct new STBitBarApp-V2 repo. Please update and replace the previous.

If you wouldn’t mind, please double/triple check that you have all the new code re-installed (both on the Mac BitBar Plugin directory and SmartThings “My SmartApps” from the **new STBitBarApp-V2 GitHub Repo. The old V1 versions are <2.30, so it looks like you have the correct files installed. How about checking to make sure you do not have any V1 files left in either the SmartThings IDE or the BitBar Plugin directory.

I created a brand new GitHub repo name for V2, which might cause some issues with V1 users still pulling updates from the OLD GitHub without the “-V2” suffix. I have rename the old V1 repo with DEPRECIATED and this will result in V1 customers just getting a REPO message that their V1 repo is not valid. They will need to change their repo name to STBitBarApp-V2 or replace the V1 code manually by cut & paste.

Here is what your SmartThings IDE “My SmartApps” row for the BitBar Output APP should show. Note the new icon being a blue outer ring around the Black Inner circle, the new STBitBarApp-V2 (master) name and Published.

BitBar Output App in The ST Mobile Client: (Note New Icon)

Here is the version information from the BitBar Actions and ShortCuts

image

1 Like

Hi looking for some help here. I did make the SmartApp updated as well as the Python and ST.5M file. When I open BitBar it says Error While communicating with ST API.

here is the error from the ST logs:
5:52:13 PM: error java.lang.ClassCastException

Generally that error means that the ST_Python_Logic.py BitBar plugin is not able to communicate with SmartThings: Here are a few things you can look for that might cause this error:

  1. Insure that you have Enabled OAuth for the BitBar Output App in the SmartThings IDE: At the My SmartApps page, click the little Edit Properties icon for the BitBar Output App, then click OAuth section, then click Enable OAuth in SmartApp.
  2. Then follow Section 2 instructions to get your specific SmartThings URL and secret text strings from the BitBar Output App.
  3. Edit your ST_Python_Logic.cfg file using Apple’s textedit command (or your favorite Text file Editor to insure that you have added your specific SmartThings URL and Secret strings from the BitBar Output App as I have shown the example below:

[My Section]
smartAppURL = “https://graph.api.smartthings.com:443/api/smartapps/installations/555555-66666-7777-88888888/
secret = “1111-222-333-444-555-666”

  1. Refresh the BitBar Menu in your macOS menu bar, by clicking on the “Error While communicating with ST API” and press {Command Key + R}

Thanks for the detailed instruction, I tried but I’m still getting the same error. I will try to delete completly and start from scratch maybe that will help

Edit: I just did a complete re-install but I’m still getting the same error again

Sorry to hear! I will PM you so we can try to resolve.

I followed the existing-user-update instructions in the OP here, and it worked great.

I have a relatively simple BitBar setup (I just need a few basic things there), but it’s all working well, and it looks great! Thank again for all your hard work on this project, Kurt - this is a fantastic gem of convenience!

Cheers, Chris

1 Like

Thanks @Hydro for the positive feedback and I’m sure your # of devices will grow now that you can see and control them from the macOS and mobile clients.

I recognize that the installation of this application is far too many steps for the typical user. I’m investigating either creating either a pre-packaged BitBar/Plugin as a single install package, or a basic YouTube video.

There are several complicated areas where the install can fail for the user, so if there are any useful tips that I need to include in the setup instructions or automate that would help others, please feel free to identify them, and I will correct.

Welcome to the V2 Club!
image

Hi,

I followed the instructions for existing users by replacing the .groovy code and updating the ST.5m.sh and ST_Python_Logic.py.

I am now getting an error:
40

If I run in the terminal I get this:
– /Applications/BitbarPlugins/ST.5m.sh: line 7: syntax error near unexpected token `newline’

– /Applications/BitbarPlugins/ST.5m.sh: line 7: `<!DOCTYPE. html>’ (added a dot as textstring got hidden here in the forum)

@Mario_Fuchs

You may accidentally downloaded the script(s) as HTML… you need to download the script(s) by clicking on the GitHub’s Raw button and copy and pasting the code on a text editor and saving it to the folder for your plugins.

Here are the links to the raw files for the Mac:

ST.5M.sh
ST_Python_Logic.py
ST_Python_Logic.cfg

1 Like

Thanks, that was it. Might be good to include something about this procedure in the installation instructions.

1 Like

:grin: Glad to hear!

I definitely will add this note in the next update to the Readme instructions!

2 Likes

Hi Kurt
Getting this error
Traceback (most recent call last):
File “/Users/Lucky/Documents/BitBarPlugin/ST/ST_Python_Logic.py”, line 500, in
print “–Mode ({})”.format(thermostat[‘thermostatMode’].title()), buildFontOptions(3)
AttributeError: ‘NoneType’ object has no attribute ‘title’

Plz help…Cheers

Updated to V2 without issue. Still had to run the

sudo chmod +x /{replace with proper path}/BitBar/ST.5m.sh

command.

2 Likes

Good to know, chgmod +x seems to be a required step on the macos systems, which I have included in the instructions several version ago!

1 Like

Thanks for finding this error. What type of thermostat do you have? This error appears to be related to your thermostat not providing a current “Operating Mode”, like Heat, Cool. Auto, Off. I might need to change code for those few thermostats that do not provide an expected

Hi Kurt
using nest thermostat, based UK, does not have cooling mode
Thank you

1 Like