{"id":15003005,"url":"https://github.com/martinvichnal/smart-home","last_synced_at":"2026-03-15T02:46:15.899Z","repository":{"id":207958104,"uuid":"720200319","full_name":"martinvichnal/smart-home","owner":"martinvichnal","description":"A smart home system where you can make any IoT smart device with the help of an ESP32, NextJS, Docker, Kubernetes and MSSQL","archived":false,"fork":false,"pushed_at":"2025-01-05T17:11:08.000Z","size":8979,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T13:56:50.203Z","etag":null,"topics":["esp32","firebase-auth","iot","kubernetes","mssql","mssql-database","nextjs","nextjs13","nginx","react","smart-home","tailwindcss","ws"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinvichnal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-17T20:00:13.000Z","updated_at":"2025-01-05T17:11:11.000Z","dependencies_parsed_at":"2023-12-28T01:00:58.301Z","dependency_job_id":"d129223f-0161-4bd3-9b26-9e9ed4538a9e","html_url":"https://github.com/martinvichnal/smart-home","commit_stats":null,"previous_names":["martinvichnal/smart-home"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinvichnal%2Fsmart-home","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinvichnal%2Fsmart-home/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinvichnal%2Fsmart-home/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinvichnal%2Fsmart-home/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinvichnal","download_url":"https://codeload.github.com/martinvichnal/smart-home/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243153786,"owners_count":20244817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp32","firebase-auth","iot","kubernetes","mssql","mssql-database","nextjs","nextjs13","nginx","react","smart-home","tailwindcss","ws"],"created_at":"2024-09-24T18:54:54.827Z","updated_at":"2025-12-25T02:45:50.782Z","avatar_url":"https://github.com/martinvichnal.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart home system\n\n![](https://img.shields.io/github/v/release/martinvichnal/smart-home)\n![](https://img.shields.io/github/last-commit/martinvichnal/smart-home)\n![](https://img.shields.io/github/issues/martinvichnal/smart-home)\n\n---\n# Introduction\nNOTE: There are major bugs, inefficiency and security issues. This is not at all the best implementation of the system. I just flew too close to the sun and wanted to see what I am capable of.\n\n\nThis is the repository of my custom built smart home system.\nThis system is a dynamically changeable smart home system built with React TypeScript, firabase and ESP32 devices.\n\n-   _Feel free to **improve, use or fork** this repository in your own projects :)_\n-   _For any bugs or improvements feel free to make an [issue](https://github.com/martinvichnal/smart-home/issues) or make a [pull request](https://github.com/martinvichnal/smart-home/pulls)_\n\n---\n# Table of Contents\n\n- [Smart home system](#smart-home-system)\n- [Introduction](#introduction)\n- [Table of Contents](#table-of-contents)\n- [Fundamental Operation](#fundamental-operation)\n- [Features](#features)\n- [Hardware Requirements](#hardware-requirements)\n- [Software Dependencies](#software-dependencies)\n- [Diagrams ](#diagrams)\n   * [Diagram color code](#diagram-color-code)\n   * [System diagram](#system-diagram)\n   * [IoT device diagram](#iot-device-diagram)\n   * [Webapp diagram](#webapp-diagram)\n- [Installation](#installation)\n   * [Create an IoT device](#create-an-iot-device)\n   * [WebApp](#webapp)\n   * [Servers](#servers)\n      + [WebSocket](#websocket)\n      + [API](#api)\n      + [MSSQL](#mssql)\n- [Configuration](#configuration)\n      + [Kubernetes and docker](#kubernetes-and-docker)\n         - [How to create:](#how-to-create)\n         - [Docker](#docker)\n         - [Good to know docker parancsok](#good-to-know-docker-parancsok)\n         - [Kubernetes](#kubernetes)\n         - [Kubernetes Dashboard](#kubernetes-dashboard)\n         - [Update Server from git](#update-server-from-git)\n- [How it works ?](#how-it-works-)\n   * [System](#system)\n   * [User Interface - Webapp](#user-interface---webapp)\n      + [Hooks](#hooks)\n         - [useAddData](#useadddata)\n         - [useDeleteData](#usedeletedata)\n         - [useGetData](#usegetdata)\n         - [useGetUserInfo](#usegetuserinfo)\n   * [IoT Device](#iot-device)\n   * [Servers](#servers-1)\n      + [Websocket](#websocket-1)\n      + [WebSocket API Documentation](#websocket-api-documentation)\n         - [Connection](#connection)\n         - [Joining](#joining)\n         - [Sending Messages](#sending-messages)\n         - [Receiving Messages](#receiving-messages)\n         - [Connection Status](#connection-status)\n         - [Disconnecting](#disconnecting)\n      + [REST API](#rest-api)\n         - [Database](#database)\n- [Acknowledgements / Source](#acknowledgements--source)\n\n---\n# Fundamental Operation\nThis is the section for the basics of how it works and explaining through diagrams\n\n---\n# Features\n- Dynamically add custom variables to the system\n- Fast and reliable communication\n- Many virtual homes within one ESP\n- Easy implementation\n\n---\n# Hardware Requirements\n- Some computer to run the docker containers (preferably raspberry pi or host it on your preferable server hoster)\n- Any ESP32\n- Sensors or devices of your choise\n\n---\n# Software Dependencies\n- Docker (running the webapp and the servers)\n- [SmartHome library](https://github.com/martinvichnal/smart-home/tree/main/smart-home-firmware/lib/SmartHome) (or the following librarys if you don't want to use the dedicated library)\n  - [arduinoWebSockets](https://github.com/Links2004/arduinoWebSockets)\n  - [ArduinoJson](https://github.com/bblanchon/ArduinoJson)\n- On the Webapp side you can find the dependencies in the package.json file\n\n---\n# Diagrams \n\n## Diagram color code\nAll the diagrams that are shown below are color coded with the following code rule:\n\n[\u003cimg src=\"https://github.com/martinvichnal/smart-home/blob/main/doc/Color-codes.png\"/\u003e](https://github.com/martinvichnal/smart-home/blob/main/doc/Color-codes.png)\n\n\n## System diagram\nThis is the basic system connection diagram.\n\n[\u003cimg src=\"https://github.com/martinvichnal/smart-home/blob/main/doc/System-Diagram.png\"/\u003e](https://github.com/martinvichnal/smart-home/blob/main/doc/System-Diagram.png)\n\n\n## IoT device diagram\nThis is the basic IoT devices diagram.\n\n[\u003cimg src=\"https://github.com/martinvichnal/smart-home/blob/main/doc/IoT-Devices-Diagram.png\"/\u003e](https://github.com/martinvichnal/smart-home/blob/main/doc/IoT-Devices-Diagram.png)\n\n\n## Webapp diagram\n\n[\u003cimg src=\"https://github.com/martinvichnal/smart-home/blob/main/doc/Webapp-Diagram.png\"/\u003e](https://github.com/martinvichnal/smart-home/blob/main/doc/Webapp-Diagram.png)\n\n\n---\n# Installation\n1. Clone the repository\n2. Configure and install the components\n## Create an IoT device\n- Create a virtual smart home with the SmartHome class with your server urls and device properties:\n```cpp\nSmartHome desk(\"Desk\", \"1\", \"1\", \"http://0.0.0.0:0000\");\n```\n- Add custom bool or int to your SmartHome:\n```cpp\ndesk.addVariableBool(13, \"deskLamp\", deskLamp);\n```\n- Validate the home:\n  - Note: before validation the ESP32 needs to connect to your local network\n```cpp\ndesk.validateHome();\n```\n- Initialize the WebSocket connection:\n```cpp\nws.begin(webSocketServerAddress, webSocketServerPort, \"/socket.io/?EIO=4\");\nws.onEvent(webSocketEvents);\n```\n- Call the WebSocket loop in the loop section:\n```cpp\nws.loop();\n```\n- Stringify the home then send it at your neede\n```cpp\nString dataDesk = desk.prepareWebSocketData();\nws.sendEVENT(dataDesk);\n```\n\n## WebApp\n```\nnpm run dev\n```\n## Servers\nFor running the servers you need to build then execute it on the docker app\n### WebSocket\n```\ndocker build . -t smart-home-websocket\ndocker run -p 5000:5000 smart-home-websocket\n```\n### API\n```\ndocker build . -t smart-home-api\ndocker run -p 8080:8080 smart-home-api\n```\n### MSSQL\nPulling the Microsoft SQL database docker images from Microsoft\n```\ndocker pull mcr.microsoft.com/mssql/server:2022-latest\n```\nCreating docker container from the image with cusomt name `--name iot-database` and password `\"MSSQL_SA_PASSWORD=ThisIsThePassword!24\"` (A strong system administrator (SA) password: At least 8 characters including uppercase, lowercase letters, base-10 digits and/or non-alphanumeric symbols.)\n```\ndocker run -e \"ACCEPT_EULA=Y\" -e \"MSSQL_SA_PASSWORD=ThisIsThePassword!24\" -p 1433:1433 -d --name iot-database mcr.microsoft.com/mssql/server:2022-latest\n```\nDemo data injection\n```sql\n-- Create the devices table\nCREATE TABLE devices (\n    did VARCHAR(255),\n    dn VARCHAR(255),\n    dd VARCHAR(MAX),\n    uid VARCHAR(255)\n);\n\n-- Insert data into the devices table\nINSERT INTO devices (did, dn, dd, uid)\nVALUES \n    ('1001', 'Device1', 'property1-n-0-100-50--property2-b-0-1-0--', '1124'),\n    ('1002', 'Device2', 'setting1-b-0-1-1--setting2-n-0-10-5--', '1124'),\n    ('1003', 'Device3', 'temperature-n-0-50-25--humidity-n-0-100-75--', '1124'),\n    ('1004', 'Device4', 'state-b-0-1-1--brightness-n-0-255-128--', '1124');\n```\n\n---\n# Configuration\nIn order to use the system you have to configure the webapp and the ESP32 to connect to the servers via IP and their port and also you have to set your wifi `ssid` and `password` credentials in your ESP32 project\n\n---\n### Kubernetes and docker\n#### How to create:\n\n#### Docker\n\n- Pull registry\n\n```\ndocker pull registry\nUsing default tag: latest\nlatest: Pulling from library/registry\nDigest: sha256:543dade69668e02e5768d7ea2b0aa4fae6aa7384c9a5a8dbecc2be5136079ddb\nStatus: Image is up to date for registry:latest\ndocker.io/library/registry:latest\n```\n\n- Run the registry:\n\n```\ndocker run -d -p 5000:5000 --restart=always --name registry registry\n```\n\n- Tag the desired image\n\n```\ndocker tag websocket-server:latest localhost:5000/websocket-server:latest\n```\n\n- Push the desired image to registry\n\n```\ndocker push localhost:5000/websocket-server:latest\n```\n\n- Checking if the image is pushed:\n\n```\ncurl http://localhost:5000/v2/_catalog\n```\n\n#### Good to know docker parancsok\n\n```\ndocker images\ndocker images -a\ndocker ps\ndocker rm …\ndocker rmi -f 7b44d932df87\n```\n\n#### Kubernetes\n\n- Set the [localhost](http://localhost) registry\n\n```\nsudo nano /etc/rancher/k3s/registries.yaml\n```\n\n```\nmirrors:\n  \"localhost:5000\":\n    endpoint:\n      - \"http://localhost:5000\"\n```\n\n- Restart\n\n```\n sudo systemctl restart k3s\n```\n\n- Delete pod\n\n```\nsudo kubectl delete pod -l app=websocket-server\n```\n\n- Make the deployment file\n\n```\nnano websocket-deployment.yaml \n```\n\nyaml:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: websocket-server\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: websocket-server\n  template:\n    metadata:\n      labels:\n        app: websocket-server\n    spec:\n      containers:\n      - name: websocket-server\n        image: localhost:5000/websocket-server:latest\n        imagePullPolicy: Always\n        ports:\n        - containerPort: 8080\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: websocket-service\nspec:\n  selector:\n    app: websocket-server\n  ports:\n  - protocol: TCP\n    port: 8080\n    targetPort: 8080\n  type: NodePort\n```\n\n- Run the deployment file\n\n```\nsudo kubectl apply -f websocket-deployment.yaml\n```\n\n- Checking the pods and services\n\n```\nsudo kubectl get pods\nsudo kubectl get services\n```\n\n- Reset kubernetes:\n\n```\n/usr/local/bin/k3s-killall.sh\nsudo systemctl stop k3s\nsudo systemctl start k3s\nsudo systemctl status k3s\n```\n\n#### Kubernetes Dashboard\n\n- Apply dashboard\n```\nkubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml\n```\n\n- Get dashboard pods\n```\nkubectl get pods -n kubernetes-dashboard\n```\n\n- Edit dashboard service\n```\nkubectl -n kubernetes-dashboard edit service kubernetes-dashboard\n```\n\n- Change the type to NodePort:\n```\nspec:\n  type: NodePort\n```\n\n- Get port\n```\nkubectl -n kubernetes-dashboard get service kubernetes-dashboard\n```\n\n- Acces the dashboard\n```\nhttps://192.168.1.133:NodePort\n```\n\n- Create the token\ndashboard-admin.yaml\n```yaml\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: admin-user\n  namespace: kubernetes-dashboard\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n  name: admin-user\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n  name: admin-user\n  namespace: kubernetes-dashboard\n```\n\n- Apply token\n```\nkubectl apply -f dashboard-admin.yaml\n```\n\n- Get token\n```\nkubectl -n kubernetes-dashboard create token admin-user\n```\n#### Update Server from git\n\n- Pull from GitHub\n```\ngit pull origin main\n```\n- Build image\n```\nsudo docker build -t localhost:5000/ws-server:latest .\n```\n- Push to local storage\n```\ndocker push localhost:5000/ws-server:latest\n```\n- Restart deployment\n```\nsudo kubectl rollout restart deployment ws-server\n```\n- Apply deployment\n```\nsudo kubectl apply -f kub-deployment.yaml\n```\n- Get token\n```\nkubectl -n kubernetes-dashboard create token admin-user\n```\n\n\n---\n# How it works ?\n\n---\n## System\n\n\n\n---\n## User Interface - Webapp\n\n### Hooks\nI created some custom hooks to make the overall code easily readable and accessable. These hooks can be seen below:\n\n---\n\n#### useAddData\nThis hook is just containing a simple function\n```tsx\nconst addData = async ({ uid, uName, uIsAuth }: userInfoType) =\u003e {}\n```\nthat adds values to the database whith the following parameters:\n```tsx\nexport type userInfoType = {\n    id?: string // id: id from Firebase database\n    uid?: string // uid: uid from Firebase authentication\n    uName?: string // uName: name from Firebase authentication\n    uIsAuth?: boolean // uIsAuth: isAuth from Firebase authentication\n}\n```\n\n---\n\n#### useDeleteData\n\n---\n\n#### useGetData\nThis is the main hook for fetching the data from the database. This diagram below shows how the hook should be used:\n\n[\u003cimg src=\"https://github.com/martinvichnal/smart-home/blob/main/doc/useGetData.png\" width=500/\u003e](https://github.com/martinvichnal/smart-home/blob/main/doc/useGetData.png.png)\n\nThis hook contains the following variables and fucntions:\nVariables\n```tsx\nconst [devices, setDevices] = useState\u003cdeviceInfoType[]\u003e([])\nconst [users, setUsers] = useState\u003cuserInfoType[]\u003e([])\nconst [data, setData] = useState\u003cuserInfoType[]\u003e([])\n```\nAnd fucntios\n```tsx\nconst getUserData = async () =\u003e {}\nconst getDeviceData = async () =\u003e {}\n```\nAll the fucntions and main variables are available with this hook.\n\nThis hook has also 3 useEffect react hooks in order to fix sync issues with React structure.\n\nThe getUserData is the first thing this hook is calling. It gets user data from database with the given dataQuery `(Where the uid is equal to the current user's uid)` and sets the user state to the fetched data. This function Is called only on mount or when getUserData is called. With the help of a useEffect we wait for the user state to set its value then calling the getDeviceData. This fucntion gets data from the database when the database data has changed and sets the device state to the fetched data. This getDoc uses a sub collection reference. This fucntion also subscribing on the database change so we dont need to call it again.\n\n---\n\n#### useGetUserInfo\nThis is a simple custom hook that gets user information from the local web storage. The data is added every time the user is in the authentication page.\n\nExample:\n```tsx\nconst { uid, uIsAuth } = useGetUserInfo()\n```\n\nThe user info from the local storage looks like this:\n```JSON\n{\n    \"uid\": \"jfE3189r5Gsjac8763VsahEfgj\",\n    \"uName\": \"John Doe\",\n    \"uPhoto\": \"*url from google*\",\n    \"uIsAuth\": false\n    \"id\": \"Yq4Qt1S1muRZuBzEuYhL\"\n}\n```\n\n\n\n---\n## IoT Device\n\n\n\n---\n## Servers\n\n### Websocket\nAt the top, the necessary modules are imported. Express is a web application framework for Node.js, designed for building web applications and APIs. Socket.IO is a JavaScript library for real-time web applications. It enables real-time, bidirectional, and event-based communication between the browser and the server.\n\nThe `connectedClients` Map is used to keep track of all connected clients. Each client is identified by a unique `clientId` which is a combination of the user's `userId`, `deviceId`, `clientType`, and the socket's `id`.\n\nThe `sendConnectionStatusEvent` function is used to send a `connectionStatus` event to a specific socket. It sends an object containing an array of `connectedDevices` for a specific `userId`.\n\nThe `io.on(\"connection\", (socket) =\u003e {...})` block is where the server handles a new client connection. Inside this block, several event listeners are set up on the `socket` object to handle different types of events.\n\nThe `join` event is used when a client wants to join the server. The client sends its `userId`, `deviceId`, and `clientType` to the server. The server then stores this information in the `socket` object and the `connectedClients` Map.\n\nIf the `clientType` is `webapp`, the server sets up a `webMessage` event listener on the `socket`. When a `webMessage` event is received, the server tries to find the target device's socket and sends a `message` event to it.\n\nIf the `clientType` is `device`, the server sets up a `deviceMessage` event listener on the `socket`. When a `deviceMessage` event is received, the server sends a message event to all webapp `sockets` associated with the `userId`.\n\nThe `disconnect` event is used when a client disconnects from the server. The server removes the client's information from the `connectedClients` Map.\n\nFinally, the server starts listening on a specific port for incoming connections.\n\n### WebSocket API Documentation\n\n#### Connection\n\nTo connect to the WebSocket server, create a new WebSocket instance in your client-side JavaScript:\n\n```jsx\nconst socket = io('\u003chttp://localhost:5000\u003e');\n```\n\nReplace `'\u003chttp://localhost:5000\u003e'` with the URL of your WebSocket server.\n\n#### Joining\n\nAfter connecting, you should emit a \"join\" event to the server. This event should include your user ID, device ID, and client type:\n\n```jsx\nsocket.emit('join', userId, deviceId, clientType);\n```\n\n- `userId` (string): The ID of the user.\n- `deviceId` (string): The ID of the device. This is not required for webapp clients.\n- `clientType` (string): The type of the client. This should be either \"webapp\" or \"device\".\n\n#### Sending Messages\n\nTo send a message, emit a `${clientType}Message` event to the server. This event should include the target device ID and the message:\n\n```jsx\nsocket.emit(`${clientType}Message`, targetDeviceId, message);\n```\n\n- `targetDeviceId` (string): The ID of the target device. This is required for webapp clients.\n- `message` (string): The message to send.\n\n#### Receiving Messages\n\nTo receive messages, listen for the \"message\" event:\n\n```jsx\nsocket.on('message', (message) =\u003e {\n  console.log('Received message:', message);\n});\n```\n\n#### Connection Status\n\nTo receive updates about the connection status, listen for the \"connectionStatus\" event:\n\n```jsx\nsocket.on('connectionStatus', (data) =\u003e {\n  console.log('Connected devices:', data.connectedDevices);\n});\n\n```\n\n#### Disconnecting\n\nTo disconnect from the server, use the `disconnect` method:\n\n```jsx\nsocket.disconnect();\n```\n\nPlease note that this is a basic API documentation. Depending on your application's requirements, you might need to add more events or data fields.\n\n### REST API\n\n#### Database\n\n\n```JavaScript\n/**\n * @description Get a device from the database by ID or by user ID\n * @method GET\n * @API /api/devices\n * @API /api/devices/device?did={did}\n * @API /api/device/device?uid={uid}\n * @body -\n * @returns {JSON} result\n */\nexport async function GET(request)\n\n/**\n * @description Update device data in the database by ID\n * @method PUT\n * @API /api/devices/device\n * @body {JSON} {did, dd}\n * @returns {JSON} result\n */\nexport async function PUT(request)\n\n/**\n * @description Add (insert) a device to the database\n * @method POST\n * @API /api/devices\n * @body {JSON} {did, dn, dd, uid}\n * @returns {JSON} result\n */\nexport async function POST(request)\n\n/**\n * @description Delete a device from the database by ID\n * @method DELETE\n * @API /api/devices/device\n * @body {JSON} {did}\n * @returns {JSON} result\n */\nexport async function DELETE(request)\n```\n\nUSERS:\n\n```JavaScript\n/**\n * @description Get all user from the database or by ID\n * @method GET\n * @API /api/users\n * @API /api/users/user?uid={uid}\n * @body -\n * @returns {JSON} result\n */\nexport async function GET(request)\n\n/**\n * @description Update user data in the database by ID\n * @method PUT\n * @API /api/users/user\n * @body {JSON} {uid}\n * @returns {JSON} result\n */\nexport async function PUT(request)\n\n/**\n * @description Add (insert) a user to the database\n * @method POST\n * @API /api/users\n * @body {JSON} {uid}\n * @returns {JSON} result\n */\nexport async function POST(request)\n\n/**\n * @description Delete a user from the database by ID\n * @method DELETE\n * @API /api/users/user\n * @body {JSON} {uid}\n * @returns {JSON} result\n */\nexport async function DELETE(request)\n```\n\n\nExample:\n\n```JavaScript\nhttps://myserver.com/api/devices/device?did=05b31779-14ee-4233-8c9a-2749e81d3ccb -\u003e GET request\n-\u003e response:\n        {\n            \"DID\": \"05b31779-14ee-4233-8c9a-2749e81d3ccb\",\n            \"DN\": \"Thermostat\",\n            \"DD\": \"temperature-n-0-100-34--humidity-n-0-100-61--state-b-0-0-0--\",\n            \"UID\": \"80ff2b60-bf4b-42fe-8de4-d21734a393c8\"\n        },\n\nhttps://myserver.com/api/devices/device -\u003e PUT request\n-\u003e request body:\n        {\n            \"DID\": \"05b31779-14ee-4233-8c9a-2749e81d3ccb\",\n            \"DN\": \"Thermostat\",\n            \"DD\": \"temperature-n-0-100-34--humidity-n-0-100-61--state-b-0-0-0--\",\n            \"UID\": \"80ff2b60-bf4b-42fe-8de4-d21734a393c8\"\n        },\n-\u003e response: \"Device updated successfully\"\n```\n\n```JSON\n[\n  {\n    \"did\": \"1111\",\n    \"dn\": \"Led\",\n    \"dd\": \"ledVariable-b-0-0-true--\",\n    \"uid\": \"1124\"\n  },\n  {\n    \"did\": \"123\",\n    \"dn\": \"Desk\",\n    \"dd\": \"deskLamp-b-0-0-true--deskLampBrightness-n-0-255-20--deskMonitor-b-0-0-true--\",\n    \"uid\": \"1124\"\n  },\n  {\n    \"did\": \"456\",\n    \"dn\": \"Thermostat\",\n    \"dd\": \"thermostatTemperature-n-0-100-13--thermostatHumidity-n-0-100-31--thermostatPower-b-0-0-true--\",\n    \"uid\": \"1124\"\n  },\n  {\n    \"did\": \"789\",\n    \"dn\": \"Bed\",\n    \"dd\": \"bedLamp-b-0-0-false--bedLampBrightness-n-0-255-225--\",\n    \"uid\": \"1124\"\n  }\n]\n```\n```JSON\n[\n  {\n    \"UID\": \"09c007bd-526b-4d8e-a9b9-96daff857759\"\n  },\n  {\n    \"UID\": \"d480b324-d6bd-4e05-820f-c807a7a5ed7e\"\n  }\n]\n```\n\n```JavaScript\nexport const user = {\n    uid: \"1124\",\n    uName: \"Vichnál Martin\",\n    uPhoto: \"https://lh3.googleusercontent.com/a/ACg8ocI5cTr4KR7TWUMmnwHdRFaBpEZw6QRUiwtVixPCTQVmuow=s96-c\",\n    uIsAuth: true,\n}\n```\n---\n# Acknowledgements / Source\n\n-   [React](https://react.dev/learn)\n-   [NextJS](https://nextjs.org/)\n-   [Microsoft Azure](https://azure.microsoft.com/en-us/)\n-   [NextJS Docker Example](https://github.com/vercel/next.js/tree/canary/examples/with-docker-multi-env)\n-   [MsSQL example](https://github.com/hohoaisan/simple-dockerized-nextjs-mssql)\n-   [API Guidelines](https://github.com/microsoft/api-guidelines)\n-   [PlatformIO](https://platformio.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinvichnal%2Fsmart-home","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinvichnal%2Fsmart-home","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinvichnal%2Fsmart-home/lists"}