Skip to content

Commit

Permalink
New Screens
Browse files Browse the repository at this point in the history
  • Loading branch information
timia2109 committed Apr 8, 2024
1 parent b2c1846 commit c373177
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 13 deletions.
12 changes: 6 additions & 6 deletions Resources/screens/_icon_data.sbntxt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{ func icon_data(sIconName, sText) }}
{{ if (sText | string.strip | string.size ) > 0}}
<HBox Gap="2">
<Icon IconName="{{sIconName}}" />
<Text Content="{{sText}}" />
</HBox>
{{ end }}
{{ if (sText | string.strip | string.size ) > 0}}
<HBox Gap="2">
<Icon IconName="{{sIconName}}" />
<Text Content="{{sText | html.escape}}" />
</HBox>
{{ end }}
{{ end }}
5 changes: 3 additions & 2 deletions Resources/screens/_media_player.sbntxt
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
{{ if state == "playing"
media_position = hass.get_attribute sPlayer "media_position" | to_float
media_duration = hass.get_attribute sPlayer "media_duration" | to_float
media_duration_ts = timespan.from_seconds media_duration
media_updated = hass.get_attribute sPlayer "media_position_updated_at" | date.parse

media_start = media_updated | date.add_seconds (-media_position)
media_end = media_start | date.add_seconds media_duration
}}
<Flexbox>
<Text Content="{{ media_updated | date.to_string "%T" }}" />
<Text Content="{{ media_end | date.to_string "%T" }}" />
{{ icon_data "timer" (timespan.to_string media_duration_ts "c") }}
{{ icon_data "clock" (media_end | date.to_string "%T") }}
</Flexbox>
{{ else if state == "paused"
icon_data "pause" " -&gt; Pausiert &lt;- "
Expand Down
20 changes: 20 additions & 0 deletions Resources/screens/_timer.sbntxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{ func timer() }}
{{
start_time = hass.get_datetime "input_datetime.googletimerstart"
end_time = hass.get_datetime "input_datetime.googletimerover"
timer_text = hass.get_state "input_text.countdown_text"
}}

{{ if start_time.year < 2000
ret 0
end}}

<VBox Gap="5">
<Text Content="{{ timer_text | html.escape }}" />
{{ icon_data "hourglass-start" (start_time | date.to_string "%T") }}
{{ icon_data "hourglass-end" (end_time | date.to_string "%T") }}
</VBox>

{{ ret 1 }}

{{ end }}
16 changes: 11 additions & 5 deletions Resources/screens/main.sbntxt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{{
include "_media_player"
include "_icon_data"
include "_timer"

items = 0

media_players = [
"media_player.buro",
Expand Down Expand Up @@ -31,19 +34,22 @@
<Border Bottom="2" />
</Flexbox>

<Flexbox AlignItems="Center">
<Flexbox>
{{ icon_data "couch" (hass.get_float_state "sensor.smart_hygrometer_0998_temperature" | math.round 2) + " °C"}}
{{ icon_data "cloud-sun" (hass.get_float_state "sensor.hue_outdoor_motion_sensor_1_temperature" | math.round 2) + " °C"}}
</Flexbox>

<Flexbox>
{{ icon_data "dumbbell" (hass.get_state "sensor.fitx_auslastung") + "%" }}
</Flexbox>

</VBox>

{{ for player in media_players
media_player player
end
}}
items += media_player player
end }}

<Text Content="Placeholder" />
{{ items += timer }}

<Margin All="1" />
</Flexbox>
Expand Down

0 comments on commit c373177

Please sign in to comment.