first push

This commit is contained in:
jhartworks committed 2026-11-09 10:37:41 +01:00
commit 2a81b4a502
845 files changed
+356635

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
# Tutorial recorder
Records a step-by-step video of setting up NextFloor from the empty start, in the online demo (invented devices, nothing real is touched),
together with a German and an English transcript. The video is silent; the transcript is meant for a voice-over.
How it works: a headless Chrome drives the demo like a user would (real mouse and keys), and a screenshot is taken after each small step.
The video is a list of stills with durations, so slow work costs nothing in the video. The narration is a list of segments; each lasts at
least as long as its text takes to speak.
```
cd frontend
node tutorial/record.mjs all # every episode in order (about half an hour)
node tutorial/record.mjs 5 # one episode again (it starts from the plan the one before left in state/)
node tutorial/build.mjs # video, subtitles, transcripts, chapters, narration.json, narration.<lang>.txt
LANG_UI=de node tutorial/record.mjs all && LANG_UI=de node tutorial/build.mjs # the app in German in the picture
```
Output (default `frontend/tutorial/out/<en|de>/`, set `OUT` to change it): `nextfloor-tutorial.<lang>.mp4`, `nextfloor-tutorial.{de,en}.{srt,vtt}`,
`transcript.{de,en}.md`, `narration.{de,en}.txt` (one numbered text per segment, for text-to-speech), `narration.json`, `chapters.txt`.
Voice-over: make one audio file per segment named by its number (`001.mp3` …), then
`node tutorial/voiceover.mjs <audio-dir> [de|en]`. Segments that are spoken longer than planned hold the picture a little longer.
Writing an episode: `episodes/NN-name.mjs` exports `title`, optionally `query` (extra demo parameters) and `keepState`, and `run(r)`.
Use `r.say({de, en})` for narration, `r.click / drag / typeInto / choose / pick`, `r.show(seconds)` to let the picture stand, `r.spotAt` to
frame something. Texts of the app are looked up by their i18n key (`python3 tutorial/key.py "Add floor"` finds the key), so the same script
records the app in either language. For development: `SCRATCH=/tmp/x.mjs FROM=<episode> node tutorial/record.mjs scratch` runs a throw-away
episode from the plan an episode left, and `r.dump()` prints what is on screen.
+55
View File
@@ -0,0 +1,55 @@
// Puts the recorded episodes together: one video (silent), subtitles and a transcript in German and English, the chapter list, and
// narration.json (every segment with its start, end and both texts) for the voice-over.
import { execFileSync } from "node:child_process";
import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";
const lang = process.env.LANG_UI === "de" ? "de" : "en";
const root = process.env.OUT ?? `${import.meta.dirname}/out/${lang}`;
const ffmpeg = execFileSync("python3", ["-c", "import imageio_ffmpeg;print(imageio_ffmpeg.get_ffmpeg_exe())"]).toString().trim();
const episodes = readdirSync(root).filter((d) => /^ep\d+$/.test(d)).sort();
const clock = (s, comma) => {
const ms = Math.round(s * 1000);
const p = (n, w = 2) => String(n).padStart(w, "0");
return `${p(Math.floor(ms / 3600000))}:${p(Math.floor(ms / 60000) % 60)}:${p(Math.floor(ms / 1000) % 60)}${comma ? "," : "."}${p(ms % 1000, 3)}`;
};
const short = (s) => `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, "0")}`;
let offset = 0;
const concat = [];
const segments = [];
const chapters = [];
for (const ep of episodes) {
const data = JSON.parse(readFileSync(join(root, ep, `${ep}.segments.json`), "utf8"));
for (const line of readFileSync(join(root, ep, `${ep}.concat.txt`), "utf8").split("\n")) {
concat.push(line.startsWith("file '") ? `file '${join(root, ep, line.slice(6, -1))}'` : line);
}
for (const s of data.segments) segments.push({ ...s, start: s.start + offset, end: s.end + offset, episode: ep });
for (const c of data.chapters) chapters.push({ ...c, start: c.start + offset, episode: ep });
offset += data.seconds;
}
// ffmpeg's concat needs the last file twice and no duplicate trailing duration
writeFileSync(join(root, "all.concat.txt"), concat.join("\n") + "\n");
const mp4 = join(root, `nextfloor-tutorial.${lang}.mp4`);
execFileSync(ffmpeg, ["-y", "-f", "concat", "-safe", "0", "-i", join(root, "all.concat.txt"), "-vf", "fps=30,format=yuv420p", "-c:v", "libx264", "-preset", "medium", "-crf", "20", "-movflags", "+faststart", mp4], { stdio: "ignore" });
for (const l of ["de", "en"]) {
writeFileSync(join(root, `nextfloor-tutorial.${l}.srt`), segments.map((s, i) => `${i + 1}\n${clock(s.start, true)} --> ${clock(s.end, true)}\n${s[l]}\n`).join("\n"));
writeFileSync(join(root, `nextfloor-tutorial.${l}.vtt`), "WEBVTT\n\n" + segments.map((s) => `${clock(s.start)} --> ${clock(s.end)}\n${s[l]}\n`).join("\n"));
const lines = [`# ${l === "de" ? "NextFloor von Grund auf einrichten – Transkript" : "Setting up NextFloor from scratch – transcript"}`, ""];
let chapter = -1;
for (const s of segments) {
const c = chapters.filter((x) => x.start <= s.start + 0.01).length - 1;
if (c !== chapter && chapters[c]) {
chapter = c;
lines.push("", `## ${chapters[c].title[l]} (${short(chapters[c].start)})`, "");
}
lines.push(`**[${short(s.start)}]** ${s[l]}`, "");
}
writeFileSync(join(root, `transcript.${l}.md`), lines.join("\n"));
}
for (const l of ["de", "en"]) writeFileSync(join(root, `narration.${l}.txt`), segments.map((s, i) => `${String(i + 1).padStart(3, "0")}: ${s[l]}`).join("\n\n") + "\n");
writeFileSync(join(root, "chapters.txt"), chapters.map((c) => `${short(c.start)} ${c.title.en}`).join("\n") + "\n");
writeFileSync(join(root, "narration.json"), JSON.stringify({ seconds: offset, segments: segments.map((s, i) => ({ id: i + 1, start: +s.start.toFixed(2), end: +s.end.toFixed(2), de: s.de, en: s.en })) }, null, 1));
console.log(`${mp4}: ${short(offset)} (${segments.length} segments, ${chapters.length} chapters)`);
@@ -0,0 +1,125 @@
export const title = { en: "First steps: the interface and the first floor", de: "Erste Schritte: Oberfläche und die erste Etage" };
const S = (de, en) => ({ de, en });
export async function run(r) {
// ------------------------------------------------------------------ 1. the empty start
await r.chapter({ en: "Welcome to NextFloor", de: "Willkommen bei NextFloor" }, { en: "Setting up a home from scratch", de: "Ein Zuhause von Grund auf einrichten" });
r.say(S(
"Willkommen! In diesem Video richten wir NextFloor komplett von Grund auf ein. Wir starten genau dort, wo du nach der Installation zum ersten Mal das Panel öffnest: Es ist noch nichts gezeichnet, die Seite ist leer.",
"Welcome! In this video we set up NextFloor completely from scratch. We start exactly where you are after the installation, the first time you open the panel: nothing is drawn yet, the page is empty.",
));
await r.show(1);
r.say(S(
"NextFloor zeichnet dein Zuhause direkt in Home Assistant und zeigt es als lebendiges 3D-Modell. Lichter leuchten in ihrer Farbe, Rollläden bewegen sich, und du kannst alles direkt im Modell bedienen. Dafür brauchst du nur deinen Grundriss und ein paar Minuten.",
"NextFloor draws your home right inside Home Assistant and shows it as a living 3D model. Lights glow in their colours, blinds move, and you can control everything straight in the model. All it needs is your floor plan and a few minutes.",
));
await r.show(1);
// ------------------------------------------------------------------ 2. the three tabs
r.say(S(
"Oben links findest du drei Reiter. Der erste ist die 3D-Ansicht: Das ist das Modell deines Hauses, so wie du es später jeden Tag benutzt.",
"Top left there are three tabs. The first is the 3D view: the model of your house, the way you will use it every day.",
));
await r.spotAt({ text: "3D" });
await r.point({ text: "3D" });
await r.show(0.5);
r.say(S(
"Der zweite Reiter ist der Editor. Hier zeichnest du Räume, setzt Türen, Fenster und Möbel und verbindest alles mit deinen Geräten. Den Editor sehen nur Administratoren.",
"The second tab is the editor. This is where you draw rooms, place doors, windows and furniture, and connect everything to your devices. Only administrators see the editor.",
));
await r.spotAt({ key: "ext_tab" === "" ? "x" : undefined, text: "Editor" });
await r.point({ text: "Editor" });
await r.show(0.5);
r.say(S(
"Der dritte Reiter heißt Erweiterungen. Dort lädst du später eigene 3D-Modelle hoch, zum Beispiel für dein Auto. Dazu kommen wir in einem eigenen Kapitel.",
"The third tab is called Extensions. That is where you upload your own 3D models later, for example for your car. We will get to that in a chapter of its own.",
));
await r.spotAt({ text: "✦ Extensions" });
await r.point({ text: "✦ Extensions" });
await r.show(0.5);
await r.spot(null);
// ------------------------------------------------------------------ 3. open the editor
r.say(S(
"Mitten auf der Seite steht der Hinweis, dass es noch keinen Grundriss gibt. Mit einem Klick auf „Editor öffnen“ geht es los.",
"In the middle of the page a note says there is no floor plan yet. One click on “Open editor” gets us started.",
));
await r.show(0.8);
await r.click({ key: "open_editor" });
await r.show(1);
await r.chapter({ en: "The editor at a glance", de: "Der Editor im Überblick" }, { en: "Tools, floors and settings", de: "Werkzeuge, Etagen und Einstellungen" });
r.say(S(
"So sieht der Editor aus. Oben links ist die Werkzeugleiste: Auswählen, Rechteck, Freie Form, Wand, Türen und Fenster, Möbel, Außen, Bodenöffnung, Dach und Energie. Jedes Werkzeug lernen wir der Reihe nach kennen.",
"This is the editor. Top left is the toolbar: Select, Rectangle, Free shape, Wall, Doors and windows, Furniture, Outdoor, Floor opening, Roof and Energy. We get to know each tool in turn.",
));
await r.spotUnion([{ key: "tool_select" }, { key: "tool_rect" }, { text: "Energy" }]);
await r.show(1);
r.say(S(
"Die zweite Leiste enthält Rückgängig und Wiederholen, „Alles zeigen“ passt den Plan ins Fenster, „3D daneben“ blendet die 3D-Ansicht neben dem Plan ein, und mit dem Schloss sperrst du den Grundriss gegen versehentliches Verschieben.",
"The second bar holds Undo and Redo; “Show all” fits the plan into the window, “3D beside” shows the 3D view next to the plan, and the lock protects the floor plan against accidental moves.",
));
await r.spotUnion([{ key: "undo" }, { key: "lock_plan" }]);
await r.show(1);
await r.spot(null);
r.say(S(
"Rechts steht die Seitenleiste. Sie zeigt immer das, was gerade ausgewählt ist, und ganz oben die Etagen deines Hauses. Da der Plan leer ist, sehen wir hier noch nicht viel.",
"On the right is the side panel. It always shows whatever is selected, and at the very top the floors of your house. Since the plan is empty, there is not much to see yet.",
));
await r.show(1);
// ------------------------------------------------------------------ 4. the first floor
await r.chapter({ en: "The first floor", de: "Die erste Etage" }, { en: "Floors from Home Assistant", de: "Etagen aus Home Assistant" });
r.say(S(
"Alle Werkzeuge sind noch ausgegraut, denn zuerst brauchen wir eine Etage. Wir klicken auf „Etage hinzufügen“.",
"All tools are greyed out because we need a floor first. We click “Add floor”.",
));
await r.show(0.6);
await r.click({ key: "add_floor" });
await r.show(0.8);
r.say(S(
"NextFloor zeigt dir jetzt die Etagen, die in Home Assistant angelegt sind. Wenn du eine davon wählst, bleiben Plan und Home Assistant verbunden: Die Räume können später ihren Bereichen zugeordnet werden. Alternativ legst du mit „Leere Etage“ eine Etage ohne Verbindung an.",
"NextFloor now lists the floors that exist in Home Assistant. If you pick one of them, the plan and Home Assistant stay connected: rooms can be assigned to their areas later. Alternatively “Empty floor” creates a floor with no connection.",
));
await r.show(1);
r.say(S(
"Wir nehmen das Erdgeschoss aus Home Assistant.",
"We take the ground floor from Home Assistant.",
));
await r.click({ text: "Erdgeschoss" });
await r.show(1);
r.say(S(
"Die Etage ist da, und die Werkzeuge sind jetzt aktiv. Rechts siehst du die Einstellungen der Etage. Oben steht der Name. Du kannst ihn jederzeit ändern, auch wenn er mit dem Namen in Home Assistant übereinstimmt.",
"The floor is there and the tools are active. On the right you see the settings of the floor. At the top is the name. You can change it any time, even if it matches the name in Home Assistant.",
));
await r.spotAt({ css: "nf-editor input[type=text]", nth: 0 }).catch(() => {});
await r.show(1);
await r.spot(null);
r.say(S(
"Die Höhe über dem Boden legt fest, wo die Etage im Haus steht. Das Erdgeschoss steht auf null, das Obergeschoss später auf etwa 2,8 Meter. Mit „Etage verschieben“ schiebst du die ganze Etage um einen Betrag, und „90° drehen“ dreht sie.",
"The elevation sets where the floor stands in the house. The ground floor stands at zero, the upper floor later at about 2.8 metres. “Shift the floor” moves the whole floor by an amount, and “Turn 90°” rotates it.",
));
await r.spotAt({ key: "elevation" });
await r.show(1.2);
await r.spotAt({ key: "floor_turn" });
await r.show(0.8);
await r.spot(null);
r.say(S(
"Die Raumhöhe gilt für alle Wände der Etage. Standard sind zwei Komma fünf Meter. Für einzelne Wände kannst du sie später anpassen.",
"The ceiling height applies to all walls of the floor. The default is two point five metres. You can adjust it for single walls later.",
));
await r.spotAt({ key: "height" });
await r.show(1);
await r.spot(null);
r.say(S(
"Mit „Etage in Home Assistant“ legst du fest, zu welcher Etage in Home Assistant diese Etage gehört. Und mit „Räume aus HA-Bereichen anlegen“ erzeugt NextFloor für jeden Bereich einen Raum. Das ist praktisch, wir zeichnen die Räume aber selbst, damit du siehst, wie es geht.",
"“Floor in Home Assistant” sets which Home Assistant floor this floor belongs to. And “Add rooms from HA areas” creates a room for every area. That is handy, but we will draw the rooms ourselves so you can see how it works.",
));
await r.spotAt({ key: "ha_floor" });
await r.show(1);
await r.spotAt({ key: "area_rooms", vars: { n: 6 } });
await r.show(1);
await r.spot(null);
}
+169
View File
@@ -0,0 +1,169 @@
export const title = { en: "Drawing rooms", de: "Räume zeichnen" };
const S = (de, en) => ({ de, en });
const NAMES = {
en: { living: "Living room", kitchen: "Kitchen", bedroom: "Bedroom", bath: "Bathroom", hall: "Hallway" },
de: { living: "Wohnzimmer", kitchen: "Küche", bedroom: "Schlafzimmer", bath: "Bad", hall: "Flur" },
};
export async function run(r) {
const n = NAMES[r.lang];
const plan = (x, z) => r.planPoint(x, z);
const rect = async (x1, z1, x2, z2) => r.drag(await plan(x1, z1), await plan(x2, z2));
const nameIt = (name) => r.typeInto({ label: "room_name" }, name);
// the previous episode ended in the editor with the floor selected; a new page starts in 3D, so we go back (not filmed)
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
await r.chapter({ en: "Drawing rooms", de: "Räume zeichnen" }, { en: "The rectangle tool", de: "Das Rechteck-Werkzeug" });
r.say(S(
"Jetzt zeichnen wir die Räume. Das schnellste Werkzeug ist das Rechteck. Wir wählen es in der Werkzeugleiste aus.",
"Now we draw the rooms. The fastest tool is the rectangle. We pick it in the toolbar.",
));
await r.click({ key: "tool_rect" });
await r.show(0.5);
r.say(S(
"Unten links steht immer ein kurzer Hinweis zum aktiven Werkzeug. Beim Rechteck heißt er: Ziehen, um ein Rechteck zu zeichnen.",
"At the bottom left there is always a short hint for the active tool. For the rectangle it says: drag to draw a rectangle.",
));
await r.spotAt({ css: "nf-editor .nf-hint, nf-editor [class*=hint]" }).catch(() => {});
await r.show(1);
await r.spot(null);
r.say(S(
"Wir beginnen mit dem Wohnzimmer. Wir drücken an der linken oberen Ecke, ziehen zur rechten unteren Ecke und lassen los. Während des Ziehens zeigt NextFloor die Seitenlängen an. Die Maße rasten auf das Raster ein, standardmäßig auf fünf Zentimeter.",
"We start with the living room. We press at the top left corner, drag to the bottom right corner and let go. While dragging, NextFloor shows the side lengths. The sizes snap to the grid, by default to five centimetres.",
));
await rect(0, 0, 6, 4.6);
await r.show(1);
r.say(S(
"Der Raum ist gezeichnet und gleich ausgewählt. Das Werkzeug ist wieder auf „Auswählen“ gesprungen. Rechts erscheinen die Eigenschaften des Raums. Als Erstes geben wir ihm einen Namen.",
"The room is drawn and selected right away. The tool has jumped back to “Select”. On the right the properties of the room appear. First we give it a name.",
));
await r.show(0.8);
await nameIt(n.living);
r.say(S(
"Mit dem Bereich verbindest du den Raum mit Home Assistant. Alle Geräte, die in Home Assistant diesem Bereich zugeordnet sind, kann NextFloor dann automatisch in diesem Raum anzeigen. Wir wählen den Bereich Wohnzimmer.",
"With the area you connect the room to Home Assistant. All devices assigned to this area in Home Assistant can then be shown in this room automatically. We choose the area Wohnzimmer.",
));
await r.choose({ label: "area" }, "Wohnzimmer");
r.say(S(
"Das Material bestimmt, wie der Boden in 3D aussieht: Holz, Eiche, Fliesen, Teppich, Stein oder Beton. Das Wohnzimmer bekommt Eichenparkett.",
"The material decides how the floor looks in 3D: wood, oak, tiles, carpet, stone or concrete. The living room gets oak parquet.",
));
await r.choose({ label: "floor" }, r.lang === "de" ? "Eiche" : "Oak");
await r.show(0.8);
r.say(S(
"Darunter stehen Position und Größe des Raums in Metern. Du kannst die Zahlen direkt eintippen, wenn du es genau haben willst. Wir lassen sie, wie sie sind: sechs mal vier Komma sechs Meter.",
"Below are the position and size of the room in metres. You can type the numbers directly if you want it exact. We leave them as they are: six by four point six metres.",
));
await r.spotUnion([{ label: "width" }, { label: "depth" }]);
await r.show(1.2);
await r.spot(null);
// ------------------------------------------------------------------ corners
await r.chapter({ en: "Corners and edges", de: "Ecken und Kanten" }, { en: "Reshaping a room", de: "Einen Raum umformen" });
r.say(S(
"Jede Ecke des ausgewählten Raums hat einen Griff. Wenn du an einem Griff ziehst, wandert die Ecke. Probieren wir es aus: Wir ziehen die rechte obere Ecke ein Stück nach oben.",
"Every corner of the selected room has a handle. Dragging a handle moves the corner. Let us try it: we drag the top right corner up a little.",
));
const corner = await plan(6, 0);
await r.drag(corner, { x: corner.x + 30, y: corner.y - 40 });
await r.show(1);
r.say(S(
"Das war nur ein Versuch, deshalb machen wir es mit „Rückgängig“ ungeschehen. Fast alles im Editor lässt sich rückgängig machen, auch mit Strg plus Z.",
"That was only a test, so we undo it with “Undo”. Almost everything in the editor can be undone, also with Ctrl plus Z.",
));
await r.click({ key: "undo" });
await r.show(1);
r.say(S(
"In der Mitte jeder Kante sitzt ein Plus. Ein Klick darauf fügt eine zusätzliche Ecke ein, mit der du Räume mit Nischen oder schrägen Wänden formst. Auch das nehmen wir gleich wieder zurück.",
"In the middle of every edge there is a plus. A click on it inserts an additional corner, with which you shape rooms with niches or slanted walls. We take that back as well.",
));
const mid = await plan(3, 0);
await r.click({ x: mid.x, y: mid.y });
await r.show(1);
await r.click({ key: "undo" });
await r.show(0.8);
// ------------------------------------------------------------------ the next rooms
await r.chapter({ en: "More rooms", de: "Weitere Räume" }, { en: "Walls are shared", de: "Wände werden geteilt" });
r.say(S(
"Jetzt kommt die Küche rechts neben das Wohnzimmer. Wir wählen wieder das Rechteck und ziehen. Die Ecken rasten an den vorhandenen Wänden ein, und die Wand dazwischen gehört beiden Räumen.",
"Now the kitchen goes to the right of the living room. We pick the rectangle again and drag. The corners snap to the existing walls, and the wall in between belongs to both rooms.",
));
await r.click({ key: "tool_rect" });
await rect(6, 0, 10, 4.6);
await nameIt(n.kitchen);
await r.choose({ label: "area" }, "Küche");
await r.choose({ label: "floor" }, r.lang === "de" ? "Fliesen" : "Tiles");
await r.show(0.8);
r.say(S(
"Unter dem Wohnzimmer liegt das Schlafzimmer. Es bekommt den Bereich Schlafzimmer und einen Teppichboden.",
"Below the living room is the bedroom. It gets the area Schlafzimmer and a carpet floor.",
));
await r.click({ key: "tool_rect" });
await rect(0, 4.6, 4.4, 8);
await nameIt(n.bedroom);
await r.choose({ label: "area" }, "Schlafzimmer");
await r.choose({ label: "floor" }, r.lang === "de" ? "Teppich" : "Carpet");
await r.show(0.8);
r.say(S(
"Daneben das Bad, wieder mit Fliesen.",
"Next to it the bathroom, with tiles again.",
));
await r.click({ key: "tool_rect" });
await rect(4.4, 4.6, 6.8, 8);
await nameIt(n.bath);
await r.choose({ label: "area" }, "Bad");
await r.choose({ label: "floor" }, r.lang === "de" ? "Fliesen" : "Tiles");
await r.show(0.8);
// ------------------------------------------------------------------ free shape
await r.chapter({ en: "Free shapes", de: "Freie Form" }, { en: "Rooms that are not rectangles", de: "Räume, die kein Rechteck sind" });
r.say(S(
"Nicht jeder Raum ist ein Rechteck. Der Flur bekommt eine L-Form. Dafür gibt es das Werkzeug „Freie Form“.",
"Not every room is a rectangle. The hallway gets an L shape. For that there is the “Free shape” tool.",
));
await r.click({ key: "tool_polygon" });
r.say(S(
"Hier setzt du Punkt für Punkt die Ecken des Raums. Zum Schließen tippst du auf den ersten Punkt oder drückst Enter. Mit Escape brichst du ab.",
"Here you place the corners of the room one by one. To close it, tap the first corner or press Enter. Escape cancels.",
));
for (const [x, z] of [[6.8, 4.6], [10, 4.6], [10, 8], [8.4, 8], [8.4, 9.2], [6.8, 9.2]]) {
const p = await plan(x, z);
await r.click({ x: p.x, y: p.y }, { settle: 300, after: 0.2 });
}
await r.key("Enter", { frames: 3 });
await r.show(1);
await nameIt(n.hall);
await r.choose({ label: "area" }, "Flur");
await r.choose({ label: "floor" }, r.lang === "de" ? "Eiche" : "Oak");
await r.show(1);
// ------------------------------------------------------------------ walls
await r.chapter({ en: "Walls", de: "Wände" }, { en: "Heights and thickness", de: "Höhe und Dicke" });
r.say(S(
"Die Wände entstehen automatisch aus den Raumkanten. Außenwände sind standardmäßig vierundzwanzig Zentimeter dick, Innenwände zwölf. Das stellst du unter Einstellungen ein. Für einzelne Wände findest du im Raum-Formular einen Bereich „Wandhöhen“.",
"The walls are created automatically from the room edges. Exterior walls are twenty-four centimetres thick by default, interior walls twelve. You set that under Settings. For single walls the room form has a section called “Wall heights”.",
));
r.say(S("Zuerst passen wir die Ansicht an: „Alles zeigen“ rückt den ganzen Plan ins Fenster.", "First we adjust the view: “Show all” fits the whole plan into the window."));
await r.click({ key: "fit" });
await r.show(0.8);
const inside = await plan(3, 2.3);
await r.click({ x: inside.x, y: inside.y });
await r.show(0.8);
await r.spotAt({ css: ".nf-wallbox, [class*=wall]", nth: 0 }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(1.5);
await r.spot(null);
r.say(S(
"Dort hat jede Wand eine Höhe, eine Dicke und eine Schere, mit der du eine Wand in Teile schneidest. Setzt du die Höhe niedriger, wird aus der Wand eine Brüstung oder eine Theke. „Keine Wand“ lässt die Kante offen, zum Beispiel zwischen Wohnzimmer und Essbereich.",
"There every wall has a height, a thickness and a pair of scissors with which you cut a wall into parts. A lower height turns the wall into a parapet or a counter. “No wall” leaves the edge open, for example between living room and dining area.",
));
await r.show(2);
}
@@ -0,0 +1,70 @@
export const title = { en: "Drawing aids: partitions, gaps and templates", de: "Zeichenhilfen: Trennwände, Lücken und Vorlagen" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const plan = (x, z) => r.planPoint(x, z);
const L = (de, en) => (r.lang === "de" ? de : en);
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
await r.chapter({ en: "Free-standing walls", de: "Freistehende Wände" }, { en: "Partitions and half walls", de: "Trennwände und halbe Wände" });
r.say(S(
"Nicht jede Wand gehört zu einem Raum. Eine Trennwand mitten im Wohnzimmer, eine halbe Wand zum Essbereich oder eine Brüstung zeichnest du mit dem Werkzeug „Wand“.",
"Not every wall belongs to a room. A partition in the middle of the living room, a half wall towards the dining area or a parapet you draw with the “Wall” tool.",
));
await r.click({ key: "tool_wall" });
r.say(S(
"Der Hinweis unten: Ziehen, um eine einzelne Wand zu zeichnen. Mit der Umschalt-Taste bleibt sie gerade, mit Alt rastet sie nicht ein. Wir ziehen eine kurze Wand.",
"The hint at the bottom: drag to draw a single wall. With the Shift key it stays straight, with Alt it does not snap. We drag a short wall.",
));
await r.drag(await plan(1, 2.3), await plan(1, 4.5));
await r.show(1);
r.say(S(
"Die Wand ist ausgewählt. Im Formular stellst du Länge, Dicke und Höhe ein. Eine niedrigere Höhe macht aus ihr eine halbe Wand oder Brüstung. Wo sie auf eine Raumwand trifft, wird die Ecke sauber verbunden. An den Griffen verschiebst du die Enden, und an der Linie die ganze Wand.",
"The wall is selected. In the form you set length, thickness and height. A lower height turns it into a half wall or parapet. Where it meets a room wall, the corner is joined cleanly. At the handles you move the ends, and at the line the whole wall.",
));
await r.spotUnion([{ label: "wall_thickness" }, { label: "height_m" }]).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2.5);
await r.spot(null);
r.say(S(
"Für unser Haus brauchen wir sie nicht, deshalb löschen wir sie mit „Löschen“ wieder.",
"We do not need it for our house, so we delete it again with “Delete”.",
));
await r.click({ text: L("Löschen", "Delete") });
await r.show(1);
await r.chapter({ en: "Gaps and the lock", de: "Lücken und die Sperre" }, { en: "Keeping the plan tidy", de: "Den Plan sauber halten" });
r.say(S(
"Zeichnest du Räume von Hand, bleiben manchmal winzige Lücken zwischen zwei Wänden, die man kaum sieht, in 3D aber als Spalt auftauchen. Dafür gibt es im Etagen-Formular „Lücken schließen“. NextFloor sucht solche Stellen und zieht die Wände zusammen.",
"If you draw rooms by hand, tiny gaps sometimes remain between two walls, hardly visible but showing up as a slit in 3D. For that there is “Close gaps” in the floor form. NextFloor looks for such places and pulls the walls together.",
));
await r.click({ key: "back_to_floor" }).catch(() => {});
await r.spotAt({ text: L("Lücken schließen", "Close gaps") }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2.5);
await r.spot(null);
r.say(S(
"Ist der Plan fertig, sperrst du ihn mit dem Schloss „Grundriss“, damit Räume, Wände, Türen, Fenster und Außenflächen nicht aus Versehen verschoben werden. Einzelne Stücke lassen sich auch mit „Fixieren“ sperren.",
"When the plan is done, you lock it with the “Floor plan” lock so that rooms, walls, doors, windows and outdoor areas are not moved by accident. Single pieces can also be locked with “Fix”.",
));
await r.click({ key: "lock_plan" });
await r.show(2.5, 800);
await r.click({ key: "lock_plan" });
await r.show(1.5, 800);
await r.chapter({ en: "A floor plan as a template", de: "Ein Grundriss als Vorlage" }, { en: "Tracing a drawing or photo", de: "Eine Zeichnung oder ein Foto nachzeichnen" });
r.say(S(
"Hast du schon einen Grundriss als Bild, etwa vom Bauplan oder als Foto, kannst du ihn als Vorlage hinter den Plan legen und nachzeichnen. Das findest du unter „Vorlage“ in der Seitenleiste.",
"If you already have a floor plan as a picture, say from the building plans or as a photo, you can put it behind the plan as a template and trace it. You find that under “Template” in the side panel.",
));
await r.spotAt({ key: "background" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2.5);
await r.spot(null);
r.say(S(
"Nach dem Hochladen schiebst du das Bild mit der Maus, skalierst es an der Ecke und drehst es am Griff darüber. Mit zwei Punkten richtest du es gerade, und mit einer bekannten Länge, etwa einer Wand, stellst du den Maßstab ein. Dann zeichnest du die Räume direkt darauf.",
"After uploading, you move the picture with the mouse, scale it at the corner and turn it at the handle above it. With two points you straighten it, and with a known length, such as a wall, you set the scale. Then you draw the rooms right on top.",
));
await r.show(2.5);
}
@@ -0,0 +1,142 @@
export const title = { en: "Doors and windows", de: "Türen und Fenster" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const plan = (x, z) => r.planPoint(x, z);
const tap = async (x, z) => {
const p = await plan(x, z);
await r.click({ x: p.x, y: p.y }, { settle: 700 });
};
const type = (name) => r.click({ text: name });
const L = (de, en) => (r.lang === "de" ? de : en);
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
await r.chapter({ en: "Doors and windows", de: "Türen und Fenster" }, { en: "Placing openings in the walls", de: "Öffnungen in die Wände setzen" });
r.say(S(
"Unsere Räume haben noch keine Öffnungen. Dafür gibt es das Werkzeug „Türen und Fenster“. Wir wählen es aus.",
"Our rooms have no openings yet. For that there is the “Doors and windows” tool. We select it.",
));
await r.click({ key: "tool_opening" });
r.say(S(
"Der Hinweis unten sagt es schon: Tippe auf eine Wand, um eine Tür oder ein Fenster einzusetzen. Die Art wählst du danach rechts. Wir beginnen mit der Haustür an der unteren Wand des Flurs.",
"The hint at the bottom says it already: tap a wall to add a door or window. You choose the kind afterwards on the right. We begin with the front door on the lower wall of the hallway.",
));
await r.show(0.8);
await tap(7.6, 9.2);
r.say(S(
"Die Öffnung sitzt in der Wand und ist ausgewählt. Das Werkzeug ist wieder auf „Auswählen“ gesprungen. Rechts siehst du alle Arten: Tür, Haustür, Doppeltür, Fenster, Doppelfenster, Terrassentür, Balkontür, Garagentor und Glaswand. Als Haustür nehmen wir die Haustür.",
"The opening sits in the wall and is selected. The tool has jumped back to “Select”. On the right you see all kinds: door, front door, double door, window, double window, terrace door, French doors, garage door and glass wall. For the entrance we take the front door.",
));
await r.show(0.8);
await type(L("Haustür", "Front door"));
await r.show(1);
r.say(S(
"Breite, Position und Höhe stellst du darunter in Metern ein. „Mitte von der Ecke“ ist der Abstand der Türmitte von der Raumecke. Die Haustür soll genau mittig in der Wand sitzen, das sind null Komma acht Meter.",
"Width, position and height are set below in metres. “Centre from corner” is the distance of the door centre from the room corner. The front door should sit exactly in the middle of the wall, that is zero point eight metres.",
));
await r.spotUnion([{ label: "width" }, { label: "opening_position" }]).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(1.5);
await r.spot(null);
r.say(S(
"Mit „Anschlag wechseln“ drehst du die Seite, an der die Tür angeschlagen ist, und „Öffnungsrichtung umkehren“ lässt sie nach außen statt nach innen aufgehen. Beides siehst du sofort im Plan.",
"“Swap hinge side” changes the side the door is hinged on, and “Reverse opening direction” makes it open outwards instead of inwards. You see both immediately in the plan.",
));
await r.click({ key: "flip_hinge" });
await r.show(1);
// ------------------------------------------------------------------ interior doors
await r.chapter({ en: "Interior doors", de: "Innentüren" }, { en: "Doors between rooms", de: "Türen zwischen den Räumen" });
r.say(S(
"Jetzt die Türen im Haus. Zwischen Flur und Küche setzen wir eine normale Tür. Wir wählen wieder das Werkzeug und tippen auf die gemeinsame Wand.",
"Now the doors inside the house. Between the hallway and the kitchen we place a normal door. We pick the tool again and tap the shared wall.",
));
await r.click({ key: "tool_opening" });
await tap(9.2, 4.6);
await r.show(0.8);
r.say(S(
"Standardmäßig wird eine normale Tür eingesetzt. Das passt hier, also lassen wir es dabei. Der Stil steht auf „Automatisch“: In einer Außenwand wird daraus eine Haustür, innen eine Zimmertür.",
"A normal door is placed by default. That fits here, so we leave it. The style is on “Automatic”: in an exterior wall it becomes a front door, inside a room door.",
));
await r.spotAt({ label: "opening_style" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(1.5);
await r.spot(null);
r.say(S("Dasselbe machen wir vom Flur ins Bad…", "We do the same from the hallway into the bathroom…"));
await r.click({ key: "tool_opening" });
await tap(6.8, 6.3);
await r.show(0.6);
r.say(S("…und vom Wohnzimmer ins Schlafzimmer.", "…and from the living room into the bedroom."));
await r.click({ key: "tool_opening" });
await tap(2.2, 4.6);
await r.show(0.6);
// ------------------------------------------------------------------ windows
await r.chapter({ en: "Windows", de: "Fenster" }, { en: "Kinds, sill and blinds", de: "Arten, Brüstung und Rollläden" });
r.say(S(
"Fenster funktionieren genauso. Wir setzen ein Doppelfenster in die obere Wand des Wohnzimmers.",
"Windows work the same way. We place a double window in the upper wall of the living room.",
));
await r.click({ key: "tool_opening" });
await tap(3, 0);
await type(L("Doppelfenster", "Double window"));
await r.show(1);
r.say(S(
"Bei Fenstern gibt es zusätzlich die Brüstungshöhe, also wie hoch die Fensterunterkante über dem Boden liegt. Das Doppelfenster hat zwei Flügel, und mit „Hauptflügel wechseln“ bestimmst du, welcher davon der Hauptflügel ist.",
"Windows also have a sill height, how high the lower edge of the window sits above the floor. The double window has two leaves, and “Swap main leaf” decides which of them is the main leaf.",
));
await r.spotAt({ label: "sill" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(1.5);
await r.spot(null);
r.say(S(
"Jetzt wird es spannend: Weiter unten kannst du dem Fenster Geräte zuordnen. Der Rollladen steht auf „Automatisch“. NextFloor hat im Bereich Wohnzimmer einen Rollladen gefunden und nimmt ihn. Genauso den Fensterkontakt, den Terrassentür-Sensor. Damit bewegt sich der Rollladen im Modell mit, und das Fenster zeigt, ob es offen ist.",
"Now it gets interesting: further down you can assign devices to the window. The blind is on “Automatic”. NextFloor found a blind in the area Wohnzimmer and uses it. The same for the window contact, the terrace door sensor. With that the blind moves along in the model, and the window shows whether it is open.",
));
await r.spotAt({ css: "input[type=text]", nth: 0 });
await r.show(2);
await r.spot(null);
r.say(S(
"Willst du ein anderes Gerät zuweisen, klickst du in das Feld und tippst einen Teil des Namens. Die Liste zeigt passende Geräte mit ihrem Bereich und der Entity-ID. Ein Klick wählt das Gerät aus. Wir tippen „Roll“.",
"To assign a different device, click into the field and type part of its name. The list shows matching devices with their area and entity ID. A click picks the device. We type “Roll”.",
));
await r.click({ css: "input[type=text]", nth: 0 });
await r.page.keyboard.type("Roll", { delay: 90 });
await r.show(1.5);
await r.click({ text: "Wohnzimmer Rollladen" });
await r.show(1);
r.say(S(
"Wichtig: NextFloor schaltet dabei nichts. Die Zuordnung sagt nur, welches Gerät zu diesem Fenster gehört.",
"Important: NextFloor does not switch anything here. The assignment only says which device belongs to this window.",
));
await r.show(1);
// ------------------------------------------------------------------ more windows
r.say(S(
"Die restlichen Fenster setzen wir ohne viele Worte: ein Fenster in die Küche, eines ins Schlafzimmer und ein kleines ins Bad.",
"The remaining windows we place without many words: one in the kitchen, one in the bedroom and a small one in the bathroom.",
));
await r.click({ key: "tool_opening" });
await tap(8, 0);
await type(L("Fenster", "Window"));
await r.click({ key: "tool_opening" });
await tap(0, 6.3);
await type(L("Fenster", "Window"));
await r.click({ key: "tool_opening" });
await tap(5.6, 8);
await type(L("Fenster", "Window"));
await r.show(1);
r.say(S(
"Eine Tür oder ein Fenster entfernst du, indem du es auswählst und unten auf „Löschen“ klickst oder die Entf-Taste drückst.",
"To remove a door or window, select it and click “Delete” at the bottom, or press the Delete key.",
));
await r.show(1.5);
await r.click({ key: "fit" });
await r.show(1.5);
}
+122
View File
@@ -0,0 +1,122 @@
export const title = { en: "Furnishing rooms", de: "Räume einrichten" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const plan = (x, z) => r.planPoint(x, z);
const L = (de, en) => (r.lang === "de" ? de : en);
/** Picks an item of the library and puts it at a place by typing its position and turn in the form. */
const place = async (key, x, z, rotation = 0, size) => {
await r.click({ key });
await r.typeInto({ label: "x" }, String(x));
await r.typeInto({ label: "z" }, String(z));
if (size) {
await r.typeInto({ label: "width" }, String(size[0]));
await r.typeInto({ label: "depth" }, String(size[1]));
}
if (rotation) await r.typeInto({ label: "rotation" }, String(rotation));
};
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
await r.chapter({ en: "Furnishing rooms", de: "Räume einrichten" }, { en: "The furniture library", de: "Die Möbelbibliothek" });
r.say(S(
"Ein Raum ohne Möbel wirkt leer, deshalb richten wir ihn jetzt ein. Dafür gibt es das Werkzeug „Möbel“.",
"A room without furniture looks empty, so now we furnish it. For that there is the “Furniture” tool.",
));
await r.click({ key: "tool_furniture" });
r.say(S(
"Der Hinweis unten sagt: Tippe auf einen Raum, dann wähle rechts ein Möbelstück. Wir tippen auf das Wohnzimmer.",
"The hint at the bottom says: tap a room, then pick an item on the right. We tap the living room.",
));
const room = await plan(1, 1);
await r.click({ x: room.x, y: room.y });
await r.show(1);
r.say(S(
"Rechts steht jetzt die Möbelbibliothek. Neue Möbel landen in der Mitte des gewählten Raums, das steht oben darüber. Die Bibliothek ist in Bereiche gegliedert: Leuchten, Wohnen, Essen, Küche, Schlafen, Bad und Wäsche, Arbeiten und Sonstiges, Parken. Ein Klick auf eine Überschrift klappt den Bereich auf oder zu.",
"On the right is now the furniture library. New items land in the middle of the chosen room, as it says above. The library is divided into sections: lights, living, dining, kitchen, sleeping, bath and laundry, work and other, parking. A click on a heading folds the section open or closed.",
));
await r.spotAt({ key: "furniture_add" });
await r.show(2);
await r.spot(null);
r.say(S(
"Unter den eingebauten Möbeln folgen die mitgelieferten Packs. Das sind große Sammlungen mit hunderten weiteren Möbelstücken, etwa ein Wohnzimmer-Pack, eine Küche oder ein Heimkino. Sie lassen sich genauso benutzen.",
"Below the built-in furniture follow the packs that come with NextFloor. These are large collections with hundreds more pieces, for example a living room pack, a kitchen or a home cinema. They are used in just the same way.",
));
await r.click({ text: L("Wohnzimmer", "Living room") }).catch((e) => console.log(" [skipped]", e.message));
await r.show(2);
await r.click({ text: L("Wohnzimmer", "Living room") }).catch(() => {});
r.say(S(
"Wenn du etwas Bestimmtes suchst, tippst du es einfach ins Suchfeld. Die Suche findet deutsche und englische Namen, den Namen des Packs und auch mehrere Wörter in beliebiger Reihenfolge. Wir suchen ein Ecksofa.",
"If you are looking for something specific, just type it into the search field. The search finds German and English names, the name of the pack, and even several words in any order. We look for a corner sofa.",
));
await r.typeInto({ css: "input[type=search]" }, L("ecksofa", "corner sofa"));
await r.show(2);
await r.click({ css: "input[type=search]" });
await r.key("Escape");
await r.show(0.8);
// ------------------------------------------------------------------ the first piece
await r.chapter({ en: "Placing and moving", de: "Platzieren und verschieben" }, { en: "The sofa", de: "Das Sofa" });
r.say(S(
"Wir beginnen mit einem einfachen Sofa aus dem Bereich Wohnen. Ein Klick darauf setzt es in die Mitte des Raums.",
"We start with a simple sofa from the living section. One click puts it in the middle of the room.",
));
await r.click({ key: "furn_sofa" });
await r.show(1);
r.say(S(
"Das Sofa ist ausgewählt. An den vier Ecken sitzen Griffe, mit denen du die Größe änderst, und unten ein Griff zum Drehen. Wir ziehen das Sofa mit der Maus an die obere Wand unter das Fenster.",
"The sofa is selected. At its four corners there are handles for changing the size, and at the bottom a handle for turning. We drag the sofa with the mouse to the upper wall under the window.",
));
const centre = await plan(3, 2.3);
const target = await plan(4, 1);
await r.drag(centre, target);
await r.show(1);
r.say(S(
"Rechts im Formular siehst du alle Werte des Stücks. Der Name ist optional und hilft dir später bei der Suche. Darunter stehen die Position, die Größe in Metern und die Drehung in Grad. Du kannst jeden Wert eintippen, wenn du es genau haben willst.",
"In the form on the right you see all values of the piece. The name is optional and helps you search later. Below are the position, the size in metres and the rotation in degrees. You can type any value if you want it exact.",
));
await r.spotAt({ label: "furn_name" });
await r.show(1.2);
await r.spotUnion([{ label: "x" }, { label: "rotation" }]);
await r.show(1.8);
await r.spot(null);
r.say(S(
"Mit den Knöpfen „90° links“ und „90° rechts“ drehst du das Stück in Viertelschritten, „Spiegeln“ vertauscht links und rechts, zum Beispiel bei einem Ecksofa. „Duplizieren“ legt eine Kopie an, und „Löschen“ entfernt das Stück. „Fixieren“ sperrt es gegen versehentliches Verschieben.",
"With the buttons “90° left” and “90° right” you turn the piece in quarter steps, “Mirror” swaps left and right, for example for a corner sofa. “Duplicate” makes a copy, and “Delete” removes the piece. “Fix” locks it against accidental moves.",
));
await r.spotAt({ key: "ctx_rotate", nth: 0 }).catch(() => {});
await r.show(1);
await r.spot(null);
await r.spotAt({ key: "fix" });
await r.show(1.2);
await r.spot(null);
// ------------------------------------------------------------------ the rest of the room
await r.chapter({ en: "Finishing the living room", de: "Das Wohnzimmer fertig einrichten" }, { en: "Position by numbers", de: "Position per Zahlen" });
r.say(S(
"Den Rest des Wohnzimmers richten wir jetzt zügig ein und geben die Positionen als Zahlen ein. Zuerst der Teppich, damit er unter den anderen Möbeln liegt.",
"We furnish the rest of the living room quickly now and enter the positions as numbers. First the rug, so that it lies under the other furniture.",
));
await r.click({ key: "tool_furniture" });
await r.click({ x: room.x, y: room.y });
await place("furn_rug", 4, 2.4, 0, [2.4, 1.6]);
r.say(S("Dann der Couchtisch auf dem Teppich.", "Then the coffee table on the rug."));
await place("furn_coffee_table", 4, 2.4);
r.say(S(
"Der Fernseher steht auf einem TV-Board an der gegenüberliegenden Wand. Das Board schaut standardmäßig nach unten, deshalb drehen wir es um hundertachtzig Grad, damit es zum Sofa zeigt.",
"The TV stands on a TV board against the opposite wall. By default the board faces down, so we turn it by one hundred and eighty degrees to face the sofa.",
));
await place("furn_tv_board", 4.1, 4.2, 180);
r.say(S("Ein Sessel links vom Couchtisch, zur Mitte gedreht…", "An armchair to the left of the coffee table, turned towards the middle…"));
await place("furn_armchair", 1.8, 2.4, 270);
r.say(S("…ein Regal in der Ecke und eine Pflanze am Fenster.", "…a shelf in the corner and a plant by the window."));
await place("furn_shelf", 0.45, 3.4, 90);
await place("furn_plant", 0.7, 0.7);
await r.show(1.5);
await r.click({ key: "tool_select" });
await r.click({ key: "fit" });
await r.show(2);
}
+136
View File
@@ -0,0 +1,136 @@
export const title = { en: "Devices and entities", de: "Geräte und Entities" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const plan = (x, z) => r.planPoint(x, z);
const L = (de, en) => (r.lang === "de" ? de : en);
const selectRoom = async () => {
const p = await plan(1.0, 3.9);
await r.click({ x: p.x, y: p.y });
};
/** Scrolls the side panel until the devices section stands at the top (a person would scroll with the wheel). */
const toDevices = async () => {
await r.eval(`(() => { const d = (root) => { for (const el of root.querySelectorAll("*")) { if (el.tagName === "H3" && /^(Devices|Geräte)$/.test(el.textContent.trim())) { el.scrollIntoView({ block: "start" }); return true; } if (el.shadowRoot && d(el.shadowRoot)) return true; } return false; }; return d(document); })()`);
await r.show(0.6);
};
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
await r.chapter({ en: "Devices from Home Assistant", de: "Geräte aus Home Assistant" }, { en: "Lights, blinds, heating and more", de: "Lichter, Rollläden, Heizung und mehr" });
r.say(S(
"Jetzt wird das Modell lebendig: Wir bringen die Geräte aus Home Assistant in den Plan. Dazu wählen wir mit „Auswählen“ den Raum, zum Beispiel das Wohnzimmer.",
"Now the model comes alive: we bring the devices from Home Assistant into the plan. For that we select the room with “Select”, for example the living room.",
));
await r.click({ key: "tool_select" });
await selectRoom();
await r.show(0.8);
r.say(S(
"Ganz unten im Raum-Formular steht der Abschnitt „Geräte“. Er zeigt die Geräte, die in Home Assistant zu diesem Bereich gehören, hier zwölf.",
"At the very bottom of the room form is the “Devices” section. It shows the devices that belong to this area in Home Assistant, twelve here.",
));
await toDevices();
await r.spotAt({ key: "devices_src_area" });
await r.show(1.5);
await r.spot(null);
r.say(S(
"Mit den Reitern darüber wechselst du die Quelle: „Dieser Bereich“, „Andere Bereiche“ für Geräte, die in einem anderen Raum stehen, und „Ohne Bereich“ für Geräte, die in Home Assistant noch keinem Bereich zugeordnet sind, zum Beispiel die Gartenbeleuchtung. Im Suchfeld findest du ein Gerät über seinen Namen.",
"With the tabs above you change the source: “This area”, “Other areas” for devices that stand in another room, and “No area” for devices that are not assigned to an area in Home Assistant yet, for example the garden lights. In the search field you find a device by its name.",
));
await r.click({ text: L("Andere Bereiche", "Other areas") });
await r.show(1.2);
await r.click({ text: L("Ohne Bereich", "No area") });
await r.show(1.2);
await r.click({ key: "devices_src_area" });
await r.show(0.8);
r.say(S(
"Jede Zeile hat vier Knöpfe: Das Auge blendet das Gerät im Raum-Fenster der 3D-Ansicht aus, „Aa“ gibt ihm einen eigenen Namen, der Stern fügt es dem Raum-Fenster hinzu, ohne es zu platzieren, und „Platzieren“ setzt es in den Plan.",
"Every row has four buttons: the eye hides the device in the room panel of the 3D view, “Aa” gives it a name of its own, the star adds it to the room panel without placing it, and “Place” puts it into the plan.",
));
await r.show(2);
// ------------------------------------------------------------------ lamps
await r.chapter({ en: "Placing a light", de: "Eine Leuchte platzieren" }, { en: "Lamps are furniture with a light", de: "Leuchten sind Möbel mit einem Licht" });
r.say(S(
"Wir platzieren das Deckenlicht. Ein Klick auf „Platzieren“ neben „Deckenlicht“.",
"We place the ceiling light. One click on “Place” next to “Deckenlicht”.",
));
await r.click({ key: "devices_place", near: "Deckenlicht" });
await r.show(1);
r.say(S(
"NextFloor hat daraus eine Deckenleuchte gemacht, die mit dem Licht verbunden ist. Wir wählen sie im Plan aus, indem wir sie antippen.",
"NextFloor has turned it into a ceiling lamp that is connected to the light. We select it in the plan by tapping it.",
));
const lamp = await plan(3, 2.3);
await r.click({ x: lamp.x, y: lamp.y });
await r.show(1);
r.say(S(
"Im Formular steht bei „Licht oder Schalter“ das verbundene Gerät, das Wohnzimmer-Deckenlicht. Darunter kannst du für Farbe und Helligkeit ein anderes Gerät angeben, falls ein Relais nur ein- und ausschaltet, während die Lampe selbst Farbe und Helligkeit kennt.",
"In the form, “Light or switch” holds the connected device, the living room ceiling light. Below it you can name another device for colour and brightness, in case a relay only switches on and off while the bulb itself knows colour and brightness.",
));
await r.spotAt({ label: "furn_entity_light" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2);
await r.spot(null);
r.say(S(
"Mit „Leuchten in 3D“ regelst du, wie stark das Licht im Modell glüht. Hundert Prozent sind so hell, wie das Gerät meldet. Wer LED-Streifen hat, die zu hell wirken, stellt hier weniger ein. „Vor dem Schalten fragen“ verhindert, dass ein Antippen in 3D das Licht versehentlich schaltet.",
"With “Glow in 3D” you set how strongly the light glows in the model. One hundred percent is as bright as the device reports. If you have LED strips that look too bright, set less here. “Ask before switching” prevents a tap in 3D from switching the light by accident.",
));
await r.spotAt({ label: "glow_scale" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2);
await r.spot(null);
r.say(S(
"Die Markierung in 3D bestimmt, ob zusätzlich ein kleines Symbol mit dem Gerätezustand über der Leuchte schwebt: automatisch, immer, ohne Watt oder gar nicht. Du kannst dem Symbol auch ein eigenes Icon geben.",
"The marker in 3D decides whether a small symbol with the device state also floats above the lamp: automatic, always, without watts, or not at all. You can also give the symbol an icon of your own.",
));
await r.spotAt({ label: "marker_show" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2);
await r.spot(null);
r.say(S(
"Das war die erste Leuchte. Genauso setzen wir die Stehlampe und das LED-Band aus der Liste.",
"That was the first light. In the same way we place the floor lamp and the LED strip from the list.",
));
await r.click({ text: L("‹ Zurück zu Wohnzimmer", "‹ Back to Living room") }).catch(() => {});
await toDevices();
await r.click({ key: "devices_place", near: "Stehlampe" });
await r.show(1.2);
await r.click({ key: "devices_place", near: "LED Band" });
await r.show(1.5);
await r.click({ key: "tool_select" });
await r.click({ key: "fit" });
await r.show(2);
// ------------------------------------------------------------------ electric furniture
await r.chapter({ en: "Furniture linked to devices", de: "Möbel mit Geräten verbinden" }, { en: "The TV as an example", de: "Der Fernseher als Beispiel" });
r.say(S(
"Nicht nur Leuchten lassen sich verbinden, auch Möbel. Wir wählen das TV-Board im Wohnzimmer aus.",
"It is not only lights that can be connected, furniture can be too. We select the TV board in the living room.",
));
const board = await plan(4.1, 4.2);
await r.click({ x: board.x, y: board.y });
await r.show(1);
r.say(S(
"Unter der Position steht „TV, Media Player oder Steckdose“. NextFloor hat im Bereich Wohnzimmer einen Fernseher gefunden und ihn automatisch verbunden, das siehst du an „Automatisch“. Läuft der Fernseher, leuchtet der Bildschirm im Modell in der Farbe der App, etwa Netflix rot oder YouTube, und zeigt Titel oder Cover.",
"Under the position there is “TV, media player or smart plug”. NextFloor found a TV in the area Wohnzimmer and connected it automatically, you can tell by “Automatic”. While the TV plays, the screen in the model glows in the colour of the app, for example Netflix red or YouTube, and shows the title or cover.",
));
await r.spotAt({ label: "furn_entity_tv" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2.5);
await r.spot(null);
r.say(S(
"„Leuchten hinter dem TV“ ist das Ambilight an der Wand hinter dem Fernseher. Hundert Prozent ist die volle Stärke. Passt es nicht zu deinem Wohnzimmer, zum Beispiel weil du hinter dem Fernseher eigene LED-Streifen hast, senkst du den Wert oder stellst ihn auf null, dann ist das Leuchten ganz aus.",
"“Glow behind the TV” is the ambilight on the wall behind the television. One hundred percent is full strength. If it does not suit your living room, for example because you have LED strips of your own behind the TV, lower the value or set it to zero, and the glow is off completely.",
));
await r.spotAt({ label: "ambilight" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2.5);
await r.spot(null);
r.say(S(
"Und der Leistungssensor, ebenfalls automatisch gefunden, zeigt später, wie viele Watt der Fernseher gerade zieht. Genauso funktionieren Kühlschränke, Waschmaschinen, Drucker und viele andere Möbel aus den Packs.",
"And the power sensor, also found automatically, later shows how many watts the TV draws right now. Fridges, washing machines, printers and many other pieces from the packs work the same way.",
));
await r.spotAt({ label: "furn_power" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2.5);
await r.spot(null);
}
+78
View File
@@ -0,0 +1,78 @@
export const title = { en: "Outdoor areas", de: "Außenflächen" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const plan = (x, z) => r.planPoint(x, z);
const t = (key) => r.t(key);
const area = async (x1, z1, x2, z2, type) => {
await r.click({ key: "tool_outdoor" });
await r.drag(await plan(x1, z1), await plan(x2, z2));
if (type) await r.choose({ label: "outdoor_type" }, t(type));
};
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
await r.chapter({ en: "Outdoor areas", de: "Außenflächen" }, { en: "Garden, terrace, path and pool", de: "Garten, Terrasse, Weg und Pool" });
r.say(S(
"Ein Haus steht nicht im Leeren. Mit dem Werkzeug „Außen“ zeichnest du die Flächen rund ums Haus: Rasen, Terrasse, Wege, Einfahrt, Pool, Beete, Hecken und Zäune.",
"A house does not stand in an empty space. With the “Outdoor” tool you draw the areas around the house: lawn, terrace, paths, driveway, pool, flower beds, hedges and fences.",
));
await r.click({ key: "tool_outdoor" });
r.say(S(
"Der Hinweis unten: Ziehen, um eine Außenfläche aufzuziehen. Wir beginnen mit dem Rasen links neben dem Haus.",
"The hint at the bottom: drag to draw an outdoor area. We start with the lawn to the left of the house.",
));
await r.drag(await plan(-3, 0), await plan(-0.4, 8));
await r.show(0.8);
r.say(S(
"Die Fläche ist ausgewählt, und rechts steht ihr Formular. Oben wählst du die Art. Die Standardart ist Rasen, das passt. Darunter stehen Position und Größe.",
"The area is selected and its form is on the right. At the top you choose the kind. The default kind is lawn, which fits. Below are position and size.",
));
await r.spotAt({ label: "outdoor_type" });
await r.show(1.5);
await r.spot(null);
r.say(S(
"„Höhenversatz“ senkt eine Fläche unter den Boden oder hebt sie an, zum Beispiel eine Einfahrt, die zu einer tiefer liegenden Garage führt, oder eine erhöhte Terrasse. „Gefälle“ neigt eine Fläche: Du gibst den Höhenunterschied ein und die Richtung, in die sie abfällt. „Umriss zeigen“ blendet die leuchtende Kante ein oder aus, und „Aus den Flächen darunter ausschneiden“ macht aus der Fläche ein Loch in den Flächen darunter, praktisch für einen Teich mitten im Rasen.",
"“Height offset” lowers an area below the ground or raises it, for example a driveway leading to a lower garage, or a raised terrace. “Slope” tilts an area: you enter the height difference and the direction it falls towards. “Show the outline” turns the glowing edge on or off, and “Cut out of the areas beneath” makes the area a hole in the areas below it, handy for a pond in the middle of a lawn.",
));
await r.spotUnion([{ label: "outdoor_offset" }, { label: "outdoor_slope" }]);
await r.show(2);
await r.spot(null);
r.say(S(
"Oberhalb des Hauses kommt die Terrasse. Wir ziehen sie auf und stellen die Art um.",
"Above the house comes the terrace. We drag it out and change the kind.",
));
await area(0.2, -3.2, 6, -0.4, "out_terrace");
await r.show(0.8);
r.say(S(
"Vor der Haustür führt ein Weg entlang. Ein Weg ist schmal, deshalb ziehen wir ihn schmal auf.",
"In front of the front door a path leads along. A path is narrow, so we draw it narrow.",
));
await area(7.1, 9.3, 8.1, 12, "out_path");
await r.show(0.8);
r.say(S(
"Rechts neben dem Haus legen wir einen Pool an.",
"To the right of the house we lay out a pool.",
));
await area(10.6, 5.2, 14.6, 9.2, "out_pool");
await r.show(0.8);
r.say(S(
"Außerdem ein Beet vor dem Rasen und eine Hecke, die den Garten begrenzt. Bei Hecken und Zäunen kannst du im Formular die Höhe einstellen, zum Beispiel zweieinhalb Meter für eine Thuja-Hecke.",
"Also a flower bed in front of the lawn and a hedge that borders the garden. For hedges and fences you can set the height in the form, for example two and a half metres for a thuja hedge.",
));
await area(-2.8, 8.4, -0.6, 9.4, "out_bed");
await r.show(0.6);
await r.click({ key: "tool_select" });
await r.click({ key: "fit" });
await r.show(1.5);
r.say(S(
"Außenflächen werden in 3D mit Rasen, Holz, Wasser und Stein dargestellt. Wie du Außenleuchten, zum Beispiel Wegleuchten und Gartenspots, aus der Möbelbibliothek dazusetzt, siehst du später im Kapitel über Leuchten.",
"In 3D outdoor areas are shown with grass, wood, water and stone. How to add outdoor lights, for example path lights and garden spots, from the furniture library you will see later in the chapter about lights.",
));
await r.show(2);
}
@@ -0,0 +1,137 @@
export const title = { en: "A second floor, stairs and 3D beside", de: "Obergeschoss, Treppe und 3D daneben" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const plan = (x, z) => r.planPoint(x, z);
const L = (de, en) => (r.lang === "de" ? de : en);
const names = { child: L("Kinderzimmer", "Kids' room"), study: L("Arbeitszimmer", "Study"), bath: L("Bad oben", "Upstairs bathroom"), guest: L("Gästezimmer", "Guest room") };
/** The floor tabs live in the floor form; with a room selected we step back to it first. */
const floorTab = async (name) => {
for (let i = 0; i < 4; i++) {
const tab = await r.locate({ text: name, css: undefined }).catch(() => null);
if (tab) return r.click({ text: name });
const back = await r.locate({ text: "‹" }).catch(() => null);
if (!back) break;
await r.click({ text: "‹" });
}
return r.click({ text: name });
};
const rect = async (x1, z1, x2, z2) => {
await r.click({ key: "tool_rect" });
await r.drag(await plan(x1, z1), await plan(x2, z2));
};
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
await r.chapter({ en: "A second floor", de: "Das Obergeschoss" }, { en: "Floors on top of each other", de: "Etagen übereinander" });
r.say(S(
"Ein Haus hat meist mehr als eine Etage. Wir legen das Obergeschoss an: „Etage hinzufügen“ und diesmal das Obergeschoss aus Home Assistant.",
"A house usually has more than one floor. We add the upper floor: “Add floor” and this time the Obergeschoss from Home Assistant.",
));
await r.click({ key: "add_floor" });
await r.click({ text: "Obergeschoss" });
await r.show(1);
r.say(S(
"NextFloor stellt die neue Etage automatisch auf die richtige Höhe, hier zwei Komma sieben fünf Meter über dem Erdgeschoss. Im Plan siehst du gestrichelt die Umrisse der Etage darunter. Daran richtest du die neuen Wände aus.",
"NextFloor puts the new floor at the right height automatically, here two point seven five metres above the ground floor. In the plan you see the outlines of the floor below, dashed. You align the new walls with them.",
));
await r.spotAt({ label: "elevation" });
await r.show(2);
await r.spot(null);
r.say(S(
"Mit den Etagen-Reitern oben wechselst du zwischen den Etagen. Die Reihenfolge ändern „Nach oben“ und „Nach unten“.",
"With the floor tabs at the top you switch between the floors. “Move up” and “Move down” change the order.",
));
await floorTab("Erdgeschoss");
await r.show(1);
await floorTab("Obergeschoss");
await r.show(0.8);
r.say(S(
"Jetzt zeichnen wir die Räume des Obergeschosses mit dem Rechteck, wie im Erdgeschoss: ein Kinderzimmer oben links, ein Arbeitszimmer daneben, ein Bad und ein Gästezimmer darunter.",
"Now we draw the rooms of the upper floor with the rectangle, as on the ground floor: a kids' room at the top left, a study next to it, a bathroom and a guest room below.",
));
await rect(0, 0, 4.4, 4.2);
await r.typeInto({ label: "room_name" }, names.child);
await r.choose({ label: "area" }, "Kinderzimmer");
await r.choose({ label: "floor" }, L("Teppich", "Carpet"));
await rect(4.4, 0, 10, 4.2);
await r.typeInto({ label: "room_name" }, names.study);
await r.choose({ label: "area" }, "Arbeitszimmer");
await r.choose({ label: "floor" }, L("Eiche", "Oak"));
await rect(0, 4.2, 3.4, 8);
await r.typeInto({ label: "room_name" }, names.bath);
await r.choose({ label: "floor" }, L("Fliesen", "Tiles"));
await rect(3.4, 4.2, 10, 8);
await r.typeInto({ label: "room_name" }, names.guest);
await r.show(1);
r.say(S(
"Das Bad oben und das Gästezimmer haben in Home Assistant keinen eigenen Bereich. Das ist kein Problem: Räume ohne Bereich funktionieren genauso, du kannst ihnen Geräte aber nur über „Andere Bereiche“ oder „Ohne Bereich“ zuordnen.",
"The bathroom upstairs and the guest room have no area of their own in Home Assistant. That is no problem: rooms without an area work the same way, you can only assign devices to them through “Other areas” or “No area”.",
));
await r.click({ key: "tool_select" });
await r.click({ key: "fit" });
await r.show(1.5);
// ------------------------------------------------------------------ stairs
await r.chapter({ en: "Stairs and floor openings", de: "Treppe und Bodenöffnung" }, { en: "Getting from floor to floor", de: "Von Etage zu Etage" });
r.say(S(
"Damit man nach oben kommt, brauchen wir eine Treppe. Wir wechseln ins Erdgeschoss, wählen den Flur und öffnen die Möbelbibliothek.",
"To get upstairs we need a staircase. We switch to the ground floor, choose the hallway and open the furniture library.",
));
await floorTab("Erdgeschoss");
await r.click({ key: "tool_furniture" });
const hall = await plan(9.3, 6.6);
await r.click({ x: hall.x, y: hall.y });
await r.show(0.8);
r.say(S(
"Im Pack „Treppen und Geländer“ finden wir gerade, L-förmige, U-förmige und Wendeltreppen, Raumspartreppen, eine Außentreppe und Geländer aus Metall, Glas und Holz. Wir nehmen die gerade Treppe.",
"In the pack “Stairs and railings” we find straight, L-shaped, U-shaped and spiral staircases, space-saving stairs, outdoor steps and railings in metal, glass and wood. We take the straight staircase.",
));
await r.click({ text: L("Treppen & Geländer", "Stairs & railings") });
await r.show(0.8);
await r.click({ text: L("Gerade Treppe", "Straight staircase") });
await r.show(1);
await r.typeInto({ label: "x" }, "9.2");
await r.typeInto({ label: "z" }, "6.5");
r.say(S(
"Die Stufen steigen von der Vorderkante nach hinten an. Reicht die Treppe bis zur Etage darüber, schneidet sie dort die Treppenöffnung automatisch in den Boden. Wir schauen im Obergeschoss nach.",
"The steps rise from the front edge towards the back. If the stairs reach the floor above, they cut the stairwell into the floor there automatically. We take a look at the upper floor.",
));
await r.click({ key: "tool_select" });
await floorTab("Obergeschoss");
await r.show(1.5);
r.say(S(
"Ein Loch im Boden brauchst du auch ohne Treppe, zum Beispiel für eine Galerie oder einen Schacht. Dafür gibt es das Werkzeug „Bodenöffnung“: Du ziehst die Öffnung einfach auf, wo der Boden fehlen soll.",
"You also need a hole in the floor without stairs, for example for a gallery or a shaft. For that there is the “Floor opening” tool: you simply drag out the opening where the floor should be missing.",
));
await r.click({ key: "tool_hole" });
await r.show(1.5);
await r.click({ key: "tool_select" });
await r.show(0.5);
// ------------------------------------------------------------------ 3D beside
await r.chapter({ en: "3D beside the plan", de: "3D neben dem Plan" }, { en: "Seeing the model while you draw", de: "Das Modell beim Zeichnen sehen" });
r.say(S(
"Wer beim Zeichnen sehen will, wie das Haus in 3D aussieht, schaltet „3D daneben“ ein. Der Editor zeigt dann links den Plan und rechts das 3D-Modell.",
"If you want to see how the house looks in 3D while you draw, switch on “3D beside”. The editor then shows the plan on the left and the 3D model on the right.",
));
await r.click({ key: "split_3d" });
await r.show(3);
r.say(S(
"Das Modell dreht sich mit der Maus: Ziehen dreht, das Mausrad zoomt, und mit rechter Maustaste oder zwei Fingern verschiebst du die Ansicht. Alles, was du im Plan änderst, siehst du sofort im Modell.",
"The model turns with the mouse: dragging rotates, the wheel zooms, and with the right mouse button or two fingers you move the view. Whatever you change in the plan you see in the model right away.",
));
await r.show(2.5);
r.say(S(
"Mit den Knöpfen „Ansicht als Start der Etage“ und „Ansicht als Start des Raums“ merkst du dir die aktuelle Blickrichtung. Tippst du die Etage oder den Raum später in 3D an, fliegt die Kamera genau dorthin.",
"With the buttons “View as this floor's start” and “View as this room's start” you remember the current viewing direction. When you tap the floor or the room in 3D later, the camera flies exactly there.",
));
await floorTab("Erdgeschoss");
await r.show(1.5);
await r.click({ key: "split_3d" });
await r.show(1);
}
+82
View File
@@ -0,0 +1,82 @@
export const title = { en: "Lights in detail", de: "Leuchten im Detail" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const plan = (x, z) => r.planPoint(x, z);
const L = (de, en) => (r.lang === "de" ? de : en);
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
await r.chapter({ en: "Lights in detail", de: "Leuchten im Detail" }, { en: "Lamp types, spots and outdoor lights", de: "Leuchtentypen, Spots und Außenleuchten" });
r.say(S(
"Leuchten sind in NextFloor eigene Möbelstücke mit einem Licht dahinter. In der Möbelbibliothek gibt es dafür einen eigenen Bereich mit zwölf Typen: Deckenleuchte, Einbauspot, Aufbauspot, LED-Panel, Pendelleuchte, Stehlampe, Deckenfluter, Tischlampe, Wandleuchte, LED-Streifen, Wegeleuchte und Gartenspot.",
"In NextFloor lights are pieces of furniture of their own with a light behind them. In the furniture library there is a section of its own with twelve types: ceiling light, downlight, surface spot, LED panel, pendant light, floor lamp, floor uplight, table lamp, wall light, LED strip, path light and garden spot.",
));
await r.click({ key: "tool_furniture" });
const room = await plan(1, 1);
await r.click({ x: room.x, y: room.y });
await r.spotAt({ text: L("Leuchten", "Lights") }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2.5);
await r.spot(null);
r.say(S(
"Jeder Typ hat seine eigene Bauform und leuchtet anders. Die Deckenleuchte und der Spot sitzen an der Decke, die Stehlampe steht auf dem Boden, die Tischlampe auf einem Möbel, die Wandleuchte an der Wand. Pendelleuchten hängen an einer Schnur. Die Höhe stellst du im Formular ein, bei der Pendelleuchte ist sie die Abhängung unter der Decke.",
"Every type has its own shape and glows differently. The ceiling light and the spot sit on the ceiling, the floor lamp stands on the floor, the table lamp on a piece of furniture, the wall light on the wall. Pendant lights hang on a cord. You set the height in the form; for the pendant light it is the drop below the ceiling.",
));
await r.show(2);
// ------------------------------------------------------------------ spots
await r.chapter({ en: "A grid of spots", de: "Ein Raster aus Spots" }, { en: "Many lamps, one light", de: "Viele Leuchten, ein Licht" });
r.say(S(
"Oft hängen mehrere Einbauspots an einem Dimmer. Dafür musst du sie nicht einzeln setzen. Wir wählen die Küche aus und klicken auf „Spots setzen“.",
"Often several downlights hang on one dimmer. You do not have to place them one by one. We select the kitchen and click “Place spots”.",
));
await r.click({ key: "tool_select" });
const kitchen = await plan(8, 2);
await r.click({ x: kitchen.x, y: kitchen.y });
await r.click({ key: "spots_place" });
await r.show(1);
r.say(S(
"Du wählst die Art der Leuchte, die Zahl der Spalten und Reihen und das Licht, dem alle folgen sollen. NextFloor verteilt die Leuchten gleichmäßig im Raum. Wir nehmen Einbauspots, drei Spalten, zwei Reihen und das Küchenlicht.",
"You choose the kind of lamp, the number of columns and rows, and the light that all of them follow. NextFloor spreads the lamps evenly across the room. We take downlights, three columns, two rows and the kitchen light.",
));
await r.typeInto({ label: "spots_cols" }, "3");
await r.typeInto({ label: "spots_rows" }, "2");
await r.pick("furn_entity_light", "Küchenl", L("Küchenlicht · Küche", "Küchenlicht · Küche"));
await r.show(1);
await r.click({ text: r.t("spots_add", { n: 6 }) });
await r.show(1.5);
r.say(S(
"Sechs Spots, ein Licht: Schaltest du das Küchenlicht, leuchten alle sechs. Mit „Rückgängig“ nimmst du die Aktion auf einen Schlag zurück, falls das Raster nicht passt.",
"Six spots, one light: when you switch the kitchen light, all six glow. With “Undo” you take the action back in one go if the grid does not fit.",
));
await r.show(1.5);
// ------------------------------------------------------------------ outdoor
await r.chapter({ en: "Outdoor lights", de: "Außenleuchten" }, { en: "Path lights and garden spots", de: "Wegeleuchten und Gartenspots" });
r.say(S(
"Außenleuchten gehören nicht zu einem Raum. Wir holen sie über den Raum-Abschnitt „Geräte“ mit dem Reiter „Ohne Bereich“, denn Gartenlichter haben in Home Assistant meist keinen Bereich. Dazu wählen wir einen beliebigen Raum aus, zum Beispiel das Wohnzimmer.",
"Outdoor lights do not belong to a room. We fetch them through the “Devices” section of the room with the “No area” tab, because garden lights usually have no area in Home Assistant. For that we select any room, for example the living room.",
));
const living = await plan(1, 4);
await r.click({ x: living.x, y: living.y });
await r.eval(`(() => { const d = (root) => { for (const el of root.querySelectorAll("*")) { if (el.tagName === "H3" && /^(Devices|Geräte)$/.test(el.textContent.trim())) { el.scrollIntoView({ block: "start" }); return true; } if (el.shadowRoot && d(el.shadowRoot)) return true; } return false; }; return d(document); })()`);
await r.click({ text: L("Ohne Bereich", "No area") });
await r.show(1);
r.say(S(
"Hier stehen die Wegeleuchten und der Pool-Spot. Wir platzieren die Wegeleuchten und ziehen sie danach an den Weg vor der Haustür.",
"Here are the path lights and the pool spot. We place the path lights and then drag them to the path in front of the front door.",
));
await r.click({ key: "devices_place", near: "Garten Wegleuchten" });
await r.show(1);
await r.show(0.5);
r.say(S(
"Außenleuchten beleuchten die Außenflächen und die Fassade. Das ist in 3D besonders schön, wenn es dunkel wird.",
"Outdoor lights light the outdoor areas and the facade. That looks especially good in 3D when it gets dark.",
));
await r.click({ key: "tool_select" });
await r.click({ key: "fit" });
await r.show(2);
}
@@ -0,0 +1,97 @@
export const title = { en: "The roof and solar power", de: "Dach und Solarstrom" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const plan = (x, z) => r.planPoint(x, z);
const L = (de, en) => (r.lang === "de" ? de : en);
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
await r.chapter({ en: "The roof", de: "Das Dach" }, { en: "From the rooms to a roof", de: "Von den Räumen zum Dach" });
r.say(S(
"Ein Haus braucht ein Dach, und für Solarmodule ganz besonders. Das Werkzeug „Dach“ baut es aus deinen Räumen. Wir wählen es aus.",
"A house needs a roof, and for solar modules especially. The “Roof” tool builds it from your rooms. We select it.",
));
await r.click({ key: "tool_roof" });
await r.show(1.2);
r.say(S(
"Der Editor schaltet dabei von selbst die 3D-Ansicht daneben dazu, denn ein Dach beurteilt man am besten in 3D. Im Plan sind Räume und Möbel gesperrt, damit du nichts verschiebst: Du bearbeitest nur Dachflächen.",
"The editor switches on the 3D view beside the plan by itself, because a roof is best judged in 3D. In the plan, rooms and furniture are locked so that you do not move anything: you only edit roof sections.",
));
await r.show(2);
r.say(S(
"Wir klicken auf „Dachflächen aus den Räumen erzeugen“. NextFloor schlägt zu jeder zusammenhängenden Gebäudeteil-Fläche ein Dach vor, hier ein großes Satteldach über dem Haus und ein kleines über dem Anbau.",
"We click “Create roof sections from the rooms”. NextFloor proposes a roof for every connected part of the building, here a large gable roof over the house and a small one over the extension.",
));
await r.click({ key: "roof_sections_start" });
await r.show(2);
r.say(S(
"Jede Dachfläche hat Form, Firstrichtung, Traufhöhe und Neigung. Ein Klick auf einen Eintrag in der Liste wählt sie aus, ziehen verschiebt sie, und an den Ecken änderst du die Größe. Mit „Zurück zu einem Dach“ gehst du zur einfachen Dachform aus den Einstellungen zurück, und „Erneut aus den Räumen erzeugen“ beginnt von vorn.",
"Every section has a shape, ridge direction, eave height and pitch. A click on an entry in the list selects it, dragging moves it, and at the corners you change the size. “Back to one roof” returns to the simple roof shape from the settings, and “Create again from the rooms” starts over.",
));
await r.spotAt({ key: "roof_sections_off" });
await r.show(2.5);
await r.spot(null);
r.say(S(
"Dachfenster setzt du mit „Dachfenster“ auf eine Dachfläche. Sie bekommen wie normale Fenster einen Rollladen und einen Kontakt.",
"You put roof windows on a roof section with “Roof window”. Like normal windows they get a blind and a contact.",
));
await r.spotAt({ text: "+ Roof window" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2);
await r.spot(null);
// ------------------------------------------------------------------ energy
await r.chapter({ en: "Solar power and energy", de: "Solarstrom und Energie" }, { en: "Fields, meter and inverter", de: "Felder, Zähler und Wechselrichter" });
r.say(S(
"Jetzt kommt die Energie. Das Werkzeug „Energie“ zeigt oben eine Einrichtungs-Checkliste: Solarfeld auf das Dach setzen, Zähler hinzufügen, Wechselrichter hinzufügen. Home-Batterie und Netzanschluss sind optional.",
"Now for the energy. The “Energy” tool shows a setup checklist at the top: put a solar field on the roof, add the meter, add an inverter. Home battery and grid connection are optional.",
));
await r.click({ key: "tool_energy" });
await r.show(2);
r.say(S(
"Wir beginnen mit dem Solarfeld. „Solarfeld“ legt ein Feld auf die am besten passende Dachfläche, nämlich die größte, die nach Süden schaut. Dafür nutzt NextFloor den Kompass aus den Einstellungen. Stimmt der Kompass nicht, wird das Feld auf der falschen Seite angelegt. Dazu kommen wir gleich.",
"We begin with the solar field. “Solar field” puts a field on the best-fitting roof section, the largest one that looks south. For this NextFloor uses the compass from the settings. If the compass is wrong, the field is placed on the wrong side. We will get to that in a moment.",
));
await r.click({ text: "+ Solar field" });
await r.show(2.5);
r.say(S(
"Das Feld liegt in der Dachneigung. Du ziehst es im Plan an eine andere Stelle, auch auf eine andere Dachfläche. Rechts stellst du Reihen und Spalten, Hoch- oder Querformat und die Zahl der Module ein. Für Felder auf Flachdächern oder im Garten gibt es „Freistehend“ mit Neigung, und „An der Wand“ für Fassadenmodule.",
"The field lies in the slope of the roof. You drag it in the plan to another place, even onto another roof section. On the right you set rows and columns, portrait or landscape and the number of modules. For fields on flat roofs or in the garden there is “Free-standing” with a tilt, and “On a wall” for facade modules.",
));
await r.show(2.5);
r.say(S(
"Jetzt der Stromzähler und der Wechselrichter. Beide sind Geräte und stehen unter „Geräte“ der Energie-Seite. Wir fügen den Zähler und den Wechselrichter hinzu.",
"Now the electricity meter and the inverter. Both are devices and are listed under “Devices” on the energy page. We add the meter and the inverter.",
));
const back = await r.locate({ text: "‹" }).catch(() => null);
if (back) await r.click({ text: "‹" });
await r.click({ text: "+ " + r.t("furn_meter") });
await r.show(1.5);
const back2 = await r.locate({ text: "‹" }).catch(() => null);
if (back2) await r.click({ text: "‹" });
await r.click({ text: "+ " + r.t("furn_inverter") });
await r.show(1.5);
r.say(S(
"Die Geräte stehen in der Etage, die oben gewählt ist, und lassen sich im Plan verschieben. Mit einem Leistungssensor zeigen sie ihre Watt, der Zähler nimmt den Netzsensor, und ein Wechselrichter bekommt seine Strings.",
"The devices stand on the floor chosen at the top and can be moved in the plan. With a power sensor they show their watts, the meter takes the grid sensor, and an inverter gets its strings.",
));
await r.show(2);
r.say(S(
"Ganz unten steht die Energiebilanz mit Feldern für Netz, Solarproduktion, Batterie, Verbrauch und Tarif. Alle stehen auf „Automatisch“. Mit „Aus dem Energie-Dashboard übernehmen“ liest NextFloor die Sensoren, die du in Home Assistant schon für das Energie-Dashboard eingerichtet hast.",
"At the bottom is the energy balance with fields for grid, solar production, battery, consumption and tariff. All are on “Automatic”. “Take over from the energy dashboard” reads the sensors you have already set up for the energy dashboard in Home Assistant.",
));
const back3 = await r.locate({ text: "‹" }).catch(() => null);
if (back3) await r.click({ text: "‹" });
await r.spotAt({ text: "Take over from the energy dashboard" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2.5);
await r.spot(null);
r.say(S(
"In der 3D-Ansicht fliegen später Energieteilchen von den Solarmodulen zum Wechselrichter, zum Haus, zum Akku und zum Netz, schneller und dichter, je mehr Strom fließt.",
"In the 3D view, energy particles later fly from the solar modules to the inverter, the house, the battery and the grid, faster and denser the more power flows.",
));
await r.show(2);
await r.click({ key: "tool_select" });
}
+109
View File
@@ -0,0 +1,109 @@
export const title = { en: "Settings, compass and map", de: "Einstellungen, Kompass und Karte" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const L = (de, en) => (r.lang === "de" ? de : en);
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
const backToFloor = async () => {
for (let i = 0; i < 3; i++) {
const back = await r.locate({ text: "‹" }).catch(() => null);
if (!back) break;
await r.click({ text: "‹" });
}
};
await backToFloor();
await r.chapter({ en: "Settings", de: "Einstellungen" }, { en: "Walls, grid, compass and map", de: "Wände, Raster, Kompass und Karte" });
r.say(S(
"In der Seitenleiste stehen weiter unten die Einstellungen für das ganze Haus. Wir klappen sie auf.",
"Further down the side panel are the settings for the whole house. We unfold them.",
));
await r.click({ key: "settings" });
await r.show(1);
r.say(S(
"Zuerst die Wanddicken. Außenwände sind standardmäßig vierundzwanzig Zentimeter dick, Innenwände zwölf. Das Raster ist die Schrittweite, auf die beim Zeichnen eingerastet wird, fünf Zentimeter. Mit der Alt-Taste zeichnest du einmalig ohne Einrasten.",
"First the wall thicknesses. Exterior walls are twenty-four centimetres thick by default, interior walls twelve. The grid is the step the drawing snaps to, five centimetres. With the Alt key you draw without snapping for a moment.",
));
await r.spotUnion([{ label: "wall_exterior" }, { label: "grid" }]);
await r.show(2.5);
await r.spot(null);
// ------------------------------------------------------------------ compass
await r.chapter({ en: "The compass", de: "Der Kompass" }, { en: "Fixing north and south", de: "Nord und Süd richtigstellen" });
r.say(S(
"Jetzt der Kompass, ein wichtiger Punkt. Die Scheibe zeigt, wo Norden im Plan liegt. Der Plan hat kein eigenes Norden: Standardmäßig zeigt Norden im Plan nach oben. Davon hängen drei Dinge ab: das Sonnenlicht, das durch die Fenster fällt, die Windrichtung bei Wetter und die Himmelsrichtungen der Dachflächen. Und damit auch, wo ein neues Solarfeld hinkommt.",
"Now the compass, an important point. The dial shows where north lies in the plan. The plan has no north of its own: by default north points up in the plan. Three things depend on it: the sunlight falling through the windows, the wind direction in the weather, and the compass directions of the roof sections. And with that, where a new solar field goes.",
));
await r.spotAt({ css: ".nf-compass" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(3);
await r.spot(null);
r.say(S(
"Hast du den Plan so gezeichnet, dass oben nicht Norden ist, oder stimmen Nord und Süd nicht mit der Wirklichkeit überein, musst du nichts neu zeichnen und keine Solarfelder neu anlegen. Du drehst einfach den Kompass. „Nord und Süd tauschen“ dreht ihn um hundertachtzig Grad. Wir probieren es.",
"If you drew the plan with north not at the top, or if north and south do not match reality, you do not have to redraw anything or place the solar fields again. You simply turn the compass. “Swap north and south” turns it by one hundred and eighty degrees. We try it.",
));
await r.click({ key: "compass_swap" });
await r.show(2.5);
r.say(S(
"Der Pfeil zeigt jetzt nach unten. Zeichnung, Dachflächen und Solarfelder sind unverändert. Geändert haben sich nur die Himmelsrichtungen: Was eben noch Süden war, ist jetzt Norden. Mit den Knöpfen für neunzig Grad drehst du in kleineren Schritten, und im Feld darüber gibst du jeden beliebigen Winkel ein.",
"The arrow now points down. The drawing, roof sections and solar fields are unchanged. Only the compass directions have changed: what was south a moment ago is now north. With the ninety degree buttons you turn in smaller steps, and in the field above you enter any angle you like.",
));
await r.show(2);
await r.click({ key: "compass_swap" });
await r.show(1.5);
r.say(S(
"Wir drehen den Kompass für unser Haus wieder zurück, denn hier stimmt er.",
"We turn the compass back for our house, because here it is right.",
));
await r.show(0.5);
// ------------------------------------------------------------------ map
await r.chapter({ en: "A real map under the plan", de: "Eine echte Karte unter dem Plan" }, { en: "Placing the house on its plot", de: "Das Haus auf sein Grundstück setzen" });
r.say(S(
"Darunter kannst du eine echte Landkarte hinter den Plan legen, um das Haus genau auf sein Grundstück zu setzen. Die Karte ist standardmäßig aus und lädt dann auch nichts aus dem Internet. Wir schalten sie ein.",
"Below that you can put a real map behind the plan, to place the house exactly on its plot. The map is off by default and then loads nothing from the internet. We switch it on.",
));
await r.click({ key: "map_on" });
await r.show(3);
r.say(S(
"Die Karte startet am Standort von Home Assistant, im Plan und im 3D-Modell. Dein Browser lädt die Kartenkacheln direkt vom Kartenserver, standardmäßig OpenStreetMap. Unten rechts steht der Quellenhinweis. Die Karte ist gedimmt, damit der Plan im Vordergrund bleibt.",
"The map starts at the location of Home Assistant, in the plan and in the 3D model. Your browser loads the map tiles straight from the map server, OpenStreetMap by default. The credit is shown at the bottom right. The map is dimmed so that the plan stays in the foreground.",
));
await r.show(2);
r.say(S(
"Mit „Sichtbarkeit“ stellst du ein, wie stark die Karte durchscheint, und die Detailstufe bestimmt die Schärfe. Mit den Pfeilknöpfen verschiebst du die Karte unter dem Plan, bis das Haus auf seinem Grundstück sitzt. Der Schritt darunter legt fest, wie weit ein Klick schiebt. Mit dem Kompass drehst du die Karte, falls das Haus schräg steht.",
"With “Visibility” you set how much the map shows through, and the detail level decides the sharpness. With the arrow buttons you move the map under the plan until the house sits on its plot. The step below sets how far one click moves it. With the compass you turn the map if the house is at an angle.",
));
await r.spotAt({ key: "map_move" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(1.5);
await r.spot(null);
await r.click({ text: "▶" });
await r.click({ text: "▼" });
await r.show(1);
r.say(S(
"Du kannst auch eine eigene Kachel-Adresse eintragen, wenn du eine andere Kartenquelle nutzen darfst. Für unser Beispiel schalten wir die Karte wieder aus.",
"You can also enter a tile address of your own if you may use another map source. For our example we switch the map off again.",
));
await r.click({ key: "map_on" });
await r.show(1.5);
// ------------------------------------------------------------------ more settings
await r.chapter({ en: "Roof, weather and more", de: "Dach, Wetter und mehr" }, { en: "The rest of the settings", de: "Der Rest der Einstellungen" });
r.say(S(
"Weiter unten wählst du die Dachform für das ganze Haus, kein Dach, Flachdach, Satteldach oder eigene Dachflächen, mit Neigung und Überstand.",
"Further down you pick the roof shape for the whole house: no roof, flat roof, gable roof or sections of your own, with pitch and overhang.",
));
await r.spotAt({ label: "roof" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2);
await r.spot(null);
r.say(S(
"Das Wetter-Gerät bestimmt, welche Wetter-Entity das Wetter am Haus steuert, und darunter schaltest du die Effekte einzeln ein oder aus: Regen, Schnee, Nebel, Wolken, Blitze, Sonne und Mond. Die Warnung „Fenster offen bei Regen“ und die Sonnenflecken durch die Fenster stellst du hier ebenfalls ein.",
"The weather entity decides which weather entity drives the weather at the house, and below it you switch the effects on or off one by one: rain, snow, fog, clouds, lightning, sun and moon. The warning “window open while it rains” and the sunlight patches through the windows are also set here.",
));
await r.spotAt({ label: "weather_entity" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2.5);
await r.spot(null);
}
@@ -0,0 +1,67 @@
export const title = { en: "Favourites, own buttons and warnings", de: "Favoriten, eigene Knöpfe und Warnungen" };
export const query = "alerts";
const S = (de, en) => ({ de, en });
export async function run(r) {
const L = (de, en) => (r.lang === "de" ? de : en);
const wait = (ms) => new Promise((ok) => setTimeout(ok, ms));
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
for (let i = 0; i < 3; i++) {
const back = await r.locate({ text: "‹" }).catch(() => null);
if (!back) break;
await r.quietClick({ text: "‹" });
}
await r.chapter({ en: "Favourites and own buttons", de: "Favoriten und eigene Knöpfe" }, { en: "The central menu", de: "Das Zentralmenü" });
r.say(S(
"Im Zentralmenü der 3D-Ansicht stehen unter den Sammelschaltern deine Favoriten. Welche das sind, legst du in den Editor-Einstellungen unter „Favoriten“ fest. Wir klappen den Abschnitt auf.",
"In the central menu of the 3D view your favourites stand below the group switches. Which ones they are you set in the editor settings under “Favourites”. We unfold the section.",
));
await r.click({ key: "favorites" });
await r.show(1.5, 800);
r.say(S(
"Favoriten können Szenen, Skripte, Automationen, Schalter und Buttons sein, zum Beispiel „Gute Nacht“. Du suchst sie im Feld „Favorit hinzufügen“ und klickst auf einen Treffer.",
"Favourites can be scenes, scripts, automations, switches and buttons, for example “Gute Nacht”. You search for them in the field “Add a favourite” and click a hit.",
));
await r.pick("favorites_add", "Gute", null).catch((e) => console.log(" [skipped]", e.message));
await r.show(2, 800);
r.say(S(
"Mit „Eigener Knopf“ legst du einen Knopf an, der einen Dashboard-Pfad öffnet, die Details einer Entity zeigt, einen Dienst aufruft oder ein browser_mod-Popup mit deiner eigenen Karte öffnet. Du gibst ihm einen Namen, ein Symbol und das Ziel, zum Beispiel einen Pfad zum Rollladen-Dashboard.",
"With “Own button” you create a button that opens a dashboard path, shows the details of an entity, calls a service or opens a browser_mod popup with your own card. You give it a name, a symbol and the target, for example a path to the blinds dashboard.",
));
await r.click({ text: "+ " + L("Eigener Knopf", "Own button") }).catch((e) => console.log(" [skipped]", e.message));
await r.show(2.5, 800);
r.say(S(
"„Station oder Playlist“ im Abschnitt Klang legt Radiosender und Playlists fest, die im Schnellmenü eines Lautsprechers zum Starten stehen.",
"“Station or playlist” in the Sound section sets radio stations and playlists that are offered for starting in the quick menu of a speaker.",
));
await r.spotAt({ text: "+ " + L("Sender oder Playlist", "Station or playlist") }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2.5);
await r.spot(null);
await r.chapter({ en: "Warnings and scenes", de: "Warnungen und Szenen" }, { en: "When something needs your attention", de: "Wenn etwas deine Aufmerksamkeit braucht" });
await r.click({ text: "3D" });
await wait(4000);
r.say(S(
"Wechseln wir in die 3D-Ansicht. Oben stehen jetzt Warnungen. NextFloor überwacht Rauch, Gas, CO, Wasser, Alarmanlage und Fenster, die bei Regen offen stehen. Hier meldet die Küche Rauch, und mehrere Fenster stehen offen, während es regnet.",
"Let us switch to the 3D view. Warnings now show at the top. NextFloor watches smoke, gas, CO, water, alarm panel and windows that are open in the rain. Here the kitchen reports smoke, and several windows are open while it rains.",
));
await r.show(4, 2500);
r.say(S(
"Der betroffene Raum pulsiert rot. Ein Tippen auf die Warnung springt in den Raum. So siehst du sofort, wo etwas los ist, auch in einem großen Haus.",
"The room concerned pulses red. A tap on the warning jumps into the room. That way you see at once where something is going on, even in a big house.",
));
await r.show(2.5);
r.say(S(
"Im Raum-Fenster stehen außerdem Szenen und Skripte des Bereichs als Knöpfe, zum Beispiel „Kino“ oder „Lesen“ im Wohnzimmer. Ein Klick startet die Szene, und das Haus verändert sich sofort.",
"In the room panel scenes and scripts of the area also stand as buttons, for example “Kino” or “Lesen” in the living room. One click starts the scene, and the house changes at once.",
));
await r.click({ text: "Erdgeschoss", nth: 0 });
await r.show(1.5, 1500);
await r.click({ text: L("Wohnzimmer", "Living room") });
await r.show(3, 2500);
}
@@ -0,0 +1,129 @@
export const title = { en: "The 3D view", de: "Die 3D-Ansicht" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const L = (de, en) => (r.lang === "de" ? de : en);
await r.chapter({ en: "The 3D view", de: "Die 3D-Ansicht" }, { en: "Your house, alive", de: "Dein Haus, lebendig" });
r.say(S(
"Der Plan ist fertig. Wir wechseln jetzt auf den Reiter „3D“ und sehen uns an, was daraus geworden ist.",
"The plan is done. Now we switch to the “3D” tab and look at what has become of it.",
));
await r.click({ text: "3D" });
await r.show(3, 3500);
r.say(S(
"Das ist dein Haus als lebendiges Modell: das Dach mit den Solarmodulen, die Terrasse, der Pool und der Weg. In den Räumen leuchten die Lampen, und im Wohnzimmer läuft gerade der Fernseher mit einer Serie. Alles, was du in Home Assistant einrichtest, siehst du hier live.",
"This is your house as a living model: the roof with the solar modules, the terrace, the pool and the path. In the rooms the lamps glow, and in the living room the TV is playing a series right now. Everything you set up in Home Assistant you see here, live.",
));
await r.show(2);
// ------------------------------------------------------------------ moving around
await r.chapter({ en: "Moving around", de: "Sich bewegen" }, { en: "Turning, zooming, flying to a room", de: "Drehen, Zoomen, zu einem Raum fliegen" });
r.say(S(
"Du bewegst dich mit der Maus. Ziehen mit der linken Taste dreht das Haus. Wir drehen es einmal ein Stück.",
"You move around with the mouse. Dragging with the left button turns the house. We turn it a little.",
));
await r.drag({ x: 760, y: 520 }, { x: 560, y: 470 }, { frames: 14 });
await r.show(1);
r.say(S(
"Das Mausrad zoomt hinein und heraus, und mit der rechten Maustaste, oder auf dem Touchscreen mit zwei Fingern, verschiebst du die Ansicht. Auf einem Tablet zoomst du mit zwei Fingern.",
"The mouse wheel zooms in and out, and with the right mouse button, or with two fingers on a touch screen, you move the view. On a tablet you zoom with two fingers.",
));
await r.page.mouse.move(640, 400);
for (let i = 0; i < 4; i++) {
await r.page.mouse.wheel({ deltaY: -250 });
await new Promise((ok) => setTimeout(ok, 500));
await r.frame();
}
await r.show(1);
for (let i = 0; i < 4; i++) {
await r.page.mouse.wheel({ deltaY: 250 });
await new Promise((ok) => setTimeout(ok, 500));
await r.frame();
}
await r.show(0.8);
r.say(S(
"Oben stehen die Etagen und Räume als Knöpfe. „Alle Etagen“ zeigt das ganze Haus. Ein Klick auf eine Etage lässt die Kamera dorthin fliegen und blendet die Etagen darüber aus. Wir wählen das Erdgeschoss.",
"At the top the floors and rooms are shown as buttons. “All floors” shows the whole house. A click on a floor makes the camera fly there and hides the floors above it. We choose the ground floor.",
));
await r.click({ text: "Erdgeschoss", nth: 0, css: undefined });
await r.show(2.5, 1500);
r.say(S(
"Ein Klick auf einen Raum fliegt hinein. Wir nehmen das Wohnzimmer. Rechts öffnet sich das Raum-Fenster mit den Geräten dieses Raums. Dazu gleich mehr.",
"A click on a room flies in. We take the living room. On the right the room panel opens with the devices of this room. More on that in a moment.",
));
await r.click({ text: L("Wohnzimmer", "Living room") });
await r.show(3, 2000);
r.say(S(
"Links am Rand siehst du kleine Bilder der Etagen. Ein Klick darauf wechselt die Etage, auch ohne die Leiste oben. „Zurück“ unten bringt dich eine Ebene hoch, und die Escape-Taste tut dasselbe.",
"On the left edge you see small pictures of the floors. A click on them switches the floor, even without the bar at the top. “Back” at the bottom takes you one level up, and the Escape key does the same.",
));
await r.click({ text: L("Zurück", "Back") }).catch(() => {});
await r.show(2, 1500);
await r.click({ text: L("Alle Etagen", "All floors"), nth: 0 });
await r.show(2, 1500);
// ------------------------------------------------------------------ the looks
await r.chapter({ en: "Looks and display", de: "Aussehen und Anzeige" }, { en: "Themes, quality and markers", de: "Themen, Qualität und Symbole" });
r.say(S(
"Oben rechts stellst du das Aussehen ein. Die Qualität ist „Automatisch“: NextFloor wählt selbst, was dein Gerät schafft. Für Wandtablets gibt es „Tablet“ mit weniger Effekten und für starke Rechner „Hoch“ mit Lichtkegeln und weichen Schatten. Ganz rechts zeigt „FPS“ die Bildrate.",
"At the top right you set the look. The quality is “Auto”: NextFloor decides by itself what your device can handle. For wall tablets there is “Tablet” with fewer effects, and for powerful computers “High” with light cones and soft shadows. Far right “FPS” shows the frame rate.",
));
await r.spotUnion([{ text: "Auto" }, { text: "High" }]);
await r.show(2.5);
await r.spot(null);
r.say(S(
"Daneben die Themen: „Neon“ ist der leuchtende Look, „Blueprint“ wirkt wie ein Bauplan, und „Tag“ ist hell und eignet sich für helle Räume. Der Farbpunkt dahinter ändert die Akzentfarbe. Wir sehen uns alle drei an.",
"Next to it the themes: “Neon” is the glowing look, “Blueprint” looks like a construction plan, and “Day” is bright and suits light rooms. The colour dot behind it changes the accent colour. We look at all three.",
));
await r.click({ text: "Blueprint" });
await r.show(2.5, 1200);
await r.click({ text: "Day" });
await r.show(2.5, 1200);
await r.click({ text: "Neon" });
await r.show(1.5, 1200);
r.say(S(
"Die drei Knöpfe daneben bestimmen, welche Symbole über den Geräten schweben. „Keine“ blendet sie aus, „Wichtige“ zeigt nur die wichtigen, zum Beispiel offene Fenster, und „Alle“ zeigt alle Geräte mit ihrem Zustand.",
"The three buttons next to it decide which symbols float above the devices. “None” hides them, “Important” shows only the important ones, for example open windows, and “All” shows all devices with their state.",
));
await r.click({ text: L("Alle", "All"), nth: 0 });
await r.show(2.5, 1200);
await r.click({ text: L("Wichtige", "Important") });
await r.show(1.2, 1000);
// ------------------------------------------------------------------ bottom switches
await r.chapter({ en: "The switches at the bottom", de: "Die Schalter unten" }, { en: "Walls, floors, roof and heat map", de: "Wände, Etagen, Dach und Heatmap" });
r.say(S(
"Unten sitzen die wichtigsten Schalter. „Hohe Wände“ und „Schnitt“ legen fest, ob du die Wände ganz siehst oder in Brüsthöhe abgeschnitten, damit du in die Räume hineinsehen kannst.",
"At the bottom are the most important switches. “Tall walls” and “Cut” decide whether you see the walls complete or cut off at chest height so that you can see into the rooms.",
));
await r.click({ text: "Cut" });
await r.show(2.5, 1500);
await r.click({ text: L("Hohe Wände", "Tall walls") });
await r.show(1.2, 1200);
r.say(S(
"„Auseinander“ zieht die Etagen für den Überblick auseinander, „Gestapelt“ setzt sie wieder aufeinander, und „Dach bleibt“ hält das Dach auch dann, wenn du in eine Etage hineinzoomst.",
"“Apart” pulls the floors apart for an overview, “Stacked” puts them on top of each other again, and “Roof stays” keeps the roof even when you zoom into a floor.",
));
await r.click({ text: "Stacked" });
await r.show(2.5, 1500);
await r.click({ text: "Apart" });
await r.show(1.5, 1500);
r.say(S(
"Die Heatmap färbt die Räume nach Messwerten ein: „Temperatur“, „Feuchte“ und „CO₂“. „Werte“ schreibt die Zahlen in die Räume. Eine Legende zeigt die Farbskala. Wir sehen uns die Temperatur an.",
"The heat map colours the rooms by measured values: “Temp.”, “Humidity” and “CO₂”. “Values” writes the numbers into the rooms. A legend shows the colour scale. We look at the temperature.",
));
await r.click({ text: "Temp." });
await r.show(3, 1500);
await r.click({ text: "Normal" });
await r.show(1, 1000);
r.say(S(
"„Raumnamen“ blendet die Namen der Räume ein, und „Wetter“ schaltet die Wettereffekte am Haus ein oder aus. Darauf kommen wir bei den Live-Funktionen zurück.",
"“Room names” shows the names of the rooms, and “Weather” switches the weather effects at the house on or off. We come back to that with the live features.",
));
await r.click({ text: "Room names" });
await r.show(2, 1000);
await r.click({ text: "Room names" });
await r.show(1, 800);
}
@@ -0,0 +1,104 @@
export const title = { en: "Controlling the house", de: "Das Haus bedienen" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const L = (de, en) => (r.lang === "de" ? de : en);
await r.quietClick({ text: "3D" });
await new Promise((ok) => setTimeout(ok, 3000));
await r.quietClick({ text: "Erdgeschoss", nth: 0 });
await new Promise((ok) => setTimeout(ok, 2500));
await r.chapter({ en: "The room panel", de: "Das Raum-Fenster" }, { en: "Lights, blinds and media of a room", de: "Lichter, Rollläden und Medien eines Raums" });
r.say(S(
"Jetzt bedienen wir das Haus. Dazu fliegen wir ins Wohnzimmer.",
"Now we control the house. To do that we fly into the living room.",
));
await r.click({ text: L("Wohnzimmer", "Living room") });
await r.show(3, 2500);
r.say(S(
"Rechts steht das Raum-Fenster. Es zeigt alle Geräte des Raums nach Art geordnet: Lichter, Rollläden, Medien und Sensoren. Wichtig für dieses Video: Wir arbeiten hier in der Demo mit erfundenen Geräten, deshalb darf alles geschaltet werden. In deinem echten Home Assistant schaltet ein Klick das echte Gerät.",
"On the right is the room panel. It shows all devices of the room sorted by kind: lights, blinds, media and sensors. Important for this video: here in the demo we work with invented devices, so everything may be switched. In your real Home Assistant a click switches the real device.",
));
await r.show(2);
r.say(S(
"Bei den Lichtern schaltet ein Klick auf den Namen das Licht ein oder aus. Wir schalten die Stehlampe aus.",
"For the lights a click on the name switches the light on or off. We switch the floor lamp off.",
));
await r.click({ css: "button", text: "Stehlampe", nth: 0 });
await r.show(2, 1200);
r.say(S(
"Darunter stellst du die Helligkeit und die Farbtemperatur mit Reglern ein, und die Farbpunkte setzen schnell eine Farbe, vom warmen Orange bis zu Blau, Pink und Grün. Wir schalten die Lampe wieder ein und färben sie.",
"Below that you set the brightness and the colour temperature with sliders, and the colour dots quickly set a colour, from warm orange to blue, pink and green. We switch the lamp on again and colour it.",
));
await r.click({ css: "button", text: "Stehlampe", nth: 0 });
await r.show(1, 1000);
await r.click({ css: "button[title='rgb(91, 124, 255)'], button[aria-label='rgb(91, 124, 255)']", nth: 1 });
await r.show(2.5, 1500);
r.say(S(
"Die Lampe leuchtet im Modell jetzt blau, und der Lichtschein fällt auf Boden und Möbel. „Alle aus“ schaltet alle Lichter des Raums auf einmal aus.",
"The lamp now glows blue in the model, and the light falls on the floor and the furniture. “All off” switches off all lights of the room at once.",
));
await r.spotAt({ text: L("Alle aus", "All off") });
await r.show(2);
await r.spot(null);
r.say(S(
"Rollläden haben die Knöpfe Auf, Stopp und Zu und einen Positionsregler. Medien haben Zurück, Wiedergabe oder Pause, Weiter und die Lautstärke. Darunter stehen die Sensoren des Raums, hier der Stromverbrauch des Fernsehers und der Terrassentür-Kontakt.",
"Blinds have the buttons Open, Stop and Close and a position slider. Media have Previous, Play or Pause, Next and the volume. Below are the sensors of the room, here the power draw of the TV and the terrace door contact.",
));
await r.click({ text: L("Rollladen", "Rollladen"), nth: 0 }).catch(() => {});
await r.show(2.5, 800);
r.say(S(
"Mit „Weitere Geräte des Bereichs“ blendest du die übrigen Geräte ein, die nicht im Plan platziert sind. Welche Geräte im Raum-Fenster erscheinen, steuerst du im Editor mit dem Auge und dem Stern in der Geräteliste.",
"With “More devices of the area” you show the remaining devices that are not placed in the plan. Which devices appear in the room panel you control in the editor with the eye and the star in the device list.",
));
await r.click({ text: L("Weitere Geräte des Bereichs", "More devices of the area") }).catch((e) => console.log(" [skipped]", e.message));
await r.show(2.5, 800);
// ------------------------------------------------------------------ in the model
await r.chapter({ en: "Controlling in the model", de: "Direkt im Modell bedienen" }, { en: "Tap, long press and the quick menu", de: "Antippen, lange drücken und das Schnellmenü" });
r.say(S(
"Du kannst die Geräte auch direkt im 3D-Modell bedienen. Ein Antippen einer Lampe schaltet sie. Wir tippen die Deckenlampe an.",
"You can also control the devices straight in the 3D model. A tap on a lamp switches it. We tap the ceiling lamp.",
));
await r.click({ text: L("Alle", "All"), nth: 0 });
await r.show(1, 1000);
await r.click({ css: ".nf-dev[data-entity='light.wohnzimmer_decke']" }).catch((e) => console.log(" [skipped]", e.message));
await r.show(2.5, 1200);
r.say(S(
"Ein langer Druck öffnet das Schnellmenü: Helligkeit, Farbe und die Details des Geräts, ohne dass du das Raum-Fenster brauchst. Auch bei Rollläden öffnet schon ein Antippen ihr Schnellmenü mit Auf, Zu und Positionen.",
"A long press opens the quick menu: brightness, colour and the details of the device, without needing the room panel. For blinds a tap is enough to open their quick menu with open, close and positions.",
));
await r.longPress({ css: ".nf-dev[data-entity='light.stehlampe']" }).catch((e) => console.log(" [skipped]", e.message));
await r.show(3, 800);
await r.key("Escape");
await r.show(1, 600);
// ------------------------------------------------------------------ central
await r.chapter({ en: "The central menu", de: "Das Zentralmenü" }, { en: "All lights, all blinds, favourites", de: "Alle Lichter, alle Rollläden, Favoriten" });
r.say(S(
"Der Stern links unten ist das Zentralmenü: alle Lichter und alle Rollläden der Etage oder des ganzen Hauses auf einmal, dazu deine Favoriten. Favoriten sind Szenen, Skripte, Automationen und Schalter, die du in den Editor-Einstellungen festlegst.",
"The star at the bottom left is the central menu: all lights and all blinds of the floor or the whole house at once, plus your favourites. Favourites are scenes, scripts, automations and switches that you set in the editor settings.",
));
await r.click({ text: L("Alle Etagen", "All floors"), nth: 0 });
await r.show(1.5, 1500);
await r.click({ css: "button[aria-label^='Central'], button[title^='Central'], button[aria-label^='Zentral'], button[title^='Zentral']" }).catch((e) => console.log(" [skipped]", e.message));
await r.show(3, 800);
await r.key("Escape");
await r.show(1);
// ------------------------------------------------------------------ search
await r.chapter({ en: "Search", de: "Suche" }, { en: "Where is …?", de: "Wo ist …?" });
r.say(S(
"Die Lupe unten links öffnet die Suche „Wo ist …?“. Du tippst den Namen eines Geräts oder Raums, und ein Treffer lässt die Kamera hinfliegen, während das Gerät aufblinkt. Praktisch in großen Häusern.",
"The magnifier at the bottom left opens the “Where is …?” search. You type the name of a device or room, and a hit makes the camera fly there while the device flashes. Handy in big houses.",
));
await r.click({ text: L("Suche", "Search") }).catch(async () => r.click({ css: "button[aria-label*='earch'], button[title*='earch']" }));
await r.show(1, 800);
await r.page.keyboard.type("Fern", { delay: 120 });
await r.show(2, 800);
await r.key("Enter");
await r.show(2.5, 1500);
await r.key("Escape");
}
@@ -0,0 +1,68 @@
export const title = { en: "Garage, parking spot and the car", de: "Garage, Stellplatz und das Auto" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const plan = (x, z) => r.planPoint(x, z);
const L = (de, en) => (r.lang === "de" ? de : en);
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
await r.chapter({ en: "A garage", de: "Eine Garage" }, { en: "One more room and a door", de: "Noch ein Raum und ein Tor" });
r.say(S(
"Zum Haus gehört noch eine Garage. Wir zeichnen sie mit dem Rechteck rechts neben die Küche.",
"The house also has a garage. We draw it with the rectangle to the right of the kitchen.",
));
await r.click({ key: "tool_rect" });
await r.drag(await plan(10, 0), await plan(13.6, 5.2));
await r.typeInto({ label: "room_name" }, L("Garage", "Garage"));
await r.choose({ label: "area" }, "Garage");
await r.choose({ label: "floor" }, L("Beton", "Concrete"));
await r.show(1);
r.say(S(
"Das Tor setzen wir mit „Türen und Fenster“ an die rechte Außenwand und wählen als Art „Garagentor“. Ein Garagentor kann mit einem Antrieb verbunden werden. In 3D fährt es dann hoch und runter und zeigt, ob es offen ist.",
"We place the door with “Doors and windows” on the right exterior wall and choose “Garage door” as the kind. A garage door can be connected to a drive. In 3D it then moves up and down and shows whether it is open.",
));
await r.click({ key: "tool_opening" });
const wall = await plan(13.6, 3.0);
await r.click({ x: wall.x, y: wall.y });
await r.click({ text: L("Garagentor", "Garage door") });
await r.show(2);
await r.chapter({ en: "The parking spot", de: "Der Stellplatz" }, { en: "Showing the car in 3D", de: "Das Auto in 3D zeigen" });
r.say(S(
"Jetzt der Stellplatz. In der Möbelbibliothek gibt es den Bereich „Parken“ mit dem Stellplatz. Wir wählen die Garage aus und setzen den Stellplatz hinein.",
"Now the parking spot. In the furniture library there is the section “Parking” with the parking spot. We select the garage and put the parking spot into it.",
));
await r.click({ key: "tool_furniture" });
const garage = await plan(11.8, 2.6);
await r.click({ x: garage.x, y: garage.y });
await r.click({ text: L("Parken", "Parking") });
await r.click({ text: L("Stellplatz", "Parking spot") });
await r.show(1.5);
r.say(S(
"Der Stellplatz zeigt in 3D ein Fahrzeug, solange dein Auto da ist. Du wählst bei „Fahrzeug“ das Modell, zum Beispiel einen Transporter aus dem Pack „Fahrzeuge“, und mit „Größe“ passt du es an. Ohne Fahrzeug-Pack bleibt die Liste leer.",
"The parking spot shows a vehicle in 3D while your car is there. Under “Vehicle” you choose the model, for example a van from the “Vehicles” pack, and with “Size” you adapt it. Without the vehicle pack the list stays empty.",
));
await r.choose({ label: "parking_vehicle" }, L("Transporter · Fahrzeuge", "Van · Vehicles")).catch(async (e) => {
console.log(" [vehicle option]", e.message);
});
await r.show(2);
r.say(S(
"Der Sensor „Auto da“ sagt, wann das Fahrzeug im Stellplatz steht, zum Beispiel ein Ortungssensor oder ein Bewegungsmelder. Erscheint das Auto nicht, stimmt meist dieser Sensor nicht. Ohne Sensor steht das Fahrzeug immer da.",
"The sensor “car present” says when the vehicle stands in the spot, for example a tracker or a motion sensor. If the car does not appear, this sensor is usually the reason. Without a sensor the vehicle always stands there.",
));
await r.pick("parking_entity", "Auto in", null).catch((e) => console.log(" [car present]", e.message));
await r.show(2);
r.say(S(
"Unten wählst du eine beliebige Entity deines Autos. NextFloor findet über das Gerät des Autos alles andere von selbst: Ladestand, Reichweite, Stecker, Innentemperatur und die Knöpfe für Schloss, Klima und Laden. Daraus entsteht in 3D eine Karte über dem Stellplatz, die wir uns im Kapitel über die Live-Funktionen ansehen.",
"At the bottom you choose any entity of your car. NextFloor finds everything else by itself through the device of the car: charge level, range, plug, inside temperature and the buttons for lock, climate and charging. From that a card over the parking spot is made in 3D, which we look at in the chapter about the live features.",
));
await r.pick("live_car_device", "Van Lade", null).catch((e) => console.log(" [car entity]", e.message));
await r.show(2);
await r.click({ key: "tool_select" });
await r.click({ key: "fit" });
await r.show(1.5);
}
@@ -0,0 +1,115 @@
export const title = { en: "Live features", de: "Live-Funktionen" };
export const query = "pv=5400";
const S = (de, en) => ({ de, en });
export async function run(r) {
const L = (de, en) => (r.lang === "de" ? de : en);
const set = (id, state, attrs = {}) => r.eval((a, b, c) => window.nfDemoSet(a, b, c), id, state, attrs);
const wait = (ms) => new Promise((ok) => setTimeout(ok, ms));
await r.quietClick({ text: "3D" });
await wait(3500);
await r.chapter({ en: "Live features", de: "Live-Funktionen" }, { en: "What happens in the house", de: "Was im Haus passiert" });
r.say(S(
"Jetzt kommen die Live-Funktionen. Sie holen in die 3D-Ansicht, was im Haus gerade passiert: das Wetter, den Stromfluss, laufende Fernseher und Musik und das Auto. Sie sind eingebaut, kostenlos und brauchen keine Einrichtung außer den Geräten, die du schon hast.",
"Now come the live features. They bring into the 3D view what is happening in the house right now: the weather, the power flow, TVs and music that are playing, and the car. They are built in, free, and need no setup beyond the devices you already have.",
));
await r.show(2, 800);
// ------------------------------------------------------------------ weather
await r.chapter({ en: "Weather at the house", de: "Wetter am Haus" }, { en: "Rain, snow, fog and lightning", de: "Regen, Schnee, Nebel und Blitze" });
r.say(S(
"Mit dem Schalter „Wetter“ unten zeigt die 3D-Ansicht das Wetter über deinem Grundstück. Dafür liest NextFloor eine Wetter-Entity aus Home Assistant. Gerade scheint die Sonne. Wir lassen es regnen.",
"With the “Weather” switch at the bottom the 3D view shows the weather over your plot. For that NextFloor reads a weather entity from Home Assistant. Right now the sun is shining. We make it rain.",
));
await r.show(2, 1000);
await set("weather.zuhause", "rainy", { cloud_coverage: 85, wind_speed: 25, wind_speed_unit: "km/h" });
await r.show(4, 2500);
r.say(S(
"Der Regen fällt schräg mit dem echten Wind, die Wolken ziehen mit ihren Schatten über das Grundstück und verdunkeln die Szene. Die Windrichtung hängt vom Kompass ab, den wir vorhin eingestellt haben.",
"The rain falls at an angle with the real wind, the clouds drift over the plot with their shadows and darken the scene. The wind direction depends on the compass we set earlier.",
));
await r.orbit({ theta: 0.5, frames: 10 });
await r.show(2, 800);
await set("weather.zuhause", "snowy", { cloud_coverage: 70, wind_speed: 8, wind_speed_unit: "km/h" });
await r.show(4, 2500);
r.say(S(
"Bei Schnee schneit es leise. Genauso gibt es Hagel, Schneeregen, Nebel, Gewitter mit Blitzen, die neben dem Haus einschlagen, und bei klarem Wetter stehen Sonne und Mond in ihrer echten Richtung am Himmel.",
"With snow it snows quietly. There is hail, sleet, fog, thunderstorms with lightning that strikes beside the house, and in clear weather the sun and moon stand in the sky in their real direction.",
));
await set("weather.zuhause", "lightning-rainy", { cloud_coverage: 95, wind_speed: 40, wind_speed_unit: "km/h" });
await r.show(4, 2500);
await set("weather.zuhause", "sunny", { cloud_coverage: 5, wind_speed: 6, wind_speed_unit: "km/h" });
await r.show(2.5, 2000);
r.say(S(
"Wer es ruhiger mag, schaltet den Schalter „Wetter“ aus oder wählt in den Editor-Einstellungen einzelne Effekte ab.",
"If you prefer it calmer, switch the “Weather” switch off or pick single effects in the editor settings.",
));
await r.show(1.5);
// ------------------------------------------------------------------ energy
await r.chapter({ en: "Energy flow", de: "Energiefluss" }, { en: "Sun, house, battery and grid", de: "Sonne, Haus, Akku und Netz" });
r.say(S(
"Der Schalter „Stromfluss“ blendet die Energie ein. Die Solarmodule funkeln mit ihrer Produktion, und Energieteilchen fliegen in Bögen zum Wechselrichter und weiter zu den Verbrauchern.",
"The “Power flow” switch shows the energy. The solar modules sparkle with their production, and energy particles fly in arcs to the inverter and on to the consumers.",
));
await r.click({ text: "Power flow", css: undefined }).catch((e) => console.log(" [skipped]", e.message));
await r.show(4, 2500);
r.say(S(
"Je mehr Strom fließt, desto schneller und dichter sind die Teilchen. Eine Glaskarte über dem Dach zeigt die Bilanz: Solar, Verbrauch, Akku und Netzbezug, und wie autark das Haus gerade ist.",
"The more power flows, the faster and denser the particles are. A glass card over the roof shows the balance: solar, consumption, battery and grid draw, and how self-sufficient the house is right now.",
));
await r.orbit({ theta: -0.6, frames: 12 });
await r.show(2.5, 1500);
// ------------------------------------------------------------------ TV and sound
await r.chapter({ en: "TV screens and sound", de: "Fernseher und Klang" }, { en: "What plays, in the model", de: "Was läuft, im Modell" });
r.say(S(
"Fliegen wir ins Wohnzimmer. Der Fernseher läuft: Auf dem Bildschirm im Modell steht in der Farbe der App, was gerade läuft, hier Netflix. Dahinter leuchtet ein sanftes Ambilight an der Wand.",
"Let us fly into the living room. The TV is on: on the screen in the model, in the colour of the app, is what is playing right now, here Netflix. Behind it a soft ambilight glows on the wall.",
));
await r.click({ text: "Erdgeschoss", nth: 0 });
await r.show(1.5, 1500);
await r.click({ text: L("Wohnzimmer", "Living room") });
await r.show(3, 2500);
await set("media_player.fernseher", "playing", { app_name: "YouTube", media_title: "Rooftop Sessions", media_artist: "Live" });
await r.show(3, 2000);
r.say(S(
"Wechselt der Fernseher die App, wechselt die Farbe und der Titel. Das Ambilight lässt sich pro Fernseher in der Stärke einstellen oder ganz abschalten, wenn du hinter dem Fernseher eigene LED-Streifen hast.",
"When the TV changes the app, the colour and title change. The ambilight can be set in strength per TV or switched off completely if you have LED strips of your own behind the TV.",
));
await r.show(1.5);
r.say(S(
"Laufen Lautsprecher oder Fernseher, schwebt über ihnen eine Karte mit Cover, Titel und Interpret. Antippen gibt dir Zurück, Wiedergabe oder Pause, Weiter und die Lautstärke. Schallringe in der Farbe der App breiten sich aus, lauter heißt weiter.",
"When speakers or TVs play, a card floats over them with cover, title and artist. Tapping gives you previous, play or pause, next and the volume. Sound rings in the colour of the app spread out, louder reaches further.",
));
await set("media_player.lautsprecher", "playing", { app_name: "Spotify", media_title: "Blue Train", media_artist: "John Coltrane", volume_level: 0.5 });
await r.click({ text: L("Alle Etagen", "All floors"), nth: 0 });
await r.show(4, 3000);
await r.orbit({ theta: 0.4, frames: 8 });
await r.show(1.5, 800);
r.say(S(
"Lautsprecher einer Multiroom-Gruppe verbindet ein leuchtender Faden. Mit dem Schalter „Karten“ blendest du alle schwebenden Karten gemeinsam aus oder ein.",
"Speakers of a multiroom group are joined by a glowing thread. With the “Cards” switch you hide or show all floating cards together.",
));
await r.show(1.5);
// ------------------------------------------------------------------ car
await r.chapter({ en: "The car", de: "Das Auto" }, { en: "Charge, range and controls", de: "Ladestand, Reichweite und Bedienung" });
r.say(S(
"Zuletzt das Auto in der Garage. Über dem Stellplatz zeigt eine Glaskarte den Ladestand mit Farbring, die Reichweite, ob und mit wie viel Leistung geladen wird, den Stecker und die Innentemperatur. Dazu kommen Knöpfe für Schloss, Klima und Laden.",
"Last the car in the garage. Over the parking spot a glass card shows the charge with a colour ring, the range, whether and with how much power it is charging, the plug and the inside temperature. There are also buttons for lock, climate and charging.",
));
await r.click({ text: L("Alle Etagen", "All floors"), nth: 0 });
await r.show(4, 3000);
await r.spotAt({ css: ".live-card-car" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(3);
await r.spot(null);
r.say(S(
"Lädt das Auto, fliegen Energieteilchen von der Wallbox hinein. Ist das Auto weg, steht auf der Karte, wo es gerade ist. Die passenden Entitäten findet NextFloor selbst am Gerät des Autos.",
"While the car charges, energy particles fly into it from the wallbox. When the car is away, the card says where it is. NextFloor finds the matching entities on the device of the car by itself.",
));
await r.show(2.5);
}
@@ -0,0 +1,67 @@
import { DEEP } from "../lib.mjs";
import { writeSampleGlb } from "../sample-model.mjs";
export const title = { en: "Extensions: own models and packs", de: "Erweiterungen: eigene Modelle und Packs" };
export const keepState = true;
const S = (de, en) => ({ de, en });
export async function run(r) {
const L = (de, en) => (r.lang === "de" ? de : en);
const glb = writeSampleGlb("/tmp/tutorial-sample.glb");
await r.chapter({ en: "Your own 3D models", de: "Eigene 3D-Modelle" }, { en: "The Extensions tab", de: "Der Reiter Erweiterungen" });
r.say(S(
"Der dritte Reiter heißt Erweiterungen. Hier lädst du eigene 3D-Modelle hoch, ohne etwas von Hand auf den Server kopieren zu müssen.",
"The third tab is called Extensions. Here you upload 3D models of your own, without having to copy anything to the server by hand.",
));
await r.click({ text: "Extensions" });
await r.show(3, 1200);
r.say(S(
"Für einige Fahrzeuge kann NextFloor ein echtes 3D-Modell zeigen, wenn du eines besitzt, zum Beispiel für dein eigenes Auto. Jede Zeile ist ein Platz: Sie nennt das Fahrzeug und den Dateinamen, und daneben steht, ob schon ein Modell vorhanden ist.",
"For some vehicles NextFloor can show a real 3D model if you own one, for example of your own car. Every row is a slot: it names the vehicle and the file name, and next to it says whether a model is present already.",
));
await r.show(2.5);
r.say(S(
"Wir wählen beim Tesla Model 3 „Modell hinzufügen“ und eine Datei im glb-Format aus. NextFloor bereitet das Modell direkt im Browser auf: Es dreht es richtig herum, macht es leichter, entfernt Texturen und markiert den Lack, damit er sich später umfärben lässt. Dann legt es die Datei auf deinem Home Assistant ab.",
"For the Tesla Model 3 we choose “Add a model” and a file in glb format. NextFloor prepares the model right in the browser: it turns it the right way round, makes it lighter, removes textures and marks the paint so that it can be recoloured later. Then it stores the file on your Home Assistant.",
));
const at = await r.point({ text: L("Modell hinzufügen …", "Add a model …"), nth: 1 });
await r.page.evaluate((x, y) => window.__tut.ripple(x, y), at.x, at.y);
await r.frame();
// the file dialog of the system cannot be filmed: the chosen file is handed to the page's file field directly
const input = await r.page.evaluateHandle(`(() => { ${DEEP} return all("input[type=file]")[1]; })()`);
await input.uploadFile(glb);
await r.show(3, 3500);
r.say(S(
"Fertig: Bei diesem Platz steht jetzt „vorhanden“, und du kannst das Modell ersetzen oder entfernen. Nur Administratoren können Modelle hochladen. Modelle bis zwölf Megabyte werden angenommen. Ein Fahrzeug ohne Modell sieht aus wie bisher.",
"Done: this slot now says “in place”, and you can replace or remove the model. Only administrators can upload models. Models up to twelve megabytes are accepted. A vehicle without a model looks as it did before.",
));
await r.show(2.5);
r.say(S(
"Die Möbel-Packs brauchen keine Einrichtung: Sie sind alle schon da und stehen in der Möbelbibliothek des Editors. Wenn du sehen möchtest, wie jedes einzelne Modell aussieht, gibt es in der Online-Demo eine Modellschau.",
"The furniture packs need no setup: they are all there already and are listed in the furniture library of the editor. If you want to see what every single model looks like, the online demo has a model showcase.",
));
await r.show(1.5);
// ------------------------------------------------------------------ showcase
await r.chapter({ en: "The model showcase", de: "Die Modellschau" }, { en: "Every model, live", de: "Jedes Modell, live" });
await r.navigate("showcase&set=pack%3Aa_wohnzimmer");
await r.show(3, 2500);
r.say(S(
"Die Modellschau zeigt alle Modelle in einem Raum, zehn pro Seite, in der Reihenfolge, in der sie stehen. Die Namen stehen in der Liste unten links.",
"The model showcase shows all models in one room, ten per page, in the order in which they stand. The names are listed at the bottom left.",
));
await r.show(2.5);
r.say(S(
"Über die Auswahl wechselst du die Gruppe, grundlegende Modelle oder eines der Packs. Mit „weiter“ und „zurück“ blätterst du, und das 3D-Modell lässt sich wie immer drehen und zoomen.",
"With the selection you change the group, basic models or one of the packs. With “next” and “previous” you page through, and the 3D model can be turned and zoomed as always.",
));
await r.click({ text: L("weiter ›", "next ›") });
await r.reinject();
await r.show(3, 3000);
await r.click({ text: L("weiter ›", "next ›") });
await r.reinject();
await r.show(3, 3000);
}
@@ -0,0 +1,81 @@
export const title = { en: "The dashboard card", de: "Die Dashboard-Karte" };
export const keepState = true;
export const query = "card";
const S = (de, en) => ({ de, en });
export async function run(r) {
const L = (de, en) => (r.lang === "de" ? de : en);
const wait = (ms) => new Promise((ok) => setTimeout(ok, ms));
await r.chapter({ en: "The dashboard card", de: "Die Dashboard-Karte" }, { en: "Your house on any dashboard", de: "Dein Haus auf jedem Dashboard" });
r.say(S(
"Das Modell musst du nicht im Panel öffnen: NextFloor bringt eine Dashboard-Karte mit, die das Haus auf jedem Home-Assistant-Dashboard zeigt. Hier siehst du links den visuellen Editor der Karte, so wie ihn Home Assistant im Karten-Dialog zeigt, und rechts die Karte selbst.",
"You do not have to open the model in the panel: NextFloor brings a dashboard card that shows the house on any Home Assistant dashboard. On the left you see the visual editor of the card, just as Home Assistant shows it in the card dialog, and on the right the card itself.",
));
await r.show(3, 2500);
r.say(S(
"Du fügst die Karte in einem Dashboard über „Karte hinzufügen“ hinzu und suchst nach NextFloor. Eine Zeile Konfiguration reicht: Typ „custom:nextfloor-card“. Alles Weitere stellst du bequem im Editor ein, und die Karte rechts folgt sofort.",
"You add the card to a dashboard with “Add card” and search for NextFloor. One line of configuration is enough: type “custom:nextfloor-card”. Everything else you set conveniently in the editor, and the card on the right follows immediately.",
));
await r.show(2.5);
r.say(S(
"Oben legst du fest, was die Karte zeigt. „Etage“ wählt das ganze Haus oder eine einzelne Etage, mit der die Karte startet. „Größe“ legt fest, ob sie eine feste Höhe hat oder den Bildschirm füllt. Wir wählen das ganze Haus.",
"At the top you decide what the card shows. “Floor” picks the whole house or a single floor that the card starts with. “Size” decides whether it has a fixed height or fills the screen. We choose the whole house.",
));
await r.choose({ label: "card_floor" }, L("Ganzes Haus (Etage antippen öffnet sie)", "Whole house (tap a floor to open it)")).catch((e) => console.log(" [skipped]", e.message));
await r.show(3, 2500);
r.say(S(
"„Aussehen“ wechselt zwischen Neon, Blueprint und Tag, und die Akzentfarbe färbt Linien und Knöpfe um. „Wände“ stellt Hohe Wände oder Schnitt ein, die Qualität kennst du schon, und „Etagen darunter“ bestimmt, ob die Etagen unter der gewählten gedimmt, gestapelt oder ausgeblendet erscheinen.",
"“Look” switches between Neon, Blueprint and Day, and the accent colour recolours lines and buttons. “Walls” sets Tall walls or Cut, you know the quality already, and “Floors below” decides whether the floors below the chosen one appear dimmed, stacked or hidden.",
));
await r.choose({ label: "theme" }, "Blueprint");
await r.show(2.5, 2000);
await r.choose({ label: "theme" }, "Neon");
await r.show(1.5, 1500);
r.say(S(
"Im Abschnitt „Anzeige“ stellst du Symbole, Heatmap, Stromfluss und Karten ein. Stromfluss und Karten können dem Betrachter überlassen werden, mit einem Schalter in der Karte, oder immer an oder immer aus sein. Wir schalten die Symbole auf „Alle“.",
"In the “Show” section you set markers, heat map, power flow and cards. Power flow and cards can be left to the viewer, with a switch in the card, or be always on or always off. We set the markers to “All”.",
));
await r.choose({ label: "markers" }, L("Alle", "All"));
await r.show(3, 2500);
await r.choose({ label: "markers" }, L("Wichtige", "Important"));
await r.show(1, 1000);
r.say(S(
"Darunter sitzen Kästchen für die Schalter in der Karte, den Stern mit dem Zentralmenü, eigene Namen an den Symbolen und die Option, mit versteckten Bedienelementen zu starten, damit nur das 3D-Bild bleibt. Weitere Optionen: Etagen als Miniaturen, Raumnamen, Energiewerte oben, Raumdetails beim Antippen, ein Vollbild-Knopf und das Auseinanderziehen der Etagen.",
"Below are checkboxes for the switches in the card, the star with the central menu, own names at the markers, and the option to start with the controls hidden so that only the 3D picture remains. More options: floors as miniatures, room names, energy values at the top, room details on tap, a full-screen button and the pulling apart of the floors.",
));
await r.eval(() => {
const walk = (root) => { for (const el of root.querySelectorAll("*")) { if (el.tagName === "H3" && /Features|Funktionen/.test(el.textContent)) { el.scrollIntoView({ block: "start" }); return true; } if (el.shadowRoot && walk(el.shadowRoot)) return true; } return false; };
walk(document);
});
await r.show(3, 800);
r.say(S(
"Unter „Funktionen“ schaltest du Warnungen, den Sprung in den Raum einer neuen Warnung, Szenen-Knöpfe im Raum und das Wetter am Haus ein oder aus. Warnungen zeigen Rauch, Gas, CO, Wasser, Alarmanlage und offene Fenster bei Regen als Banner über der Karte.",
"Under “Features” you switch warnings, the jump into the room of a new warning, scene buttons in the room and the weather at the house on or off. Warnings show smoke, gas, CO, water, alarm panel and open windows in the rain as a banner over the card.",
));
await r.show(2.5);
// ------------------------------------------------------------------ kiosk
await r.chapter({ en: "A wall tablet", de: "Ein Wandtablet" }, { en: "Kiosk mode", de: "Der Kiosk-Modus" });
r.say(S(
"Ganz unten steht der Abschnitt „Wandtablet“. Damit wird die Karte zum Dauerbetrieb an der Wand: Nach einer Zeit ohne Berührung kehrt sie von selbst zur Startansicht zurück, damit niemand in einem Raum hängen bleibt.",
"At the very bottom is the section “Wall tablet”. It turns the card into a permanent display on the wall: after a time without a touch it returns to the start view by itself, so that nobody stays stuck in a room.",
));
await r.eval(() => {
const walk = (root) => { for (const el of root.querySelectorAll("*")) { if (el.tagName === "H3" && /kiosk|Wandtablet/i.test(el.textContent)) { el.scrollIntoView({ block: "start" }); return true; } if (el.shadowRoot && walk(el.shadowRoot)) return true; } return false; };
walk(document);
});
await r.show(3, 800);
r.say(S(
"Die Nachtabdunkelung dimmt die Karte nachts, entweder nach der Sonne oder in einem Zeitraum, den du angibst. Dabei ruhen Farbeffekte, und die Anzeige wird dunkel, damit das Tablet im Schlafzimmer nicht blendet. Als Bildschirmschoner dreht sich nach der Rückkehr die Kamera langsam um das Haus. Ein Knopf kann außerdem zu einem anderen Dashboard führen.",
"Night dimming darkens the card at night, either by the sun or in a time range you give. Colour effects rest, and the display goes dark so that the tablet in the bedroom does not dazzle. As a screensaver the camera turns slowly around the house after the return. A button can also lead to another dashboard.",
));
await r.show(3);
r.say(S(
"Für Tablets stellst du die Qualität auf „Tablet“. Das ist die leichteste Einstellung und ideal für Fire-Tablets und andere Wandtablets.",
"For tablets you set the quality to “Tablet”. That is the lightest setting and ideal for Fire tablets and other wall tablets.",
));
await r.show(2.5);
}
@@ -0,0 +1,62 @@
export const title = { en: "Backup, moving and wrap-up", de: "Sicherung, Umzug und Abschluss" };
const S = (de, en) => ({ de, en });
export async function run(r) {
const L = (de, en) => (r.lang === "de" ? de : en);
const wait = (ms) => new Promise((ok) => setTimeout(ok, ms));
await r.quietClick({ text: "Editor" });
await r.quietClick({ text: "Erdgeschoss" });
await r.page.mouse.move(640, 360);
await r.chapter({ en: "Backup and moving", de: "Sicherung und Umzug" }, { en: "Keeping your plan safe", de: "Deinen Plan sicher aufbewahren" });
r.say(S(
"Dein Plan ist jetzt viel Arbeit wert. Damit er nicht verloren geht, gibt es im Editor ganz unten den Abschnitt „Sicherung“. Wir klappen ihn auf.",
"Your plan is worth a lot of work now. So that it is not lost, the editor has a “Backup” section at the very bottom. We unfold it.",
));
await r.click({ key: "backup" });
await r.show(1.5, 800);
r.say(S(
"„Exportieren“ speichert den Plan als Datei, „Importieren“ liest ihn wieder ein, auch in einer anderen Installation. „Als Vorlage teilen“ erzeugt eine Datei ohne persönliche Angaben wie Geräte, die du mit anderen teilen kannst.",
"“Export” saves the plan as a file, “Import” reads it in again, also in another installation. “Share as template” makes a file without personal details such as devices, which you can share with others.",
));
await r.spotAt({ text: "Export" }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(2.5);
await r.spot(null);
r.say(S(
"„Alles sichern“ packt zusätzlich alle Hintergrund- und Bildschirmbilder und die installierten Packs in eine einzige Datei. Mit „Vollsicherung wiederherstellen“ spielst du sie in dieselbe oder eine andere Installation zurück. Der Plan, die Bilder und die Packs liegen in Home Assistant unter „.storage“, und nichts davon verlässt deine Installation.",
"“Back up everything” also packs all background and screen pictures and the installed packs into a single file. With “Restore a full backup” you play it back into the same or another installation. The plan, the pictures and the packs live in Home Assistant under “.storage”, and none of it leaves your installation.",
));
await r.spotAt({ text: L("Alles sichern (Plan, Bilder, Packs)", "Back up everything (plan, pictures, packs)") }).catch((e) => console.log(" [skipped spot]", e.message));
await r.show(3);
await r.spot(null);
r.say(S(
"Vor größeren Änderungen lohnt sich eine Sicherung. Und falls doch etwas schiefgeht: „Rückgängig“ im Editor und die Tastenkombination Strg plus Z machen die letzten Schritte ungeschehen.",
"Before bigger changes a backup is worth it. And if something does go wrong: “Undo” in the editor and the key combination Ctrl plus Z take back the last steps.",
));
await r.show(2);
await r.chapter({ en: "That's it", de: "Das war's" }, { en: "Your home, in NextFloor", de: "Dein Zuhause in NextFloor" });
await r.click({ text: "3D" });
await wait(3500);
await r.frame();
r.say(S(
"Das war die komplette Einrichtung von NextFloor von Grund auf: Etagen, Räume, Türen und Fenster, Möbel, Geräte, Außenflächen, Treppe, Dach und Solarstrom, Kompass und Karte, und dazu die Bedienung in 3D, die Live-Funktionen, eigene Modelle, die Dashboard-Karte und die Sicherung.",
"That was the complete setup of NextFloor from scratch: floors, rooms, doors and windows, furniture, devices, outdoor areas, stairs, roof and solar power, compass and map, plus operating it in 3D, the live features, own models, the dashboard card and the backup.",
));
await r.show(3, 1000);
await r.orbit({ theta: 1.2, frames: 24 });
await r.show(2, 800);
r.say(S(
"Nimm dir für dein eigenes Haus ruhig Zeit. Wichtig sind zuerst die Räume und die Wände, alles Weitere kannst du jederzeit ergänzen. Und denk daran: Rückgängig ist immer nur einen Klick entfernt.",
"Take your time with your own house. What matters first are the rooms and walls, everything else you can add at any time. And remember: undo is always only a click away.",
));
await r.show(2, 800);
r.say(S(
"Wenn du Fragen hast, etwas nicht funktioniert oder dir eine Funktion fehlt, melde dich auf GitHub. Über „Problem melden“ und „Idee vorschlagen“ im Editor kommst du direkt dorthin. NextFloor ist kostenlos und Open Source. Viel Spaß mit deinem Zuhause in 3D!",
"If you have questions, something does not work or you miss a feature, get in touch on GitHub. “Report a problem” and “Propose an idea” in the editor take you straight there. NextFloor is free and open source. Have fun with your home in 3D!",
));
await r.orbit({ theta: -1.2, frames: 24 });
await r.show(4, 1500);
}
+23
View File
@@ -0,0 +1,23 @@
import { launch, serve, DEEP } from "./lib.mjs";
const { server, base } = await serve();
const { browser, page } = await launch(1280, 720);
await page.evaluateOnNewDocument(() => localStorage.clear());
await page.goto(`${base}/preview/index.html?${process.env.QUERY ?? "empty"}&noshowcase&lang=en&ha=dark`, { waitUntil: "networkidle0", timeout: 120000 });
await new Promise((r) => setTimeout(r, 1500));
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
const click = (text) => page.evaluate(`(() => { ${DEEP} const el = all("button, summary").filter(visible).find((e) => textOf(e) === ${JSON.stringify(text)} || textOf(e).startsWith(${JSON.stringify(text)})); if (el) el.click(); return !!el; })()`);
const dump = (name) => page.evaluate(`(() => { ${DEEP} return all("button, select, input, summary, label, h3").filter(visible).map((el) => el.tagName.toLowerCase() + ":" + (textOf(el).slice(0,50) || el.getAttribute("aria-label") || el.title || el.placeholder || el.type)); })()`);
for (const step of (process.env.STEPS ?? "Open editor").split("|")) {
if (step.startsWith("@")) { // @x,y click at coordinates; @drag x1,y1,x2,y2
const [kind, rest] = step.slice(1).split(" ");
const n = rest.split(",").map(Number);
if (kind === "click") await page.mouse.click(n[0], n[1]);
if (kind === "wheel") { await page.mouse.move(n[0], n[1]); await page.mouse.wheel({ deltaY: n[2] }); }
if (kind === "key") await page.keyboard.press(rest);
if (kind === "drag") { await page.mouse.move(n[0], n[1]); await page.mouse.down(); for (let i = 1; i <= 12; i++) { await page.mouse.move(n[0] + ((n[2] - n[0]) * i) / 12, n[1] + ((n[3] - n[1]) * i) / 12); await wait(30); } await page.mouse.up(); }
} else console.log("click", step, await click(step));
await wait(900);
}
await page.screenshot({ path: "/tmp/tut-x.png" });
console.log((await dump()).join("\n"));
await browser.close(); server.close();
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env python3
"""Finds the i18n keys of UI texts: python3 tutorial/key.py "Add floor" "Rectangle" (case-insensitive, substring)."""
import os,re,sys
src=open(os.path.join(os.path.dirname(os.path.abspath(__file__)),"..","src","i18n.ts")).read()
en=src[src.index("const en:"):]
de=src[:src.index("const en:")]
pairs=re.findall(r'^ ([a-z0-9_]+): (?:"((?:[^"\\]|\\.)*)"|`([^`]*)`),?$',en,flags=re.M)
dpairs=dict((k,a or b) for k,a,b in re.findall(r'^ ([a-z0-9_]+): (?:"((?:[^"\\]|\\.)*)"|`([^`]*)`),?$',de,flags=re.M))
for q in sys.argv[1:]:
for k,a,b in pairs:
v=a or b
if q.lower() in v.lower():
print(f"{k:32} | {v[:60]:60} | {dpairs.get(k,'')[:50]}")
+36
View File
@@ -0,0 +1,36 @@
// Shared helpers of the tutorial recorder: a static server for the repository, a headless Chrome, and shadow-DOM aware finders.
import { createServer } from "node:http";
import { existsSync, readFileSync } from "node:fs";
import { extname, join, normalize, resolve } from "node:path";
import puppeteer from "puppeteer-core";
export const root = resolve(import.meta.dirname, "..", "..");
const TYPES = { ".html": "text/html", ".js": "text/javascript", ".mjs": "text/javascript", ".css": "text/css", ".png": "image/png", ".json": "application/json", ".svg": "image/svg+xml" };
export async function serve() {
const server = createServer((req, res) => {
const path = normalize(decodeURIComponent(new URL(req.url, "http://x").pathname)).replace(/^([/\\])+/, "");
const file = join(root, path);
if (!file.startsWith(root) || !existsSync(file)) return void res.writeHead(404).end();
res.writeHead(200, { "content-type": TYPES[extname(file)] ?? "application/octet-stream" }).end(readFileSync(file));
});
await new Promise((ok) => server.listen(0, "127.0.0.1", ok));
return { server, base: `http://127.0.0.1:${server.address().port}` };
}
export async function launch(width = 1280, height = 720) {
const exe = [process.env.CHROME_PATH, "/usr/bin/chromium", "/usr/bin/google-chrome", `${process.env.HOME}/.cache/ms-playwright/chromium-1234/chrome-linux64/chrome`].filter(Boolean).find((p) => existsSync(p));
const args = ["--use-angle=swiftshader", "--enable-unsafe-swiftshader", "--ignore-gpu-blocklist", ...(process.getuid?.() === 0 ? ["--no-sandbox"] : [])];
const browser = await puppeteer.launch({ executablePath: exe, headless: true, args });
const page = await browser.newPage();
await page.setViewport({ width, height, deviceScaleFactor: 1 });
return { browser, page };
}
/** Runs code in the page with a deep finder (through shadow roots) at hand: find(text) → button, findAll(selector) → elements. */
export const DEEP = `
const deep = (root, visit) => { for (const el of root.querySelectorAll("*")) { visit(el); if (el.shadowRoot) deep(el.shadowRoot, visit); } };
const all = (selector) => { const out = []; const walk = (root) => { out.push(...root.querySelectorAll(selector)); for (const el of root.querySelectorAll("*")) if (el.shadowRoot) walk(el.shadowRoot); }; walk(document); return out; };
const visible = (el) => { const r = el.getBoundingClientRect(); return r.width > 0 && r.height > 0 && getComputedStyle(el).visibility !== "hidden"; };
const textOf = (el) => (el.textContent || "").replace(/\\s+/g, " ").trim();
`;
+402
View File
@@ -0,0 +1,402 @@
// The recorder: drives the demo like a user would and writes a video as a list of stills with durations.
//
// Time in the video is made, not measured: every `frame()` adds 1/FPS, and `hold(s)` makes the last still last longer. So an
// action that needs a second to settle costs nothing in the video, and a gliding mouse is as smooth as the frames we take of it.
// Narration is a list of segments (German and English text); a segment lasts at least as long as its text takes to speak.
import { mkdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { DEEP, launch, serve } from "./lib.mjs";
export const FPS = 10;
const WORDS_PER_SECOND = { en: 2.5, de: 2.2 };
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const easing = (t) => (t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2);
/** How long a text takes to speak, in seconds (slow and clear: this is a tutorial). */
export function speechSeconds(text, lang) {
const words = String(text).trim().split(/\s+/).filter(Boolean).length;
return words / WORDS_PER_SECOND[lang] + 0.5;
}
export class Recorder {
constructor({ out, lang, t }) {
this.out = out;
this.lang = lang;
this.t = t; // (key, vars) → the UI text in the recording's language
this.frames = [];
this.segments = [];
this.chapters = [];
this.open = null; // the segment being filled
this.cursor = { x: 640, y: 360 };
mkdirSync(join(out, "frames"), { recursive: true });
}
async start({ query, width = 1280, height = 720 }) {
this.width = width;
this.height = height;
const { server, base } = await serve();
this.server = server;
const { browser, page } = await launch(width, height);
this.browser = browser;
this.page = page;
page.on("pageerror", (e) => console.log(" [page error]", e.message));
await page.evaluateOnNewDocument(() => localStorage.clear());
await page.goto(`${base}/preview/index.html?noshowcase&lang=${this.lang}&ha=dark${query ? "&" + query : ""}`, { waitUntil: "networkidle0", timeout: 180000 });
await sleep(2000);
await page.evaluate(OVERLAY);
this.base = base;
}
get time() {
return this.frames.reduce((a, f) => a + f.dur, 0);
}
// ------------------------------------------------------------------ frames and time
async frame() {
const file = `frames/f${String(this.frames.length).padStart(6, "0")}.jpg`;
await this.page.screenshot({ path: join(this.out, file), type: "jpeg", quality: 88 });
this.frames.push({ file, dur: 1 / FPS });
}
/** Waits until the page has settled, takes a frame, and lets it stand for `seconds`. */
async show(seconds = 1.5, settle = 500) {
await sleep(settle);
await this.frame();
this.hold(seconds - 1 / FPS);
}
hold(seconds) {
if (seconds > 0 && this.frames.length) this.frames.at(-1).dur += seconds;
}
// ------------------------------------------------------------------ narration
/** Starts a narration segment; the following actions belong to it until the next `say`. */
say(text) {
this.endSegment();
this.open = { start: this.time, de: text.de, en: text.en, chapter: this.chapters.length };
}
endSegment() {
const s = this.open;
if (!s) return;
const need = Math.max(speechSeconds(s.de, "de"), speechSeconds(s.en, "en"));
const have = this.time - s.start;
if (have < need) this.hold(need - have);
s.end = this.time;
this.segments.push(s);
this.open = null;
}
/** A title card between two chapters. */
async chapter(title, subtitle) {
this.endSegment();
const label = title[this.lang];
await this.page.evaluate((a, b) => window.__tut.card(a, b), label, subtitle?.[this.lang] ?? "");
await sleep(300);
this.chapters.push({ start: this.time, title });
await this.frame();
this.hold(2.4);
await this.page.evaluate(() => window.__tut.card(null));
await sleep(200);
}
// ------------------------------------------------------------------ finding things
/** The centre of a thing on screen: { key } a UI text by its i18n key, { text }, { css }, or { x, y }. */
async locate(target) {
if (typeof target === "function") target = await target();
if (target.x !== undefined) return { x: target.x, y: target.y };
const text = target.key ? this.t(target.key, target.vars) : target.label ? this.t(target.label, target.vars) : target.text;
const asLabel = !!target.label;
const found = await this.page.evaluate(
`(() => { ${DEEP}
const want = ${JSON.stringify(text ?? null)}; const asLabel = ${asLabel}; const css = ${JSON.stringify(target.css ?? null)}; const nth = ${target.nth ?? 0}; const near = ${JSON.stringify(target.near ?? null)}; const within = ${JSON.stringify(target.within ?? null)};
let list;
if (css) list = all(css);
else if (asLabel) { const own = (el) => [...el.childNodes].filter((n) => n.nodeType === 3).map((n) => n.textContent).join("").replace(/\\s+/g, " ").trim(); list = all("label").filter(visible).filter((el) => own(el) === want || own(el).startsWith(want + " (")); }
else {
const pool = all("button, summary, label, a, [role=tab], [role=option], option, h3, .nf-chip").filter(visible);
const tiers = [(el) => textOf(el) === want || (el.firstElementChild && textOf(el.firstElementChild) === want), (el) => textOf(el).startsWith(want), (el) => textOf(el).replace(/^[^\\p{L}\\p{N}]+/u, "").startsWith(want), (el) => want.length > 2 && textOf(el).includes(want)];
list = [];
for (const tier of tiers) { list = pool.filter(tier); if (list.length) break; }
}
list = list.filter(visible);
if (near) list = list.filter((el) => { let a = el; for (let i = 0; i < 4 && a; i++) { a = a.parentElement || (a.getRootNode && a.getRootNode().host); if (a && textOf(a).length < 90 && textOf(a).startsWith(near)) return true; } return false; });
if (within) { const root = all(within)[0]; if (root) list = list.filter((el) => root.contains(el) || (root.shadowRoot && root.shadowRoot.contains(el))); }
const el = list[nth]; if (!el) return null;
el.scrollIntoView({ block: "center", inline: "nearest" });
const r = el.getBoundingClientRect();
return { x: Math.round(r.left + (el.tagName === "INPUT" || el.tagName === "SELECT" ? Math.min(r.width / 2, 120) : r.width / 2)), y: Math.round(r.top + r.height / 2), w: Math.round(r.width), h: Math.round(r.height), left: r.left, top: r.top };
})()`,
);
if (!found) throw new Error(`not found on screen: ${JSON.stringify(target)} (${text ?? ""})`);
return found;
}
// ------------------------------------------------------------------ the mouse
async glide(x, y, { frames = 10, hover = true } = {}) {
const from = { ...this.cursor };
const steps = Math.max(2, Math.round(frames * Math.min(1, Math.hypot(x - from.x, y - from.y) / 300 + 0.3)));
for (let i = 1; i <= steps; i++) {
const k = easing(i / steps);
const px = from.x + (x - from.x) * k;
const py = from.y + (y - from.y) * k;
this.cursor = { x: px, y: py };
await this.page.evaluate((a, b) => window.__tut.move(a, b), px, py);
if (hover) await this.page.mouse.move(px, py);
await this.frame();
}
}
async point(target, opts) {
const at = await this.locate(target);
await this.glide(at.x, at.y, opts);
return at;
}
/** A click that is not filmed (setting the stage between episodes). */
async quietClick(target) {
const at = await this.locate(target);
await this.page.mouse.click(at.x, at.y);
await sleep(700);
}
async click(target, { settle = 600, after = 0.6 } = {}) {
const at = await this.point(target);
await this.page.evaluate((a, b) => window.__tut.ripple(a, b), at.x, at.y);
await this.frame();
await this.page.mouse.click(at.x, at.y);
await sleep(settle);
await this.frame();
this.hold(after);
return at;
}
/** Presses and holds (the quick menu opens on a long press). */
async longPress(target, { hold = 0.9 } = {}) {
const at = await this.point(target);
await this.page.evaluate((a, b) => window.__tut.ripple(a, b), at.x, at.y);
await this.page.mouse.move(at.x, at.y);
await this.page.mouse.down();
await sleep(hold * 1000);
await this.page.mouse.up();
await sleep(700);
await this.frame();
this.hold(0.6);
}
/** Presses and drags between two points, with a frame on the way every few pixels. */
async drag(from, to, { frames = 14, up = true } = {}) {
await this.glide(from.x, from.y);
await this.page.mouse.move(from.x, from.y);
await this.page.mouse.down();
for (let i = 1; i <= frames; i++) {
const k = easing(i / frames);
const x = from.x + (to.x - from.x) * k;
const y = from.y + (to.y - from.y) * k;
this.cursor = { x, y };
await this.page.evaluate((a, b) => window.__tut.move(a, b), x, y);
await this.page.mouse.move(x, y);
await this.frame();
}
if (up) await this.page.mouse.up();
await sleep(500);
await this.frame();
}
async typeInto(target, text, { clear = true } = {}) {
const at = await this.click(target, { after: 0.1 });
if (clear) {
await this.page.keyboard.down("Control");
await this.page.keyboard.press("KeyA");
await this.page.keyboard.up("Control");
}
let i = 0;
for (const ch of text) {
await this.page.keyboard.type(ch, { delay: 20 });
if (++i % 3 === 0 || i === text.length) await this.frame();
}
await this.page.keyboard.press("Enter");
await this.page.keyboard.press("Tab");
await sleep(400);
await this.frame();
this.hold(0.4);
return at;
}
async key(name, { frames = 1 } = {}) {
await this.page.keyboard.press(name);
await sleep(500);
for (let i = 0; i < frames; i++) await this.frame();
}
/** Where a point of the plan (metres) lies on the screen, in the editor's drawing. */
async planPoint(x, z) {
const at = await this.page.evaluate(
`(() => { ${DEEP} const e = all("nf-editor")[0]; const svg = e.renderRoot.querySelector("svg"); const r = svg.getBoundingClientRect(); const p = e.toScreen([${x}, ${z}]); return { x: r.left + p[0], y: r.top + p[1] }; })()`,
);
return at;
}
/** Sets a drop-down: the pointer goes to it, the choice is made and shown. */
async choose(target, optionText) {
const at = await this.point(target);
await this.page.evaluate((a, b) => window.__tut.ripple(a, b), at.x, at.y);
await this.frame();
const ok = await this.page.evaluate(
`(() => { ${DEEP} const label = ${JSON.stringify(target.label ? this.t(target.label) : target.text ?? (target.key ? this.t(target.key) : null))}; const own = (el) => [...el.childNodes].filter((n) => n.nodeType === 3).map((n) => n.textContent).join("").replace(/\\s+/g, " ").trim(); const select = all("select").filter(visible).find((s) => { const l = s.closest("label"); return l && (own(l) === label || own(l).startsWith(label + " (")); }); if (!select) return false; const o = [...select.options].find((o) => o.textContent.trim() === ${JSON.stringify(optionText)}); if (!o) return false; select.value = o.value; select.dispatchEvent(new Event("input", { bubbles: true })); select.dispatchEvent(new Event("change", { bubbles: true })); return true; })()`,
);
if (!ok) throw new Error(`no drop-down option: ${optionText}`);
await sleep(500);
await this.frame();
this.hold(0.5);
}
// ------------------------------------------------------------------ pointing things out
/** A pulsing frame around an area of the screen (null removes it). */
async spot(rect, { pad = 6 } = {}) {
if (rect && rect.w === undefined && rect.x !== undefined) rect = null;
await this.page.evaluate((r, p) => window.__tut.spot(r, p), rect, pad);
}
async spotAt(target, opts) {
const at = await this.locate(target);
await this.spot({ left: at.left, top: at.top, w: at.w, h: at.h }, opts);
return at;
}
/** A frame around several things at once (a toolbar). */
async spotUnion(targets, opts) {
const rects = [];
for (const t of targets) rects.push(await this.locate(t));
const left = Math.min(...rects.map((r) => r.left));
const top = Math.min(...rects.map((r) => r.top));
const right = Math.max(...rects.map((r) => r.left + r.w));
const bottom = Math.max(...rects.map((r) => r.top + r.h));
await this.spot({ left, top, w: right - left, h: bottom - top }, opts);
}
/** A small note in the picture (a keyboard shortcut, a value). */
async note(text) {
await this.page.evaluate((t) => window.__tut.note(t), text);
}
/** Picks a device in an entity field: the pointer goes to the field under the label, the search text is typed and the entry clicked. */
async pick(labelKey, query, optionText) {
const label = this.t(labelKey);
const at = await this.page.evaluate(
`(() => { ${DEEP} const want = ${JSON.stringify(label)}; const lab = all("label, div, span").filter(visible).find((el) => { const own = [...el.childNodes].filter((n) => n.nodeType === 3).map((n) => n.textContent).join("").replace(/\\s+/g, " ").trim(); return own === want; }); if (!lab) return null; lab.scrollIntoView({ block: "center" }); const lr = lab.getBoundingClientRect(); const input = all("input").filter(visible).filter((i) => { const q = i.getBoundingClientRect(); return q.top >= lr.top + 4 && q.top - lr.bottom < 90 && q.left < lr.right + 40 && q.right > lr.left - 40; }).sort((x, y) => x.getBoundingClientRect().top - y.getBoundingClientRect().top)[0]; if (!input) return null; input.scrollIntoView({ block: "center" }); const r = input.getBoundingClientRect(); return { x: Math.round(r.left + Math.min(r.width / 2, 140)), y: Math.round(r.top + r.height / 2) }; })()`,
);
if (!at) throw new Error(`no entity field under: ${label}`);
await this.click(at, { after: 0.2 });
await this.page.keyboard.down("Control");
await this.page.keyboard.press("KeyA");
await this.page.keyboard.up("Control");
for (const ch of query) {
await this.page.keyboard.type(ch, { delay: 30 });
}
await this.show(1.2, 400);
try {
await this.click(optionText ? { text: optionText } : { css: "[role=option]", nth: 0 });
} catch (e) {
const seen = await this.page.evaluate(`(() => { ${DEEP} return all("li, [role=option], [role=listbox]").filter(visible).map((el) => textOf(el).slice(0, 50)).slice(0, 10); })()`);
console.log(" [pick] options seen:", JSON.stringify(seen));
await this.page.screenshot({ path: "/tmp/tut-dump.png" });
throw e;
}
}
/** Turns the 3D camera in small steps (a frame after each): angles in radians, distance as a factor. */
async orbit({ theta = 0, phi = 0, zoom = 1, frames = 20 } = {}) {
for (let i = 1; i <= frames; i++) {
await this.page.evaluate(
(k, t, p, z) => {
const v = document.querySelector("nextfloor-panel").shadowRoot.querySelector("nf-view3d");
if (!window.__orbit0) window.__orbit0 = v.viewer.getView();
const w = { ...window.__orbit0 };
w.theta = window.__orbit0.theta + t * k;
w.phi = Math.min(1.3, Math.max(0.15, window.__orbit0.phi + p * k));
w.radius = window.__orbit0.radius * (1 + (z - 1) * k);
v.viewer.flyTo(w, 1);
},
i / frames,
theta,
phi,
zoom,
);
await sleep(80);
await this.frame();
}
await this.page.evaluate(() => {
const v = document.querySelector("nextfloor-panel").shadowRoot.querySelector("nf-view3d");
window.__orbit0 = v.viewer.getView();
});
}
/** Opens another page of the demo (the overlay is put on again). */
async navigate(query) {
await this.page.goto(`${this.base}/preview/index.html?noshowcase&lang=${this.lang}&ha=dark${query ? "&" + query : ""}`, { waitUntil: "networkidle0", timeout: 180000 });
await sleep(1800);
await this.page.evaluate(OVERLAY);
const ok = await this.page.evaluate(() => !!window.__tut);
if (!ok) throw new Error("overlay missing after navigation");
this.cursor = { x: 640, y: 360 };
}
/** After a click that reloads the page (the showcase pages): waits for it and puts the overlay on again. */
async reinject(ms = 3500) {
await sleep(ms);
await this.page.evaluate(OVERLAY);
await this.page.evaluate((x, y) => window.__tut.move(x, y), this.cursor.x, this.cursor.y);
}
/** For writing episodes: what is on screen right now (buttons, fields) and a screenshot at /tmp/tut-dump.png. */
async dump(label = "") {
const list = await this.page.evaluate(`(() => { ${DEEP} return all("button, select, input, summary, label, h3").filter(visible).map((el) => el.tagName.toLowerCase() + ":" + (textOf(el).slice(0, 60) || el.getAttribute("aria-label") || el.title || el.placeholder || el.type)); })()`);
console.log(`--- ${label}\n` + list.join("\n"));
await this.page.screenshot({ path: "/tmp/tut-dump.png" });
}
// ------------------------------------------------------------------ the page
eval(code, ...args) {
return this.page.evaluate(code, ...args);
}
async stateJson() {
return this.page.evaluate(() => window.nfDemoState());
}
// ------------------------------------------------------------------ writing the results
async finish(name) {
this.endSegment();
await this.browser.close();
this.server.close();
const dir = this.out;
const concat = this.frames.map((f) => `file '${f.file}'\nduration ${f.dur.toFixed(4)}`).join("\n") + `\nfile '${this.frames.at(-1).file}'\n`;
writeFileSync(join(dir, `${name}.concat.txt`), concat);
writeFileSync(join(dir, `${name}.segments.json`), JSON.stringify({ lang: this.lang, seconds: this.time, chapters: this.chapters, segments: this.segments }, null, 1));
return { seconds: this.time, frames: this.frames.length, segments: this.segments.length };
}
}
/** The things drawn over the page: the mouse pointer, a click ripple, a spotlight frame, a note and the chapter card. */
const OVERLAY = `(() => {
if (window.__tut) return;
const layer = document.createElement("div");
layer.style.cssText = "position:fixed;inset:0;pointer-events:none;z-index:2147483647;font-family:Roboto,system-ui,sans-serif";
layer.innerHTML = \`
<div id="t-spot" style="position:absolute;display:none;border:3px solid #ffb547;border-radius:12px;box-shadow:0 0 0 9999px rgba(0,0,0,.35),0 0 18px #ffb547"></div>
<svg id="t-cursor" width="28" height="28" viewBox="0 0 28 28" style="position:absolute;left:0;top:0;filter:drop-shadow(0 2px 3px rgba(0,0,0,.6))"><path d="M4 2l17 10-7.5 1.8L17 22l-3.2 1.4L10.3 15 4 20z" fill="#fff" stroke="#111" stroke-width="1.6" stroke-linejoin="round"/></svg>
<div id="t-ripple" style="position:absolute;width:44px;height:44px;margin:-22px 0 0 -22px;border-radius:50%;border:4px solid #03a9f4;display:none"></div>
<div id="t-note" style="position:absolute;left:50%;bottom:34px;transform:translateX(-50%);display:none;padding:10px 20px;border-radius:12px;background:rgba(20,22,28,.94);color:#fff;font-size:22px;font-weight:600;box-shadow:0 6px 24px rgba(0,0,0,.5)"></div>
<div id="t-card" style="position:absolute;inset:0;display:none;place-items:center;background:radial-gradient(circle at 30% 20%,#14324a,#0a0f18);color:#fff;text-align:center"><div><div id="t-card-title" style="font-size:54px;font-weight:700;letter-spacing:.02em"></div><div id="t-card-sub" style="margin-top:14px;font-size:26px;color:#9fd6ff"></div></div></div>\`;
document.body.appendChild(layer);
const $ = (id) => layer.querySelector("#" + id);
window.__tut = {
move(x, y) { $("t-cursor").style.transform = "translate(" + (x - 5) + "px," + (y - 3) + "px)"; },
ripple(x, y) { const r = $("t-ripple"); r.style.left = x + "px"; r.style.top = y + "px"; r.style.display = "block"; r.animate([{ transform: "scale(.4)", opacity: 1 }, { transform: "scale(1.6)", opacity: 0 }], { duration: 450 }).onfinish = () => (r.style.display = "none"); },
spot(rect, pad) { const s = $("t-spot"); if (!rect) { s.style.display = "none"; return; } s.style.display = "block"; s.style.left = rect.left - pad + "px"; s.style.top = rect.top - pad + "px"; s.style.width = rect.w + 2 * pad + "px"; s.style.height = rect.h + 2 * pad + "px"; },
note(text) { const n = $("t-note"); if (!text) { n.style.display = "none"; return; } n.textContent = text; n.style.display = "block"; },
card(title, sub) { const c = $("t-card"); if (title === null) { c.style.display = "none"; return; } $("t-card-title").textContent = title; $("t-card-sub").textContent = sub || ""; c.style.display = "grid"; },
};
window.__tut.move(640, 360);
})()`;
+79
View File
@@ -0,0 +1,79 @@
// Records the tutorial episode by episode. Each episode starts where the one before it ended (its plan is handed on as JSON), so one
// episode can be recorded again without redoing the others.
// node tutorial/record.mjs 1 records episode 1 (the empty start)
// node tutorial/record.mjs 3 4 records 3 and 4 (needs the plan left by episode 2)
// node tutorial/record.mjs all
// Env: LANG_UI=en|de (language of the app in the picture), OUT=<dir> (default frontend/tutorial/out/<lang>)
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { pathToFileURL } from "node:url";
import { translate } from "../src/i18n.ts";
import { Recorder } from "./rec.mjs";
const lang = process.env.LANG_UI === "de" ? "de" : "en";
const outRoot = process.env.OUT ?? `${import.meta.dirname}/out/${lang}`;
const files = readdirSync(join(import.meta.dirname, "episodes")).filter((f) => f.endsWith(".mjs")).sort();
const wanted = process.argv.slice(2);
// development: SCRATCH=/path/to/episode.mjs FROM=<episode whose end plan is the start> node tutorial/record.mjs scratch
if (wanted[0] === "scratch") {
const t = (key, vars) => translate({ language: lang }, key, vars);
const episode = await import(pathToFileURL(process.env.SCRATCH).href);
const dir = "/tmp/tut-scratch";
mkdirSync(dir, { recursive: true });
const from = join(outRoot, "state", `ep${String(process.env.FROM ?? 1).padStart(2, "0")}.json`);
const served = join(import.meta.dirname, "..", "..", "preview", ".tutorial-state.json");
writeFileSync(served, readFileSync(from));
const r = new Recorder({ out: dir, lang, t });
await r.start({ query: "state=/preview/.tutorial-state.json" });
try {
await episode.run(r);
} catch (e) {
console.log("FAILED:", e.message);
await r.page.screenshot({ path: "/tmp/tut-dump.png" });
}
await r.browser.close();
r.server.close();
process.exit(0);
}
const numbers = wanted.includes("all") || !wanted.length ? files.map((_, i) => i + 1) : wanted.map(Number);
mkdirSync(join(outRoot, "state"), { recursive: true });
const t = (key, vars) => translate({ language: lang }, key, vars);
for (const n of numbers) {
const file = files[n - 1];
if (!file) throw new Error(`no episode ${n}`);
const episode = await import(pathToFileURL(join(import.meta.dirname, "episodes", file)).href);
const name = `ep${String(n).padStart(2, "0")}`;
const dir = join(outRoot, name);
mkdirSync(dir, { recursive: true });
const previous = join(outRoot, "state", `ep${String(n - 1).padStart(2, "0")}.json`);
let query = "empty";
if (n > 1) {
if (!existsSync(previous)) throw new Error(`episode ${n} needs ${previous} (record episode ${n - 1} first)`);
query = `state=/${join("nextfloor-launch-state", String(n))}`; // replaced below
}
const r = new Recorder({ out: dir, lang, t });
if (n > 1) {
// the page can only fetch from the static server: copy the state into the repository's tmp folder, which is served
const served = join(import.meta.dirname, "..", "..", "preview", ".tutorial-state.json");
writeFileSync(served, readFileSync(previous));
query = "state=/preview/.tutorial-state.json";
}
console.log(`\n=== episode ${n}: ${episode.title.en} (${lang})`);
const t0 = Date.now();
await r.start({ query: [query, episode.query].filter(Boolean).join("&") });
try {
await episode.run(r);
} catch (e) {
console.log("FAILED at", r.time.toFixed(1), "s:", e.message, "\n", String(e.stack).split("\n").slice(0, 5).join("\n"));
await r.page.screenshot({ path: join(dir, "failure.png") });
await r.browser.close();
r.server.close();
process.exit(1);
}
// an episode that leaves for another page (the model showcase) hands on the plan it was given
if (episode.keepState) writeFileSync(join(outRoot, "state", `${name}.json`), readFileSync(previous));
else writeFileSync(join(outRoot, "state", `${name}.json`), JSON.stringify(await r.stateJson(), null, 1));
const done = await r.finish(name);
console.log(`episode ${n}: ${done.seconds.toFixed(0)} s of video, ${done.frames} frames, ${done.segments} narration segments, recorded in ${Math.round((Date.now() - t0) / 1000)} s`);
}
+71
View File
@@ -0,0 +1,71 @@
// A small binary glTF made by hand (a stretched sphere and a flat box), for showing the model upload.
import { writeFileSync } from "node:fs";
export function writeSampleGlb(path) {
writeFileSync(path, Uint8Array.from(makeGlb()));
return path;
}
function makeGlb() {
const sphere = { positions: [], indices: [] };
const rings = 60;
const segments = 80;
for (let r = 0; r <= rings; r++) {
for (let s = 0; s < segments; s++) {
const phi = (r / rings) * Math.PI;
const theta = (s / segments) * Math.PI * 2;
// stretched along x like a car, so the front can be told from the side
sphere.positions.push(2 * Math.sin(phi) * Math.cos(theta), 0.7 * Math.cos(phi) + 0.7, Math.sin(phi) * Math.sin(theta));
}
}
for (let r = 0; r < rings; r++) {
for (let s = 0; s < segments; s++) {
const a = r * segments + s;
const b = r * segments + ((s + 1) % segments);
sphere.indices.push(a, a + segments, b, b, a + segments, b + segments);
}
}
const box = { positions: [-0.5, 1.5, -0.5, 0.5, 1.5, -0.5, 0.5, 1.5, 0.5, -0.5, 1.5, 0.5, -0.5, 1.8, -0.5, 0.5, 1.8, -0.5, 0.5, 1.8, 0.5, -0.5, 1.8, 0.5], indices: [0, 1, 2, 0, 2, 3, 4, 6, 5, 4, 7, 6, 0, 4, 5, 0, 5, 1, 1, 5, 6, 1, 6, 2, 2, 6, 7, 2, 7, 3, 3, 7, 4, 3, 4, 0] };
const chunks = [];
const views = [];
const accessors = [];
const add = (typed, target, type, componentType, count, extra = {}) => {
const bytes = new Uint8Array(typed.buffer);
const offset = chunks.reduce((n, c) => n + c.length, 0);
views.push({ buffer: 0, byteOffset: offset, byteLength: bytes.length, target });
accessors.push({ bufferView: views.length - 1, componentType, count, type, ...extra });
chunks.push(bytes);
return accessors.length - 1;
};
const prims = [sphere, box].map((m, i) => {
const p = Float32Array.from(m.positions);
const x = [0, 0, 0];
const lo = [Infinity, Infinity, Infinity];
const hi = [-Infinity, -Infinity, -Infinity];
for (let k = 0; k < p.length; k += 3) for (let j = 0; j < 3; j++) { lo[j] = Math.min(lo[j], p[k + j]); hi[j] = Math.max(hi[j], p[k + j]); }
const pos = add(p, 34962, "VEC3", 5126, p.length / 3, { min: lo, max: hi });
const idx = add(Uint32Array.from(m.indices), 34963, "SCALAR", 5125, m.indices.length);
return { attributes: { POSITION: pos }, indices: idx, material: i };
});
const total = chunks.reduce((n, c) => n + c.length, 0);
const bin = new Uint8Array(total);
let at = 0;
for (const c of chunks) { bin.set(c, at); at += c.length; }
const json = { asset: { version: "2.0" }, scene: 0, scenes: [{ nodes: [0] }], nodes: [{ mesh: 0 }], meshes: [{ primitives: prims }], materials: [{ name: "Body", pbrMetallicRoughness: { baseColorFactor: [0.8, 0.1, 0.1, 1] } }, { name: "Glass", alphaMode: "BLEND", pbrMetallicRoughness: { baseColorFactor: [0.6, 0.8, 0.9, 0.3] } }], buffers: [{ byteLength: total }], bufferViews: views, accessors };
let text = new TextEncoder().encode(JSON.stringify(json));
const padded = new Uint8Array(Math.ceil(text.length / 4) * 4).fill(0x20);
padded.set(text);
const out = new Uint8Array(12 + 8 + padded.length + 8 + bin.length);
const view = new DataView(out.buffer);
view.setUint32(0, 0x46546c67, true);
view.setUint32(4, 2, true);
view.setUint32(8, out.length, true);
view.setUint32(12, padded.length, true);
view.setUint32(16, 0x4e4f534a, true);
out.set(padded, 20);
const o = 20 + padded.length;
view.setUint32(o, bin.length, true);
view.setUint32(o + 4, 0x004e4942, true);
out.set(bin, o + 8);
return Array.from(out);
}
+54
View File
@@ -0,0 +1,54 @@
// Shortens every stretch without speech that is longer than MAX seconds, in picture and sound, and moves the subtitles along.
// Keeps the start and the end of such a stretch (so actions on screen stay smooth) and cuts out the middle.
// node tutorial/trim-silence.mjs <video-with-voice.mp4> <subtitles.srt> [max-seconds=2]
// Writes <video>.trimmed.mp4 and <srt>.trimmed.srt next to the inputs.
import { execFileSync, spawnSync } from "node:child_process";
import { readFileSync, writeFileSync } from "node:fs";
const [video, srt, maxArg] = process.argv.slice(2);
const MAX = Number(maxArg ?? 2);
if (!video || !srt) throw new Error("usage: node tutorial/trim-silence.mjs <video.mp4> <subtitles.srt> [max-seconds]");
const ffmpeg = execFileSync("python3", ["-c", "import imageio_ffmpeg;print(imageio_ffmpeg.get_ffmpeg_exe())"]).toString().trim();
// 1. where is nobody speaking
const detect = spawnSync(ffmpeg, ["-i", video, "-af", `silencedetect=noise=-38dB:d=${MAX}`, "-vn", "-f", "null", "-"], { encoding: "utf8", maxBuffer: 1 << 28 }).stderr;
const starts = [...detect.matchAll(/silence_start: ([\d.]+)/g)].map((m) => Number(m[1]));
const ends = [...detect.matchAll(/silence_end: ([\d.]+)/g)].map((m) => Number(m[1]));
const total = Number(/Duration: (\d+):(\d+):(\d+\.\d+)/.exec(detect).slice(1).reduce((a, v, i) => a + Number(v) * [3600, 60, 1][i], 0));
const silences = starts.map((s, i) => [s, ends[i] ?? total]).filter(([s, e]) => e - s > MAX + 0.05);
// 2. what to keep: all but the middle of each long silence (half of MAX stays on each side)
const half = MAX / 2;
const keep = [];
let at = 0;
for (const [s, e] of silences) {
keep.push([at, s + half]);
at = e - half;
}
keep.push([at, total]);
const cutTotal = silences.reduce((a, [s, e]) => a + (e - s - MAX), 0);
// 3. the new video
const parts = keep.map(([a, b], i) => `[0:v]trim=${a.toFixed(3)}:${b.toFixed(3)},setpts=PTS-STARTPTS[v${i}];[0:a]atrim=${a.toFixed(3)}:${b.toFixed(3)},asetpts=PTS-STARTPTS[a${i}]`);
const joined = keep.map((_, i) => `[v${i}][a${i}]`).join("") + `concat=n=${keep.length}:v=1:a=1[v][a]`;
const script = video.replace(/\.mp4$/, ".trim.filter.txt");
writeFileSync(script, parts.join(";\n") + ";\n" + joined);
const out = video.replace(/\.mp4$/, ".trimmed.mp4");
execFileSync(ffmpeg, ["-y", "-i", video, "-filter_complex_script", script, "-map", "[v]", "-map", "[a]", "-r", "12", "-c:v", "libx264", "-preset", "slow", "-crf", "30", "-tune", "stillimage", "-c:a", "aac", "-b:a", "96k", "-movflags", "+faststart", out], { stdio: "ignore" });
// 4. subtitles: a time t moves earlier by the cut parts before it
const shift = (t) => {
let cut = 0;
for (const [s, e] of silences) {
if (t >= e - half) cut += e - s - MAX;
else if (t > s + half) cut += t - (s + half);
else break;
}
return t - cut;
};
const clock = (s) => {
const ms = Math.round(s * 1000);
const p = (n, w = 2) => String(n).padStart(w, "0");
return `${p(Math.floor(ms / 3600000))}:${p(Math.floor(ms / 60000) % 60)}:${p(Math.floor(ms / 1000) % 60)},${p(ms % 1000, 3)}`;
};
const secs = (c) => { const [h, m, r] = c.replace(",", ".").split(":"); return Number(h) * 3600 + Number(m) * 60 + Number(r); };
const moved = readFileSync(srt, "utf8").replace(/(\d+:\d+:\d+,\d+) --> (\d+:\d+:\d+,\d+)/g, (_, a, b) => `${clock(shift(secs(a)))} --> ${clock(shift(secs(b)))}`);
writeFileSync(srt.replace(/\.srt$/, ".trimmed.srt"), moved);
console.log(`${silences.length} silences cut, ${cutTotal.toFixed(0)} s removed (${total.toFixed(0)} s → ${(total - cutTotal).toFixed(0)} s)\n${out}`);
+36
View File
@@ -0,0 +1,36 @@
// Makes one audio file per narration segment with Google Cloud Text-to-Speech (needs GOOGLE_TTS_API_KEY in the environment).
// GOOGLE_TTS_API_KEY=… node tutorial/tts-google.mjs <out-dir> [en|de] [voice]
// Files are named 001.mp3 …, ready for `node tutorial/voiceover.mjs <out-dir> <lang>`. Existing files are kept, so a run can continue.
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { join } from "node:path";
const out = process.argv[2];
const spoken = process.argv[3] === "de" ? "de" : "en";
const voice = process.argv[4] ?? (spoken === "de" ? "de-DE-Chirp3-HD-Charon" : "en-US-Chirp3-HD-Charon");
const key = process.env.GOOGLE_TTS_API_KEY;
const lang = process.env.LANG_UI === "de" ? "de" : "en";
const root = process.env.OUT ?? `${import.meta.dirname}/out/${lang}`;
if (!out || !key) throw new Error("usage: GOOGLE_TTS_API_KEY=… node tutorial/tts-google.mjs <out-dir> [en|de] [voice]");
mkdirSync(out, { recursive: true });
const { segments } = JSON.parse(readFileSync(join(root, "narration.json"), "utf8"));
let chars = 0;
for (const s of segments) {
const file = join(out, `${String(s.id).padStart(3, "0")}.mp3`);
if (existsSync(file)) continue;
for (let attempt = 1; ; attempt++) {
const res = await fetch(`https://texttospeech.googleapis.com/v1/text:synthesize?key=${key}`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ input: { text: s[spoken] }, voice: { languageCode: voice.slice(0, 5), name: voice }, audioConfig: { audioEncoding: "MP3", speakingRate: 0.98 } }),
});
if (res.ok) {
writeFileSync(file, Buffer.from((await res.json()).audioContent, "base64"));
chars += s[spoken].length;
break;
}
if (attempt >= 5) throw new Error(`segment ${s.id}: HTTP ${res.status} ${(await res.text()).slice(0, 200)}`);
await new Promise((ok) => setTimeout(ok, 1500 * attempt));
}
if (s.id % 20 === 0) console.log(`${s.id}/${segments.length}`);
}
console.log(`done, ${chars} characters sent to the voice service`);
+74
View File
@@ -0,0 +1,74 @@
// Puts a voice-over on the silent tutorial video. The voice comes from you (an AI voice, for example): one audio file per narration
// segment, named by the segment's number (001.mp3 … or .wav, .m4a, .ogg), made from the texts in narration.<lang>.txt.
// Where a spoken segment is longer than its time in the video, the picture is held a little longer (nothing is cut), so the voice
// never overlaps the next segment. Writes the video with sound, subtitles that match the new timing and a list of the changes.
// node tutorial/voiceover.mjs <audio-dir> [de|en] (LANG_UI picks the folder of the recording, default en)
import { execFileSync } from "node:child_process";
import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";
const audioDir = process.argv[2];
const spoken = process.argv[3] === "de" ? "de" : "en";
const lang = process.env.LANG_UI === "de" ? "de" : "en";
const root = process.env.OUT ?? `${import.meta.dirname}/out/${lang}`;
if (!audioDir || !existsSync(audioDir)) throw new Error("usage: node tutorial/voiceover.mjs <audio-dir> [de|en]");
const ffmpeg = execFileSync("python3", ["-c", "import imageio_ffmpeg;print(imageio_ffmpeg.get_ffmpeg_exe())"]).toString().trim();
const probe = (file) => {
try {
execFileSync(ffmpeg, ["-i", file], { stdio: ["ignore", "pipe", "pipe"] });
} catch (e) {
const m = /Duration: (\d+):(\d+):(\d+\.\d+)/.exec(String(e.stderr));
if (m) return Number(m[1]) * 3600 + Number(m[2]) * 60 + Number(m[3]);
}
throw new Error(`cannot read the length of ${file}`);
};
const narration = JSON.parse(readFileSync(join(root, "narration.json"), "utf8"));
const files = new Map(readdirSync(audioDir).map((f) => [Number.parseInt(f, 10), join(audioDir, f)]).filter(([n]) => Number.isFinite(n)));
const GAP = 0.35; // a breath between two segments
// 1. how much longer each segment has to be
let shift = 0;
const plan = narration.segments.map((s) => {
const file = files.get(s.id);
const length = file ? probe(file) : 0;
const slot = s.end - s.start;
const extra = Math.max(0, length + GAP - slot);
const entry = { ...s, file, length, extra, start2: s.start + shift, end2: s.end + shift + extra };
shift += extra;
return entry;
});
// 2. the picture: the last frame of a segment stays on for the extra time
const lines = readFileSync(join(root, "all.concat.txt"), "utf8").split("\n");
const frames = [];
for (let i = 0; i < lines.length; i++) if (lines[i].startsWith("file ")) frames.push({ file: lines[i], dur: lines[i + 1]?.startsWith("duration") ? Number(lines[i + 1].split(" ")[1]) : 0 });
let t = 0;
let next = 0;
const retimed = [];
for (const f of frames) {
let dur = f.dur;
t += f.dur;
while (next < plan.length && plan[next].end <= t + 1e-6) {
dur += plan[next].extra;
next++;
}
retimed.push({ file: f.file, dur });
}
writeFileSync(join(root, "voice.concat.txt"), retimed.map((f) => `${f.file}\nduration ${f.dur.toFixed(4)}`).join("\n") + `\n${retimed.at(-1).file}\n`);
// 3. the sound: every file starts where its segment starts
const inputs = plan.filter((p) => p.file);
const args = ["-y", "-f", "concat", "-safe", "0", "-i", join(root, "voice.concat.txt")];
for (const p of inputs) args.push("-i", p.file);
const delays = inputs.map((p, i) => `[${i + 1}:a]adelay=${Math.round(p.start2 * 1000)}|${Math.round(p.start2 * 1000)}[a${i}]`);
const mix = `${delays.join(";")};${inputs.map((_, i) => `[a${i}]`).join("")}amix=inputs=${inputs.length}:normalize=0:dropout_transition=0[voice]`;
const out = join(root, `nextfloor-tutorial.${lang}.voice-${spoken}.mp4`);
writeFileSync(join(root, "voice.filter.txt"), mix);
execFileSync(ffmpeg, [...args, "-filter_complex_script", join(root, "voice.filter.txt"), "-map", "0:v", "-map", "[voice]", "-vf", "fps=30,format=yuv420p", "-c:v", "libx264", "-preset", "medium", "-crf", "20", "-c:a", "aac", "-b:a", "160k", "-movflags", "+faststart", out], { stdio: "inherit" });
// 4. subtitles in the new timing
const clock = (s) => {
const ms = Math.round(s * 1000);
const p = (n, w = 2) => String(n).padStart(w, "0");
return `${p(Math.floor(ms / 3600000))}:${p(Math.floor(ms / 60000) % 60)}:${p(Math.floor(ms / 1000) % 60)},${p(ms % 1000, 3)}`;
};
writeFileSync(join(root, `nextfloor-tutorial.${spoken}.voice.srt`), plan.map((p, i) => `${i + 1}\n${clock(p.start2)} --> ${clock(p.end2)}\n${p[spoken]}\n`).join("\n"));
console.log(`${out}\n${plan.filter((p) => p.extra > 0).length} of ${plan.length} segments needed the picture held longer (${shift.toFixed(0)} s in all); ${plan.length - inputs.length} had no audio file`);