Hi all, need your help with watering widget. Here is what i`ve got:
uid: Watering_v1
tags: []
props:
parameters:
- description: A text prop
label: Prop 1
name: prop1
required: false
type: TEXT
- context: item
description: An item to control
label: Item
name: item
required: false
type: TEXT
parameterGroups: []
timestamp: Aug 8, 2021, 11:48:10 PM
component: f7-card
config:
style:
border-radius: var(--f7-card-expandable-border-radius)
box-shadow: 5px 5px 10px 1px rgba(0,0,0,0.1)
height: auto
margin: 5px
line-height: 1.2
font-family: sans-serif
class:
slots:
default:
- component: f7-card-header
config:
class:
- justify-content-center
- align-items-center
- text-align-center
slots:
default:
- component: Label
config:
text: Полив
style:
font-size: 250%
- component: f7-card-content
config:
style:
margin: 5px
padding: 0px
slots:
default:
- component: f7-row
slots:
default:
- component: f7-segmented
config:
strong: true
class:
- segmented-strong
style:
--f7-segmented-strong-padding: 5px
--f7-segmented-strong-between-buttons: 5px
--f7-segmented-strong-button-font-weight: 300
--f7-segmented-strong-bg-color: transparent
--f7-segmented-strong-button-hover-bg-color: rgba(255, 255, 255, 0.15)
width: 100%
outline: true
slots:
default:
- component: oh-button
config:
text: Утром
action: variable
actionVariable: select
actionVariableValue: 1
active: =(vars.select == 1)
outline: =(vars.select == 1)
style:
font-weight: 400
font-size: 150%
- component: oh-button
config:
text: Вечером
action: variable
actionVariable: select
actionVariableValue: 2
active: =(vars.select == 2)
outline: =(vars.select == 2)
style:
font-weight: 400
font-size: 150%
- component: oh-button
config:
text: Днём
action: variable
actionVariable: select
actionVariableValue: 3
active: =(vars.select == 3)
outline: =(vars.select == 3)
style:
font-weight: 400
font-size: 150%
- component: f7-block
config:
visible: =(vars.select == 1)
style:
animation: f7-fade-in 300ms
width: 99%
padding: 0px
margin: 5px
margin-right: 5px
class:
- display-flex
- justify-content-space-between
- flex-direction-column
slots:
default:
- component: f7-row
config:
style:
margin: 5px
width: 99%
font-size: 120%
slots:
default:
- component: Label
config:
text: Утренний полив
- component: oh-toggle
config:
item: =props.Power_item
color: green
- component: f7-row
config:
style:
margin: 5px
width: 99%
font-size: 120%
slots:
default:
- component: f7-row
config: {}
slots:
default:
- component: Label
config:
text: "Рассвет:"
style:
margin-right: 10px
- component: Label
config:
text: =items.Voshod.displayState
- component: f7-row
config: {}
slots:
default:
- component: Label
config:
text: Время после рассвета
style:
margin-right: 10px
- component: oh-link
config:
text: =items.IrrigationHoursAfterSunrise.state
action: popover
popoverOpen: .timerpopover
slots:
default:
- component: f7-popover
config:
class:
- timerpopover
slots:
default:
- component: oh-stepper-card
config:
item: IrrigationHoursAfterSunrise
title: Минут после рассвета
min: 0
max: 180
step: 10
- component: f7-row
config:
style:
margin: 5px
width: 99%
font-size: 120%
slots:
default:
- component: f7-row
config: {}
slots:
default:
- component: Label
config:
text: "Время начала полива:"
style:
margin-right: 10px
- component: Label
config:
text: =items.Voshod.displayState
- component: f7-row
config:
style:
margin: 10px
width: 96%
font-size: 120%
border: 1px solid
display: flex
slots:
default:
- component: oh-repeater
config:
fragment: false
for: item
sourceType: itemsInGroup
groupItem: GroupIrrigationValves
slots:
default:
- component: f7-row
config:
style:
border: 1px solid
slots:
default:
- component: oh-icon
config:
icon: water
width: 25px
- component: Label
config:
icon: oh:water
text: =loop.item.label
- component: oh-stepper
config:
item: =(loop.item.name + 'Time')
title: Время полива
min: 0
max: 180
step: 1
- component: f7-segmented
config:
strong: true
class:
- segmented-round
style:
--f7-segmented-strong-padding: 0px
--f7-segmented-strong-between-buttons: 5px
--f7-segmented-strong-button-font-weight: 300
--f7-segmented-strong-bg-color: transparent
--f7-segmented-strong-button-hover-bg-color: rgba(255, 255, 255, 0.15)
margin-top: 5px
slots:
default:
- component: oh-repeater
config:
fragment: true
for: day
sourceType: array
in:
- name: Mon
label: Пн
- name: Tue
label: Вт
- name: Wed
label: Ср
- name: Thu
label: Чт
- name: Fri
label: Пт
- name: Sat
label: Сб
- name: Sun
label: Вс
slots:
default:
- component: oh-button
config:
text: =loop.day.label
action: toggle
actionItem: =(loop.item.name + M + loop.day.name)
active: =(vars.select == 1)
style:
font-weight: 400
I can’t figure out, why f7-row inside oh-repeater is not using 100% width of previous row (I’ve drown borders to show what I mean).
And I can’t figure out, how to organize, store and use millions of 0-1 switches which I need to program my watering zones. I want to have 3 possible start times for every zone - morning, day, evening, and I want to choose, if a zone should be irrigated on Mondays and so on, and for every zone there should be two switches, defining if this zone should respect temperature correction and rainfall history. Some string with 0-1’s to store this data and then parsing this inside oh-repeaters and in rules?