Hey! I’m new to HASS but I managed to get the MyAir3 system to sing and dance…
I’m using Windows bat files that call curl and netcat (i’m an old bastard) but here are a few:
This one is how I figured out to “Discover” a MyAir3 system on a network the same way the Phone App does, it uses this config.ini file:
DaikinIP
DaikinMAC
Broadcast 192.168.1.255
Then it sends a packet to the broadcast address to port 3000 and listens on 3001. The MyAir3 sends back a packet giving you the IP and MAC address of the unit.
@echo off
for /f "tokens=1,2" %%a in (config.ini) do (
if "%%a"=="Broadcast" set broadcast=%%b
)
for /f "tokens=4 delims= " %%a in ('route print ^| find " 0.0.0.0"') do (
if not %%a==1 if not "%%a"=="Default" set localip=%%a
)
start /MIN "Listening" ncat -luo dump.tmp %localip% 3001
echo|set /p="identify" | ncat -4u -w1 -p 3000 %broadcast% 3000
ping -n 3 localhost > nul
TASKKILL /F /IM ncat.exe > nul
ping -n 1 localhost > nul
for /f "tokens=4,25 delims=</> " %%a in (dump.tmp) do set mac=%%a && set ip=%%b
echo IP address:%ip% Mac address: %mac%
del /Q dump.tmp> nul
set nocopy=pass
for /f "tokens=1,2" %%a in (config.ini) do (
if "%%a"=="DaikinIP" echo DaikinIP %ip%>> config.tmp
if "%%a"=="DaikinIP" if "%ip%"=="" set nocopy=fail
if "%%a"=="DaikinMAC" echo DaikinMAC %mac%>> config.tmp
if "%%a"=="DaikinMAC" if "%mac%"=="" set nocopy=fail
)
echo Broadcast %broadcast%>> config.tmp
if "%nocopy%"=="pass" move /Y config.tmp config.ini> nul
if "%nocopy%"=="fail" del /Q config.tmp> nul
pause
Then you need to “Authenticate” like this:
The password for my system was the default “password” so I hope it’s the same for all of them, I have no idea how or if it can be changed.
@echo off
for /f "tokens=1,2" %%a in (config.ini) do (
if "%%a"=="DaikinIP" set ip=%%b
)
bin\bin\curl -X GET http://%ip%/login?password=password
pause
Then once you’re “Authenticated” you have a time window you can issue requests like these:
GetSystemData
@echo off
for /f "tokens=1,2" %%a in (config.ini) do (
if "%%a"=="DaikinIP" set ip=%%b
)
bin\bin\curl -X GET http://%ip%/getSystemData
pause
GetZoneData (May need to add more to get all your zones):
@echo off
for /f "tokens=1,2" %%a in (config.ini) do (
if "%%a"=="DaikinIP" set ip=%%b
)
bin\bin\curl -X GET http://%ip%/getZoneData?zone=1
echo.
bin\bin\curl -X GET http://%ip%/getZoneData?zone=2
echo.
bin\bin\curl -X GET http://%ip%/getZoneData?zone=3
echo.
bin\bin\curl -X GET http://%ip%/getZoneData?zone=4
echo.
bin\bin\curl -X GET http://%ip%/getZoneData?zone=5
echo.
bin\bin\curl -X GET http://%ip%/getZoneData?zone=6
echo.
bin\bin\curl -X GET http://%ip%/getZoneData?zone=7
pause
Here are a few commands you can use once you’re authenticated (you can put them in bat files like the ones above or run them from curl directly:
Turn the unit on:
curl -X GET http://%ip%/setSystemData?airconOnOff=1
Turn the unit off:
curl -X GET http://%ip%/setSystemData?airconOnOff=0
Set a 1 hour timer:
curl -X GET http://%ip%/setZoneTimer?startTimeHours=0^&startTimeMinutes=0^&endTimeHours=1^&endTimeMinutes=0^&scheduleStatus=2
)
Cancel a timer:
curl -X GET http://%ip%/setZoneTimer?startTimeHours=0^&startTimeMinutes=0^&endTimeHours=0^&endTimeMinutes=0^&scheduleStatus=0
Here’s an example of a bat file that does it all, set’s the zone percentages, fan speed etc…
Change the “Roomname” to the name of your zones.
@echo off
REM FAN (1=Low 2=Med 3=High)
set fan=1
REM MODE (1=Cool 2=Heat 3=FanOnly)
set mode=1
REM TEMP (16.0 to 32.0)
set temp=26.0
REM ZONES
set zones=7
set zone1state=OFF & set zone1prcnt=100 & set zone1name=Roomname1
set zone2state=OFF & set zone2prcnt=100 & set zone2name=Roomname2
set zone3state=OFF & set zone3prcnt=10 & set zone3name=Roomname3
set zone4state=OFF & set zone4prcnt=60 & set zone4name=Roomname4
set zone5state=ON & set zone5prcnt=100 & set zone5name=Roomname5
set zone6state=OFF & set zone6prcnt=100 & set zone6name=Roomname6
set zone7state=OFF & set zone7prcnt=80 & set zone7name=Roomname7
REM TIMER (HOURS/MINUTES)
set Htimer=1
set Mtimer=0
REM STATE (ON/OFF)
set state=ON
set broadcast=192.168.0.255
set password=password
REM ------------------------------------------DO NOT EDIT BELOW THIS LINE (UNLESS NOT 7 ZONES)------------------------------------------
if %fan%==1 set fantxt=LOW
if %fan%==2 set fantxt=MED
if %fan%==3 set fantxt=HIGH
if %mode%==1 set modetxt=COOL
if %mode%==2 set modetxt=HEAT
if %mode%==3 set modetxt=FAN
set zone1prcnt=%zone1prcnt: =%
set zone2prcnt=%zone2prcnt: =%
set zone3prcnt=%zone3prcnt: =%
set zone4prcnt=%zone4prcnt: =%
set zone5prcnt=%zone5prcnt: =%
set zone6prcnt=%zone6prcnt: =%
set zone7prcnt=%zone7prcnt: =%
if "%zone1state%"=="ON " set zone1num=1&set zone1state=ON
if "%zone1state%"=="OFF " set zone1num=0&set zone1state=OFF
if "%zone2state%"=="ON " set zone2num=1&set zone2state=ON
if "%zone2state%"=="OFF " set zone2num=0&set zone2state=OFF
if "%zone3state%"=="ON " set zone3num=1&set zone3state=ON
if "%zone3state%"=="OFF " set zone3num=0&set zone3state=OFF
if "%zone4state%"=="ON " set zone4num=1&set zone4state=ON
if "%zone4state%"=="OFF " set zone4num=0&set zone4state=OFF
if "%zone5state%"=="ON " set zone5num=1&set zone5state=ON
if "%zone5state%"=="OFF " set zone5num=0&set zone5state=OFF
if "%zone6state%"=="ON " set zone6num=1&set zone6state=ON
if "%zone6state%"=="OFF " set zone6num=0&set zone6state=OFF
if "%zone7state%"=="ON " set zone7num=1&set zone7state=ON
if "%zone7state%"=="OFF " set zone7num=0&set zone7state=OFF
if "%state%"=="ON" set statenum=1
if "%state%"=="OFF" set statenum=0
REM ----------------------------------------------------DO NOT EDIT BELOW THIS LINE-----------------------------------------------------
for /f "tokens=4 delims= " %%a in ('route print ^| find " 0.0.0.0"') do (
if not %%a==1 if not "%%a"=="Default" set localip=%%a
)
start /MIN "Listening" ncat -luo dump.tmp %localip% 3001
echo|set /p="identify" | ncat -4u -w1 -p 3000 %broadcast% 3000
ping -n 3 localhost > nul
TASKKILL /F /IM ncat.exe > nul
ping -n 1 localhost > nul
for /f "tokens=4,25 delims=</> " %%a in (dump.tmp) do set mac=%%a && set ip=%%b
del /Q dump.tmp> nul
if "%ip%"=="" echo Connection failed... && goto end
echo Configuring preferences...
REM Authenticate
bin\bin\curl --silent -X GET http://%ip%/login?password=%password% > temp.txt
for /f "tokens=3 delims=-.: " %%i in ('find /C "<authenticated>1</authenticated>" temp.txt') do (
IF %%i==1 (echo Authenticated... & del /Q temp.txt) ELSE (echo Failed to Authenticate... & del /Q temp.txt & goto end)
)
echo.
REM Fan Speed
bin\bin\curl --silent -X GET http://%ip%/setSystemData?fanSpeed=%fan% > temp.txt
for /f "tokens=3 delims=-.: " %%i in ('find /C "<ack>1</ack>" temp.txt') do (
IF %%i==1 (echo Fan Speed: %fantxt% & del /Q temp.txt) ELSE (echo Failed to Set Fan Speed... & del /Q temp.txt & goto end)
)
REM Mode
bin\bin\curl --silent -X GET http://%ip%/setSystemData?mode=%mode% > temp.txt
for /f "tokens=3 delims=-.: " %%i in ('find /C "<ack>1</ack>" temp.txt') do (
IF %%i==1 (echo Mode: %modetxt% & del /Q temp.txt) ELSE (echo Failed to Set Mode... & del /Q temp.txt & goto end)
)
REM Temperature
bin\bin\curl --silent -X GET http://%ip%/setSystemData?centralDesiredTemp=%temp% > temp.txt
for /f "tokens=3 delims=-.: " %%i in ('find /C "<ack>1</ack>" temp.txt') do (
IF %%i==1 (echo Temp: %temp% C & del /Q temp.txt) ELSE (echo Failed to Set Temperature... & del /Q temp.txt & goto end)
)
REM Set Zones
setlocal enableDelayedExpansion
for /L %%i in (1,1,%zones%) do (
if !zone%%inum!==0 (
bin\bin\curl --silent -X GET http://%ip%/setZoneData?zone=%%i^&zoneSetting=!zone%%inum! > temp.txt
for /f "tokens=3 delims=-.: " %%a in ('find /C "<ack>1</ack>" temp.txt') do (
IF %%a==1 (echo Zone:%%i !zone%%iname! !zone%%istate!) ELSE (echo Failed to Set Zone...)
)
)
if !zone%%inum!==1 (
bin\bin\curl --silent -X GET http://%ip%/setZoneData?zone=%%i^&zoneSetting=!zone%%inum!^&userPercentSetting=!zone%%iprcnt! > temp.txt
for /f "tokens=3 delims=-.: " %%a in ('find /C "<ack>1</ack>" temp.txt') do (
IF %%a==1 (echo Zone:%%i !zone%%iname! !zone%%istate! !zone%%iprcnt! Percent Open) ELSE (echo Failed to Set Zone...)
)
)
)
setlocal disableDelayedExpansion
if "%zone1state%"=="OFF" bin\bin\curl --silent -X GET http://%ip%/setZoneData?zone=1^&zoneSetting=%zone1num% > temp.txt
REM TimerOFF then TimerON
set /a "timesum=%Htimer%+Mtimer"
if %timesum% GTR 0 (
REM ----Stop any running timers----
bin\bin\curl --silent -X GET http://%ip%/setZoneTimer?startTimeHours=0^&startTimeMinutes=0^&endTimeHours=0^&endTimeMinutes=0^&scheduleStatus=0 > temp.txt
for /f "tokens=3 delims=-.: " %%i in ('find /C "<ack>1</ack>" temp.txt') do (
IF %%i==1 (echo Timer: Reset & del /Q temp.txt) ELSE (echo Failed to Clear Timer... & del /Q temp.txt & goto end)
)
REM ----Add time to current time----
for /f "tokens=1,2 delims=:" %%a in ('powershell "(get-date %time%).AddHours(%Htimer%).AddMinutes(%Mtimer%).ToString('HH:mm')"') do (
REM ----Start timer with new time----
bin\bin\curl --silent -X GET http://%ip%/setZoneTimer?startTimeHours=0^&startTimeMinutes=0^&endTimeHours=%%a^&endTimeMinutes=%%b^&scheduleStatus=2 > temp.txt
for /f "tokens=3 delims=-.: " %%i in ('find /C "<ack>1</ack>" temp.txt') do (
IF %%i==1 (
IF %Htimer%==1 echo Timer: Set to %Htimer% Hour and %Mtimer% Minutes & del /Q temp.txt
IF NOT %Htimer%==1 echo Timer: Set to %Htimer% Hours and %Mtimer% Minutes & del /Q temp.txt
) ELSE (
echo Failed to Set Temperature... & del /Q temp.txt & goto end
)
)
)
)
REM ON/OFF (0=OFF 1=ON)
bin\bin\curl --silent -X GET http://%ip%/setSystemData?airconOnOff=%statenum% > temp.txt
for /f "tokens=3 delims=-.: " %%i in ('find /C "<ack>1</ack>" temp.txt') do (
IF %%i==1 (echo UNIT: %state% & del /Q temp.txt) ELSE (echo Failed to Set State... & del /Q temp.txt & goto end)
)
echo.
echo Settings Completed.
:end
pause
If anyone ever get’s it to work in HASS I would really appreciate it!