Support Apnea Board & OSCAR  

Difference between revisions of "FlashAir"

From Apnea Board Wiki
Jump to: navigation, search

m (Changed headings to produce HR)
(Edited script and changed tag for FlashAir config)
Line 13: Line 13:
  
 
===Code for CopyCPAP script:===
 
===Code for CopyCPAP script:===
  <nowiki>#Enter you FlashAir card name or IP address below (between the quotes " ")
+
  <nowiki>(* Updated 11 December 2020 *)
 +
#
 +
#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 20: Line 22:
 
#
 
#
 
#Enter the location of OSCAR.app, by default it's /Applications
 
#Enter the location of OSCAR.app, by default it's /Applications
 +
# if you have it installed on your desktop you can change it to "/Users/yourusername/Desktop
 
set oscarLocation to "/Applications"
 
set oscarLocation to "/Applications"
 
#
 
#
#Do not edit anything below this line
+
# Do not edit anything below here ############################
 +
#
 +
# Close any running instances of Terminal
 +
quit application "Terminal"
 +
delay 3
 
#
 
#
 
#Mount the FlashAir card and make sure it shows up in /Volumes
 
#Mount the FlashAir card and make sure it shows up in /Volumes
try
+
tell application "Finder"
    mount volume "http://" & diskName
+
try
    repeat until diskName is in (do shell script "ls /Volumes")
+
if not (exists "/Volumes/" & diskName) then mount volume "http://" & diskName
        delay 0.2
+
repeat until diskName is in (do shell script "ls /Volumes")
    end repeat
+
delay 0.2
on error e
+
end repeat
    display dialog "An error occured: " & e
+
on error e
end try
+
display dialog "An error occured: " & e
 +
end try
 +
end tell
 
#
 
#
#Open Terminal and use rsync to copy FlashAir to computer or NAS
+
#Open Terminal and use rsync to copy FlashAir to your computer or NAS
 
tell application "Terminal"
 
tell application "Terminal"
    activate
+
activate
    do script "rsync -avz /Volumes/" & diskName & "/" & " " & copyLocation in window 1
+
do script "rsync -avzP /Volumes/" & diskName & "/" & " " & copyLocation in window 1
 
end tell
 
end tell
 
#Pause the app until rsync is finished
 
#Pause the app until rsync is finished
 
set isBusy to true
 
set isBusy to true
 
repeat until isBusy is false
 
repeat until isBusy is false
    tell application "Terminal"
+
tell application "Terminal"
        tell window 1
+
tell window 1
            set isBusy to busy as boolean --> Test if busy
+
set isBusy to busy as boolean --> Test if busy
        end tell
+
end tell
    end tell
+
end tell
    delay 1 --> Check every second
+
delay 1 --> Check every second
 
end repeat
 
end repeat
 +
delay 2
 +
# Eject FlashAir so we don't accidently change anything on the card
 +
tell application "Finder"
 +
try
 +
eject alias diskName
 +
end try
 +
end tell
 
delay 1
 
delay 1
#Unmount FlashAir so we don't accidently change anything on the card
+
# Now open OSCAR and quit Terminal
do shell script "diskutil unmount /Volumes/" & diskName
 
delay 1
 
 
do shell script "open" & " " & oscarLocation & "/OSCAR.app"
 
do shell script "open" & " " & oscarLocation & "/OSCAR.app"
quit application "Terminal"</nowiki>
+
quit application "Terminal"
 +
</nowiki>
  
 
Once you save the the file as an application it can be used like any other app on your Mac.  Just double-click it to start it.
 
Once you save the the file as an application it can be used like any other app on your Mac.  Just double-click it to start it.
Line 66: Line 81:
  
 
==Sample config file for FlashAir==
 
==Sample config file for FlashAir==
A sample config file that works with FlashAir
+
A sample FlashAir config file:
<br /><br />
+
<br />
 
----
 
----
<code>[WLANSD]<br />
+
<pre>[WLANSD]
 +
 
 +
DHCP_Enabled=NO
 +
IP_Address=192.168.1.240        ← Change to the fixed IP you want
 +
Subnet_Mask=255.255.255.0
 +
Default_Gateway=192.168.1.1            ← Change to your router IP
 +
Preferred_DNS_Server=192.168.1.1    ← Change to your router IP
  
DHCP_Enabled=NO<br />
+
[VENDOR]
IP_Address=192.168.1.240        ← Change to the fixed IP you want<br />
 
Subnet_Mask=255.255.255.0        <br />
 
Default_Gateway=192.168.1.240        ← Change to your router IP<br />
 
Preferred_DNS_Server=192.168.1.240    ← Change to your router IP<br />
 
  
[VENDOR]<br />
+
VERSION=F15DBW3BW4.00.04
 +
CID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    ← Unique ID number, don’t change
 +
PRODUCT=FlashAir
 +
APPSSID=MyWiFi            ← Your WiFi name
 +
APPNETWORKKEY=MyPassword    ← Your WiFi password (will show as asterisk)
 +
APPNAME=resmedfa            ← Name for your FlashAir card
 +
APPMODE=5        ← Important: this must be set to 5
 +
APPAUTOTIME=0
 +
DNSMODE=1
 +
UPLOAD=1
 +
NOISE_CANCEL=2
 +
LOCK=1
 +
WEBDAV=1
 +
TIMEZONE=-16
 +
</pre>
  
VERSION=F15DBW3BW4.00.04<br />
+
The TIMEZONE is calculated by using your UTC offset * 4. For example if your UTC is -4 then (-4 * 4 = -16)
CID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    ← Unique ID number, don’t change<br />
 
PRODUCT=FlashAir<br />
 
APPSSID=MyWiFi            ← Your WiFi name<br />
 
APPNETWORKKEY=MyPassword    ← Your WiFi password (will show as asterisk)<br />
 
APPNAME=resmedfa            ← Name for your FlashAir card<br />
 
APPMODE=5        ← Important: this must be set to 5<br />
 
APPAUTOTIME=0<br />
 
DNSMODE=1<br />
 
UPLOAD=1<br />
 
NOISE_CANCEL=2<br />
 
LOCK=1<br />
 
WEBDAV=1<br />
 
TIMEZONE=-16<br />
 
</code>
 
 
----
 
----
  

Revision as of 19:47, 13 December 2020

Stub.png


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

As an alternative to using FlashPAP and Java, you can use Macs built-in "rsync" and AppleScript. rsync is a command line tool available on Mac and Linux and is used to backup files and folders. AppleScript is part of macOS and is available on any Mac. macOS also includes Script Editor which can be used to create and edit AppleScript files. Script Editor can be found in the /Applications/Utilities folder in Finder. Copy and paste the script into Script Editor, make the changes necessary for your network, and save it as an application. The script will mount FlashAir, copy the files to your computer where you can then import the data into OSCAR.

The CopyCPAP script requires you to already have a working FlashAir card setup. A sample FlashAir config file has been included as a reference. A detailed discussion can be found in the Software Support forum in the thread Monitoring Data Wirelessly


Code for CopyCPAP script:

(* Updated 11 December 2020 *)
#
#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
# if you have it installed on your desktop you can change it to "/Users/yourusername/Desktop
set oscarLocation to "/Applications"
#
# Do not edit anything below here ############################
#
# Close any running instances of Terminal
quit application "Terminal"
delay 3
#
#Mount the FlashAir card and make sure it shows up in /Volumes
tell application "Finder"
	try
		if not (exists "/Volumes/" & diskName) then 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
end tell
#
#Open Terminal and use rsync to copy FlashAir to your computer or NAS
tell application "Terminal"
	activate
	do script "rsync -avzP /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 2
# Eject FlashAir so we don't accidently change anything on the card
tell application "Finder"
	try
		eject alias diskName
	end try
end tell
delay 1
# Now open OSCAR and quit Terminal
do shell script "open" & " " & oscarLocation & "/OSCAR.app"
quit application "Terminal"

Once you save the the file as an application it can be used like any other app on your Mac. Just double-click it to start it.

Notes

The app needs exclusive use of Terminal. If you have any instances of Terminal running you should quit them before running the app. You can easily check by looking at your Dock, if you see the Terminal icon with a dot under it, then it is already running and should be quit first.

Initially your Mac will likely ask your permission to run the app and allow it access to your files. Once you allow it you should not be asked again, unless you change something in the script.

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 import your data into OSCAR as you normally do.

Sample config file for FlashAir

A sample FlashAir config file:


[WLANSD]

DHCP_Enabled=NO
IP_Address=192.168.1.240        ← Change to the fixed IP you want
Subnet_Mask=255.255.255.0
Default_Gateway=192.168.1.1            ← Change to your router IP
Preferred_DNS_Server=192.168.1.1    ← Change to your router IP

[VENDOR]

VERSION=F15DBW3BW4.00.04
CID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx    ← Unique ID number, don’t change
PRODUCT=FlashAir
APPSSID=MyWiFi            ← Your WiFi name
APPNETWORKKEY=MyPassword    ← Your WiFi password (will show as asterisk)
APPNAME=resmedfa            ← Name for your FlashAir card
APPMODE=5        ← Important: this must be set to 5
APPAUTOTIME=0
DNSMODE=1
UPLOAD=1
NOISE_CANCEL=2
LOCK=1
WEBDAV=1
TIMEZONE=-16

The TIMEZONE is calculated by using your UTC offset * 4. For example if your UTC is -4 then (-4 * 4 = -16)



Links

Using Secure Digital (SD) memory card

Detailed information is in the forum Monitoring Data Wirelessly




Donate to Apnea Board