markdown fixes

This commit is contained in:
Loren Norman 2025-08-21 16:09:06 -04:00
parent b1f4217d81
commit 6e1a6cdea5

View file

@ -52,72 +52,72 @@ export default {
### 🏷 Creating Labels with Values ### 🏷 Creating Labels with Values
**Temperature Label:** **Temperature Label:**
```js \`\`\`js
A: "Kitchen Temp: " A: "Kitchen Temp: "
B: {{ feeds['sensors.kitchen_temp'].value }} B: {{ feeds['sensors.kitchen_temp'].value }}
// Output: "Kitchen Temp: 72.5" // Output: "Kitchen Temp: 72.5"
``` \`\`\`
**Device Status:** **Device Status:**
```js \`\`\`js
A: "Door is " A: "Door is "
B: {{ feeds['security.door'].value }} B: {{ feeds['security.door'].value }}
// Output: "Door is OPEN" or "Door is CLOSED" // Output: "Door is OPEN" or "Door is CLOSED"
``` \`\`\`
### 📊 Building Status Messages ### 📊 Building Status Messages
**Battery Level:** **Battery Level:**
```js \`\`\`js
A: "Battery at " A: "Battery at "
B: {{ vars.battery_percent }}% B: {{ vars.battery_percent }}%
// Output: "Battery at 85%" // Output: "Battery at 85%"
``` \`\`\`
**Sensor with Units:** **Sensor with Units:**
```js \`\`\`js
A: {{ feeds['sensors.humidity'].value }} A: {{ feeds['sensors.humidity'].value }}
B: "% humidity" B: "% humidity"
// Output: "65% humidity" // Output: "65% humidity"
``` \`\`\`
### 👤 Personalizing Messages ### 👤 Personalizing Messages
**Welcome Message:** **Welcome Message:**
```js \`\`\`js
A: "Welcome back, " A: "Welcome back, "
B: {{ user.name }} B: {{ user.name }}
// Output: "Welcome back, John Smith" // Output: "Welcome back, John Smith"
``` \`\`\`
**Custom Greeting:** **Custom Greeting:**
```js \`\`\`js
A: {{ vars.greeting }} A: {{ vars.greeting }}
B: {{ user.username }} B: {{ user.username }}
// Output: "Hello, jsmith123" // Output: "Hello, jsmith123"
``` \`\`\`
### 🔗 Creating URLs and Paths ### 🔗 Creating URLs and Paths
::: code-group ::: code-group
```js [API Endpoint] \`\`\`js [API Endpoint]
A: "https://api.example.com/sensors/" A: "https://api.example.com/sensors/"
B: {{ vars.sensor_id }} B: {{ vars.sensor_id }}
// Output: "https://api.example.com/sensors/temp_01" // Output: "https://api.example.com/sensors/temp_01"
``` \`\`\`
```js [File Path] \`\`\`js [File Path]
A: "/data/" A: "/data/"
B: {{ vars.filename }} B: {{ vars.filename }}
// Output: "/data/readings_2024.csv" // Output: "/data/readings_2024.csv"
``` \`\`\`
::: :::
### 🎨 Formatting with Symbols ### 🎨 Formatting with Symbols
```js \`\`\`js
// Arrow Indicators // Arrow Indicators
A: "Temperature " A: "Temperature "
B: "↑ Rising" B: "↑ Rising"
@ -127,7 +127,7 @@ export default {
A: "🔋 " A: "🔋 "
B: {{ vars.battery_status }} B: {{ vars.battery_status }}
// Output: "🔋 Charging" or "🔋 Full" // Output: "🔋 Charging" or "🔋 Full"
``` \`\`\`
## Advanced Patterns ## Advanced Patterns
@ -135,7 +135,7 @@ export default {
Sometimes you need to combine more than two pieces of text. Use multiple Join Text blocks: Sometimes you need to combine more than two pieces of text. Use multiple Join Text blocks:
**Three-Part Message:** **Three-Part Message:**
```js \`\`\`js
// First Join // First Join
A: "Hello, " A: "Hello, "
B: {{ user.name }} B: {{ user.name }}
@ -145,12 +145,12 @@ export default {
A: [First Join Output] A: [First Join Output]
B: "! Welcome back." B: "! Welcome back."
// Final Output: "Hello, John! Welcome back." // Final Output: "Hello, John! Welcome back."
``` \`\`\`
::: :::
::: details Building Complex Messages ::: details Building Complex Messages
**Multi-Line Status Report (using \\n for line breaks):** **Multi-Line Status Report (using \\n for line breaks):**
```js \`\`\`js
// First Join // First Join
A: "System Status\\n" A: "System Status\\n"
B: "Temperature: OK\\n" B: "Temperature: OK\\n"
@ -169,16 +169,16 @@ export default {
Humidity: OK Humidity: OK
Battery: Low Battery: Low
*/ */
``` \`\`\`
::: :::
::: details Conditional Text Building ::: details Conditional Text Building
Combine with logic blocks to build different messages: Combine with logic blocks to build different messages:
```js \`\`\`js
A: "Sensor " A: "Sensor "
B: [If temperature > 80 then "⚠️ HOT" else "✓ Normal"] B: [If temperature > 80 then "⚠️ HOT" else "✓ Normal"]
// Output: "Sensor ⚠️ HOT" or "Sensor ✓ Normal" // Output: "Sensor ⚠️ HOT" or "Sensor ✓ Normal"
``` \`\`\`
::: :::
## Common Patterns & Tips ## Common Patterns & Tips
@ -186,31 +186,32 @@ export default {
::: details 1. Don't Forget Spaces! ::: details 1. Don't Forget Spaces!
::: danger Common Mistake ::: danger Common Mistake
Forgetting to add spaces is the #1 beginner error! Forgetting to add spaces is the #1 beginner error!
:::
**Wrong:** **Wrong:**
```js \`\`\`js
A: "Hello" A: "Hello"
B: "World" B: "World"
// Output: "HelloWorld" ❌ // Output: "HelloWorld" ❌
``` \`\`\`
**Right:** **Right:**
```js \`\`\`js
A: "Hello " // Space at the end A: "Hello " // Space at the end
B: "World" B: "World"
// Output: "Hello World" ✅ // Output: "Hello World" ✅
``` \`\`\`
**Also Right:** **Also Right:**
```js \`\`\`js
A: "Hello" A: "Hello"
B: " World" // Space at the beginning B: " World" // Space at the beginning
// Output: "Hello World" ✅ // Output: "Hello World" ✅
``` \`\`\`
::: :::
::: details 2. Adding Separators ::: details 2. Adding Separators
::: v-pre
| Separator | Input A | Input B | Output | | Separator | Input A | Input B | Output |
|-----------|---------|---------|--------| |-----------|---------|---------|--------|
| **Comma** | \`{{ vars.city }}\` | \`", USA"\` | \`"Boston, USA"\` | | **Comma** | \`{{ vars.city }}\` | \`", USA"\` | \`"Boston, USA"\` |
@ -219,7 +220,7 @@ export default {
::: :::
::: details 3. Building Lists ::: details 3. Building Lists
```js \`\`\`js
// Bullet Point // Bullet Point
A: "• " A: "• "
B: {{ vars.item_name }} B: {{ vars.item_name }}
@ -229,12 +230,12 @@ export default {
A: "1. " A: "1. "
B: {{ vars.first_step }} B: {{ vars.first_step }}
// Output: "1. Check connections" // Output: "1. Check connections"
``` \`\`\`
::: :::
::: details 4. Combining Numbers and Text ::: details 4. Combining Numbers and Text
When joining numbers with text, the number is automatically converted: When joining numbers with text, the number is automatically converted:
```js \`\`\`js
A: "Count: " A: "Count: "
B: {{ vars.sensor_count }} B: {{ vars.sensor_count }}
// Output: "Count: 5" // Output: "Count: 5"
@ -242,12 +243,12 @@ export default {
A: {{ feeds['sensor'].value }} A: {{ feeds['sensor'].value }}
B: " degrees" B: " degrees"
// Output: "72.5 degrees" // Output: "72.5 degrees"
``` \`\`\`
::: :::
::: details 5. Empty String Handling ::: details 5. Empty String Handling
If one input is empty, you get just the other input: If one input is empty, you get just the other input:
```js \`\`\`js
A: "Hello" A: "Hello"
B: "" B: ""
// Output: "Hello" // Output: "Hello"
@ -255,14 +256,14 @@ export default {
A: "" A: ""
B: "World" B: "World"
// Output: "World" // Output: "World"
``` \`\`\`
::: :::
## Working with Other Blocks ## Working with Other Blocks
::: details Join + Text Template ::: details Join + Text Template
Use Join Text to prepare strings for templates: Use Join Text to prepare strings for templates:
```js \`\`\`js
// Join to create feed key // Join to create feed key
A: "sensor." A: "sensor."
B: {{ vars.location }} B: {{ vars.location }}
@ -270,29 +271,29 @@ export default {
// Then use in template // Then use in template
{{ feeds['[Join Output]'].value }} {{ feeds['[Join Output]'].value }}
``` \`\`\`
::: :::
::: details Join + Variables ::: details Join + Variables
Store joined text in a variable for reuse: Store joined text in a variable for reuse:
```js \`\`\`js
// Join // Join
A: "Alert: " A: "Alert: "
B: {{ vars.message }} B: {{ vars.message }}
// Store result in variable: "formatted_alert" // Store result in variable: "formatted_alert"
// Use later in multiple places // Use later in multiple places
``` \`\`\`
::: :::
::: details Join + Conditionals ::: details Join + Conditionals
Build different messages based on conditions: Build different messages based on conditions:
```js \`\`\`js
A: "Status: " A: "Status: "
B: [If block result] B: [If block result]
// Where If block returns "Online" or "Offline" // Where If block returns "Online" or "Offline"
// Output: "Status: Online" or "Status: Offline" // Output: "Status: Online" or "Status: Offline"
``` \`\`\`
::: :::
## Troubleshooting ## Troubleshooting
@ -304,12 +305,14 @@ export default {
::: :::
::: details Problem: Getting [object Object] in output ::: details Problem: Getting [object Object] in output
::: v-pre
**Solution:** Make sure you're passing text/string values, not complex objects. Use the .value or .name property of feeds: **Solution:** Make sure you're passing text/string values, not complex objects. Use the .value or .name property of feeds:
- Wrong: \`B: {{ feeds['sensor.temp'] }}\` - Wrong: \`B: {{ feeds['sensor.temp'] }}\`
- Right: \`B: {{ feeds['sensor.temp'].value }}\` - Right: \`B: {{ feeds['sensor.temp'].value }}\`
::: :::
::: details Problem: Numbers not displaying correctly ::: details Problem: Numbers not displaying correctly
::: v-pre
**Solution:** Numbers are automatically converted to text. For formatting, use a Text Template block first: **Solution:** Numbers are automatically converted to text. For formatting, use a Text Template block first:
- Basic: \`A: "Price: $" B: {{ vars.price }}\`\`"Price: $9.99"\` - Basic: \`A: "Price: $" B: {{ vars.price }}\`\`"Price: $9.99"\`
- Formatted: Use template with \`{{ vars.price | round: 2 }}\` first - Formatted: Use template with \`{{ vars.price | round: 2 }}\` first