---
# System prepended metadata

title: Freeheat

---

# Freeheat

LINKS:

- Gateway User Linking definition on notion [LINK](https://www.notion.so/freeheat/Gateway-User-Linking-2a93976cc9594015b92f7d4011fb1f72)
- Application repository [LINK](https://gitlab.com/freeheat/gw/pv/gateway-user-linking)

## Credentials

**hub and fleet credentials:**

username: `freeheat-fleet`
password: ``*nP#qQGr56hL5hZ@``

**freeheat credentials**:

username: `sergio.marin@pantacor.com`
password: `qkt3unx!yhk4DFA8dvp`

**freeheat api credentials**:

Client ID: `fe1qlyxbliuyIBVHZOu8FkDO46MfypZOIKlkGbRc`
Client secret: `2aO5R3V3SpWoV2C1mHKZAgFWtBXvAcqBsQuqnfMq7Hsv2QahofV8dZdgMmBmQe4XRGI0t5eFxHqFp1IrR7dYqdHKW1VVz58LFvpiAirPH3HILQWFOC4LCN5jsSqGPEDK`

## Gateway User Linking  APP

The User Linking application is a go application built using container-ci for arm32v5, arm32v7 and arm64.

Gitlab CI builds the container of the application, but it doesn't push to the source device on hub yet. The source device for this package is [THIS](https://pvr.pantahub.com/freeheat-fleet/gateway_user_linking_latest).

This device is going to be merge with the gateway_base_latest to the fleet channel [gateway_latest](https://fleet.pantacor.com/channels/65563f18b2f0c50c7dc069c2) and push to all devices in that channel.

The application start at `0.0.0.0:5000` (this port can be change later) and it will remember previous device selection. If the user is not login will trigger an user/pass login with freeheat credentials.

The application save:

- user data in `/pantavisor/device-meta.freeheat/user`
- auth data in `/pantavisor/device-meta.freeheat/token`
- user device selection data in `/pantavisor/device-meta.freeheat/selected_devices`

All the data is storage as json

User content example:

```json
{
  "id": "c5c1ea0e-b5b1-4e4f-8031-7d39924292e5",
  "organization_id": "1009bb71-7f7d-4a33-8ff2-2d84c911e52b",
  "external_user_id": "",
  "role": "admin",
  "email": "sergio.marin@pantacor.com",
  "first_name": "Sergio",
  "last_name": "Marin",
  "is_onboarded": false
}

```

Selected devices content example:
```json
[
  {
    "id": "5fc13699-553c-42e6-bd35-b9038f26e183",
    "device_model": {
      "manufacturer": "Nibe",
      "model": "S-Series",
      "device_type": {
        "short_name": "hp_atw",
        "long_name": "Heat Pump (Air-to-Water)"
      }
    }
  }
]
```

Token content example:
```json
{
  "access_token": "FQeHpcRhU2O42VlfQaEQ2G2rqKChx8",
  "expires_in": 3600,
  "token_type": "Bearer",
  "scope": "read write",
  "refresh_token": "8gdHM5uFTXCOBsgf55yM5QznBMQXtj"
}
```

**Application features:**

- Session Cookie managment 
- Login
- Save user data in device-meta
- Save token data in device-meta
- Show user pumps, user can select the pumps to be used by the gateway
- Save user selection on device-meta














###### Things we needed:

- Configurate the pantavisor package in order to adjust memory and storage usage. **700MB**
- Push containers to source devices for thingsboard-gateway and gateway-user-link (NOTE 3)
- Container/App for gateway user linking (onboarding). (NOTE 1)
- Container/App for device discovery. (NOTE 1)

###### NOTES:

1. Maybe those application should be the same container?
3. Container CI has push to hub already i think