# viny182/kfloorp architecture

> Architecture diagram of the GitHub repository viny182/kfloorp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/viny182/kfloorp
- Repository: https://github.com/viny182/kfloorp

## Overview

KFloorP is a browser-based Home Assistant floorplan dashboard for older Kindle and tablet browsers. The user opens a hosted page; configured entity positions and floorplan images define the display, while the JavaScript fetches Home Assistant state and renders interactive device controls. The product also provides a second-floor view and a dedicated switch listing. The excerpts show API access and entity rendering, but not the HTML script wiring or full page implementation, so those relationships are not asserted.

Main entry points: [`js/main.js`](https://github.com/viny182/kfloorp/blob/main/js/main.js) (Dashboard runtime), [`index.html`](https://github.com/viny182/kfloorp/blob/main/index.html) (First-floor view)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Dashboard configuration"]
  node_setup["Device and API settings<br/>[setup.js]"]
end

subgraph group_floorplan["Floorplan views"]
  node_first_floor["First-floor view<br/>[index.html]"]
  node_second_floor["Second-floor view<br/>[2ndfloor.html]"]
  node_floorplan_images["Floorplan images"]
  node_dashboard_runtime["Dashboard runtime<br/>[main.js]"]
end

subgraph group_features["Device features"]
  node_switches_page["Switch listing page<br/>[switches.html]"]
  node_switch_listing["Switch listing<br/>[main.js]"]
  node_entity_display["Entity state display<br/>[main.js]"]
  node_switch_controls["Switch controls<br/>[main.js]"]
  node_binary_sensors["Door and window sensors<br/>[main.js]"]
  node_sensors["Sensor readings<br/>[main.js]"]
  node_media_player["Media player controls<br/>[main.js]"]
  node_weather["Weather display<br/>[main.js]"]
end

node_user(("Dashboard user"))
node_home_assistant{{"Home Assistant API"}}

node_user -->|"opens dashboard"| node_first_floor
node_dashboard_runtime -->|"fetches state"| node_home_assistant
node_dashboard_runtime -->|"sends service call"| node_home_assistant
node_dashboard_runtime -->|"renders entities"| node_entity_display
node_dashboard_runtime -->|"renders controls"| node_switch_controls
node_dashboard_runtime -->|"renders states"| node_binary_sensors
node_dashboard_runtime -->|"renders readings"| node_sensors
node_dashboard_runtime -->|"renders controls"| node_media_player
node_dashboard_runtime -->|"renders weather"| node_weather
node_switch_listing -->|"fetches switches"| node_home_assistant

click node_setup "https://github.com/viny182/kfloorp/blob/main/js/setup.js"
click node_first_floor "https://github.com/viny182/kfloorp/blob/main/index.html"
click node_second_floor "https://github.com/viny182/kfloorp/blob/main/2ndfloor.html"
click node_floorplan_images "https://github.com/viny182/kfloorp/tree/main/images"
click node_dashboard_runtime "https://github.com/viny182/kfloorp/blob/main/js/main.js"
click node_switches_page "https://github.com/viny182/kfloorp/blob/main/switches.html"
click node_switch_listing "https://github.com/viny182/kfloorp/blob/main/js/main.js"
click node_entity_display "https://github.com/viny182/kfloorp/blob/main/js/main.js"
click node_switch_controls "https://github.com/viny182/kfloorp/blob/main/js/main.js"
click node_binary_sensors "https://github.com/viny182/kfloorp/blob/main/js/main.js"
click node_sensors "https://github.com/viny182/kfloorp/blob/main/js/main.js"
click node_media_player "https://github.com/viny182/kfloorp/blob/main/js/main.js"
click node_weather "https://github.com/viny182/kfloorp/blob/main/js/main.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_setup,node_user toneBlue
class node_first_floor,node_second_floor,node_floorplan_images,node_dashboard_runtime toneAmber
class node_switches_page,node_switch_listing,node_entity_display,node_switch_controls,node_binary_sensors,node_sensors,node_media_player,node_weather,node_home_assistant toneMint
```

## Components

### Dashboard configuration

- [Device and API settings](https://github.com/viny182/kfloorp/blob/main/js/setup.js): `js/setup.js`

### Floorplan views

- [First-floor view](https://github.com/viny182/kfloorp/blob/main/index.html): `index.html`
- [Second-floor view](https://github.com/viny182/kfloorp/blob/main/2ndfloor.html): `2ndfloor.html`
- [Floorplan images](https://github.com/viny182/kfloorp/tree/main/images): `images`
- [Dashboard runtime](https://github.com/viny182/kfloorp/blob/main/js/main.js): `js/main.js`

### Device features

- [Switch listing page](https://github.com/viny182/kfloorp/blob/main/switches.html): `switches.html`
- [Switch listing](https://github.com/viny182/kfloorp/blob/main/js/main.js): `js/main.js`
- [Entity state display](https://github.com/viny182/kfloorp/blob/main/js/main.js): `js/main.js`
- [Switch controls](https://github.com/viny182/kfloorp/blob/main/js/main.js): `js/main.js`
- [Door and window sensors](https://github.com/viny182/kfloorp/blob/main/js/main.js): `js/main.js`
- [Sensor readings](https://github.com/viny182/kfloorp/blob/main/js/main.js): `js/main.js`
- [Media player controls](https://github.com/viny182/kfloorp/blob/main/js/main.js): `js/main.js`
- [Weather display](https://github.com/viny182/kfloorp/blob/main/js/main.js): `js/main.js`

### Other components

- **Dashboard user**
- **Home Assistant API**

## Connections

- Dashboard user → First-floor view: opens dashboard (evidence: `README.md`)
- Dashboard runtime → Home Assistant API: fetches state (evidence: `js/main.js`)
- Dashboard runtime → Home Assistant API: sends service call (evidence: `js/main.js`)
- Dashboard runtime → Entity state display: renders entities (evidence: `js/main.js`)
- Dashboard runtime → Switch controls: renders controls (evidence: `js/main.js`)
- Dashboard runtime → Door and window sensors: renders states (evidence: `js/main.js`)
- Dashboard runtime → Sensor readings: renders readings (evidence: `js/main.js`)
- Dashboard runtime → Media player controls: renders controls (evidence: `js/main.js`)
- Dashboard runtime → Weather display: renders weather (evidence: `js/main.js`)
- Switch listing → Home Assistant API: fetches switches (evidence: `js/main.js`)
