Support Apnea Board & OSCAR  

Difference between revisions of "FlashAir"

From Apnea Board Wiki
Jump to: navigation, search

(Cleaned up the script to avoid confusion)
(Begin editing content and fixing typos)
Line 4: Line 4:
 
Most urgent is the problem that Mac users face: the new macOS Big Sur has broken Java, which was used by the program FlashPAP. So we start with a solution to this acute problem.
 
Most urgent is the problem that Mac users face: the new macOS Big Sur has broken Java, which was used by the program FlashPAP. So we start with a solution to this acute problem.
  
===macOS solution for FlasPAP not working in macOS Big Sur===
+
===macOS solution for FlashPAP not working in macOS Big Sur===
 
The following text needs to be edited:
 
The following text needs to be edited:
  
Looks like you recently upgraded to Big Sur on your MacBig Sur seems to have broken Java on many machines so it may be a while before an Apple update comes out.
+
As an alternative to using FlashPAP and Java, you can use Macs built-in "'''rsync'''" and '''AppleScript''' instead.  Copy and paste the script into Macs '''Script Editor''', make the changes necessary for your network, and save it as an application.  Script Editor can be found in the /Applications/Utilities folder in FinderThe script will mount FlashAir, copy the files to your computer where you can import the data into OSCAR.
  
You can also try to install Oracle Java yourself.  FlashPAP was written in Java 7 I believe, so you would need to install Java 8 (LTS???).  I think Java is up to 14 or 15 but I don't know if they are all backwards compatible with the older stuff. 
+
The CopyCPAP script requires you to already have a working FlashAir card setup.
Another option to search for would be OpenJDK or AdoptOpenJDK.  They are open-source projects for Java.
 
  
if you're not stuck on using FlashPAP, you can use Macs built-in "'''rsync'''" and '''ApplScript''' instead.  It gets the job done and is my preferred way of doing it all.  I just turned it into an AppleScript on my desktop, and it is not affected by Java.  Doubleclick it and it mounts FlashAir, copies the files that have changed to your computer where you can import the data into OSCAR.  If it sounds like something you would like to try I will post the AppleScript code here and give you guidance getting it working, it's fairly easy.
 
  
I am still on Catalina and have no intention of upgrading to Big Sur until they get another upgrade or 2 fixed first!
+
'''Code for CopyCPAP script:'''
 
 
Here is the AppleScript for review:
 
 
 
'''Code:'''
 
 
  <nowiki>#Enter you FlashAir card name or IP address below (between the quotes " ")
 
  <nowiki>#Enter you FlashAir card name or IP address below (between the quotes " ")
 
set diskName to "192.168.1.240"
 
set diskName to "192.168.1.240"
Line 27: Line 21:
 
#Enter the location of OSCAR.app, by default it's /Applications
 
#Enter the location of OSCAR.app, by default it's /Applications
 
set oscarLocation to "/Applications"
 
set oscarLocation to "/Applications"
 +
#
 +
#Do not edit anything below this line
 
#
 
#
 
#Mount the FlashAir card and make sure it shows up in /Volumes
 
#Mount the FlashAir card and make sure it shows up in /Volumes
Line 60: Line 56:
 
quit application "Terminal"</nowiki>
 
quit application "Terminal"</nowiki>
  
after a few minor changes for your computer, just copy it into Script Editor and save it as an app.
+
The app needs exclusive use of Terminal.  If you have any instances of Terminal running you should close them before running the app. 
 +
 
 +
The first time you run the app it may take some time for "rsync" to copy all the data from your FlashAir card.  One year of data can take approximately one hour to copy, more data will take even longer.  After the initial run, "rsync" will then only copy files that have changed on your FlashAir card so it will only take a minute or two.  Once your data is copied, the app will open OSCAR for you. At this point you can you can import your data into OSCAR as you normally do.
  
 
And so on, and so further...
 
And so on, and so further...

Revision as of 00:07, 9 December 2020

Stub.png

This page will be filled with information on Monitoring the CPAP data wirelessly.

Most urgent is the problem that Mac users face: the new macOS Big Sur has broken Java, which was used by the program FlashPAP. So we start with a solution to this acute problem.

macOS solution for FlashPAP not working in macOS Big Sur

The following text needs to be edited:

As an alternative to using FlashPAP and Java, you can use Macs built-in "rsync" and AppleScript instead. Copy and paste the script into Macs Script Editor, make the changes necessary for your network, and save it as an application. Script Editor can be found in the /Applications/Utilities folder in Finder. The script will mount FlashAir, copy the files to your computer where you can import the data into OSCAR.

The CopyCPAP script requires you to already have a working FlashAir card setup.


Code for CopyCPAP script:

#Enter you FlashAir card name or IP address below (between the quotes " ")
set diskName to "192.168.1.240"
#
#Enter the location you want your xPAP data transferred to (between the quotes " "). The folder (directory) must already exist!
set copyLocation to "/Users/yourusername/Downloads/FlashAirData/"
#
#Enter the location of OSCAR.app, by default it's /Applications
set oscarLocation to "/Applications"
#
#Do not edit anything below this line
#
#Mount the FlashAir card and make sure it shows up in /Volumes
try
    mount volume "http://" & diskName
    repeat until diskName is in (do shell script "ls /Volumes")
        delay 0.2
    end repeat
on error e
    display dialog "An error occured: " & e
end try
#
#Open Terminal and use rsync to copy FlashAir to computer or NAS
tell application "Terminal"
    activate
    do script "rsync -avz /Volumes/" & diskName & "/" & " " & copyLocation in window 1
end tell
#Pause the app until rsync is finished
set isBusy to true
repeat until isBusy is false
    tell application "Terminal"
        tell window 1
            set isBusy to busy as boolean --> Test if busy
        end tell
    end tell
    delay 1 --> Check every second
end repeat
delay 1
#Unmount FlashAir so we don't accidently change anything on the card
do shell script "diskutil unmount /Volumes/" & diskName
delay 1
do shell script "open" & " " & oscarLocation & "/OSCAR.app"
quit application "Terminal"

The app needs exclusive use of Terminal. If you have any instances of Terminal running you should close them before running the app.

The first time you run the app it may take some time for "rsync" to copy all the data from your FlashAir card. One year of data can take approximately one hour to copy, more data will take even longer. After the initial run, "rsync" will then only copy files that have changed on your FlashAir card so it will only take a minute or two. Once your data is copied, the app will open OSCAR for you. At this point you can you can import your data into OSCAR as you normally do.

And so on, and so further...




Donate to Apnea Board