This is a simple .NET MVC project which allows you to connect to and fetch data from the Daikin API.
If you're new to dotnet you can use this tutorial to learn the basics.
- Git installed on your machine (or knowledge of how to download files from git)
- dotnet sdk -
built on 9.0.102 - Visual Studio Code (or an alternative IDE)
- Ability to do basic Terminal/Command Line navigation
- Pull this repository (
git clone https://github.com/thebillington/DaikinConnectDotnet/) - Open the repository in Visual Studio Code and run it
- Head to the ngrok website and register for a free account
- Follow the instructions and install
ngrokfor your system - Register for a static domain
- Take the domain name (e.g.
super-grit-lightning.ngrok-free.app) and set it as theRedirectUriinappsettings.json
- Head to the Daikin API and register for an account
- Once registered, click your email in the top right and click
My Apps - Click
New App - Choose a good app name (I named mine
daikin-connect) and set the redirect URI to the one you got fromngrok(e.g.super-grit-lightning.ngrok-free.app) - Once created, grab your
client_idand add it asDaikinClientIDinappsettings.json - Grab your
client_secretand add it as an environment variable (e.g. in~/.zshenvor~/.bash_profileon your local machine, or in theProperties/launchSettings.jsonfile (just don't commit it!)) (note; if you don't get your secret before closing the window, you may need to delete and recreate your app)
Once you have setup ngrok on your machine and setup the client ID, secret and redirect URI you can run the app.
To run the app successfully, you need to do 2 things:
- Run the app locally using via your IDE of choice (or using command line
dotnet run) - Create a tunnel via
ngrokfrom your local machine to theRedirectURIyou setup
This is because the Daikin API will not allow you to set localhost as the redirect URI after successfully authenticating a user via SSO.
- Open a new Terminal and navigate to the directory where your code is (e.g.
cd ~/Downloads/DaikinConnectDotnet) - Run the code via your IDE or using
dotnet run - Go to your browser and navigate to
localhost:3000
If you can see the running app, you should be good to go!
Now that the app is running, the last step is to create a tunnel from ngrok (publicly accessible) to your local instance (port 3000).
ngrok http --url=super-grit-lightning.ngrok-free.app 3000