Changed cell-temp-card to suit my MegaD Wallmount sensors, which have temperature, humidity, lightlevel, co2 and motion sensors inside.
Code for temperature card:
uid: Cell_Temp_Card_2
tags:
- temperature
- humidity
- co
- motion
props:
parameters:
- description: Small title on top of the card
label: Title
name: title
required: false
type: TEXT
- description: Icon on top of the card (only f7 icons (without f7:))
label: Icon
name: icon
required: false
type: TEXT
- description: Background image name
label: Background image
name: bg_image_url
required: false
type: TEXT
- description: in rgba() or HEX or empty
label: Background Color
name: bgcolor
required: false
type: TEXT
- context: item
label: Temperature
name: temp_item
required: false
type: TEXT
- context: item
label: Lightlevel
name: lightlevel_item
required: false
type: TEXT
- context: item
label: Humidity
name: humidity_item
required: false
type: TEXT
- context: item
label: CO
name: CO_item
required: false
type: TEXT
- context: item
label: Motion item
name: motion_item
required: false
type: TEXT
parameterGroups: []
timestamp: Aug 1, 2021, 2:48:53 PM
component: f7-card
config:
style:
noShadow: false
padding: 0
margin: 5
border-radius: var(--f7-card-expandable-border-radius)
box-shadow: 5px 5px 10px 1px rgba(0,0,0,0.1)
background-color: "=props.bgcolor ? props.bgcolor : ''"
height: 150px
background-image: "=props.bg_image_url ? 'url(/static/' + (props.bg_image_url) + ')' : ''"
background-position: down;
background-repeat: no-repeat;
background-size: cover
background-brightness: 60%
font-size: medium
text-shadow: -1px -1px 0 black, 1px -1px 0 black, -1px 1px 0 black, 1px 1px 0 black
slots:
content:
- component: f7-card-header
config:
style:
padding: 0
margin-top: -15px
min-height: 30px
justify-content: flex-start
slots:
default:
- component: f7-icon
config:
f7: =props.icon
size: 20
visible: "=props.icon ? true : false"
- component: Label
config:
text: "=props.title ? props.title : ''"
style:
font-size: 18px
margin-left: 5px
- component: f7-card-content
config:
style:
padding: 0
margin-top: 5px
width: 100%
justify-content: flex-start
slots:
default:
- component: f7-row
config:
visible: "=props.temp_item ? true : false"
style:
justify-content: flex-start
slots:
default:
- component: oh-icon
config:
icon: temperature
item: =props.temp_item
width: 23
- component: Label
config:
text: =items[props.temp_item].state
style:
margin-left: 5px
color: '=(Number.parseFloat(items[props.temp_item].state.split(" ")[0]) > 30) ? "red" : (Number.parseFloat(items[props.temp_item].state.split(" ")[0]) < 10) ? "blue" : "white"'
- component: f7-row
config:
visible: "=props.humidity_item ? true : false"
style:
justify-content: flex-start
z-index: 2
slots:
default:
- component: oh-icon
config:
icon: humidity
item: =props.humidity_item
width: 23
action: analyser
actionAnalyzerItems: =props.humidity_item
- component: Label
config:
text: =items[props.humidity_item].state
style:
color: '=(Number.parseFloat(items[props.humidity_item].state.split(" ")[0]) < 35) ? "red" : (Number.parseFloat(items[props.humidity_item].state.split(" ")[0]) > 75) ? "green" : "white"'
margin-left: 5px
- component: f7-row
config:
visible: "=props.lightlevel_item ? true : false"
style:
justify-content: flex-start
z-index: 2
slots:
default:
- component: oh-icon
config:
icon: sun
width: 23
- component: Label
config:
text: =items[props.lightlevel_item].state
style:
color: "=(items[props.lightlevel_item].state < 5) ? 'gray' : 'white'"
margin-left: 5px
- component: f7-row
config:
visible: "=props.CO_item ? true : false"
style:
justify-content: flex-start
z-index: 2
slots:
default:
- component: oh-icon
config:
icon: carbondioxide
width: 23
- component: Label
config:
text: =items[props.CO_item].state
style:
color: '=(Number.parseFloat(items[props.CO_item].state.split(" ")[0]) > 1500) ? "red" : (Number.parseFloat(items[props.CO_item].state.split(" ")[0]) > 1000) ? "yellow"'
margin-left: 5px
- component: f7-col
config:
visible: "=props.motion_item ? true : false"
style:
position: absolute
top: 0px
right: 0px
z-index: 2
slots:
default:
- component: oh-icon
config:
icon: "=(items[props.motion_item].state === 'ON') ? 'mymotion-on' : 'mymotion-off'"
width: 30
- component: Label
config:
text: =items[props.motion_item].state
- component: f7-block
config:
style:
visible: "=props.temp_item ? true : false"
position: absolute
top: 10px
left: 10px
height: 300px
width: 100%
z-index: 1
slots:
default:
- component: oh-trend
config:
trendItem: =props.temp_item
trendGradient:
- "#d4220f"
- "#cc561e"
- "#ef8d32"
- "#beca5c"
style:
--f7-theme-color-bg-color: transparent
background: var(--f7-theme-color-bg-color)
filter: opacity(60%)
- component: oh-link
config:
actionAnalyzerChartType: day
action: analyzer
actionAnalyzerItems: "=props.CO_item ? [props.temp_item, props.humidity_item, props.lightlevel_item, props.CO_item] : (props.lightlevel_item ? [props.temp_item, props.humidity_item, props.lightlevel_item] : (props.humidity_item ? [props.temp_item, props.humidity_item] : [props.temp_item]))"
actionAnalyzerCoordSystem: time
style:
padding: 0
position: absolute
left: 0px
top: 0px
height: 100%
width: 100%
z-index: 3
For Yeelight control with [miio] binding:
uid: Cell_Temp_Card_2
tags:
- temperature
- humidity
- co
- motion
props:
parameters:
- description: Small title on top of the card
label: Title
name: title
required: false
type: TEXT
- description: Icon on top of the card (only f7 icons (without f7:))
label: Icon
name: icon
required: false
type: TEXT
- description: Background image name
label: Background image
name: bg_image_url
required: false
type: TEXT
- description: in rgba() or HEX or empty
label: Background Color
name: bgcolor
required: false
type: TEXT
- context: item
label: Temperature
name: temp_item
required: false
type: TEXT
- context: item
label: Lightlevel
name: lightlevel_item
required: false
type: TEXT
- context: item
label: Humidity
name: humidity_item
required: false
type: TEXT
- context: item
label: CO
name: CO_item
required: false
type: TEXT
- context: item
label: Motion item
name: motion_item
required: false
type: TEXT
parameterGroups: []
timestamp: Aug 1, 2021, 2:48:53 PM
component: f7-card
config:
style:
noShadow: false
padding: 0
margin: 5
border-radius: var(--f7-card-expandable-border-radius)
box-shadow: 5px 5px 10px 1px rgba(0,0,0,0.1)
background-color: "=props.bgcolor ? props.bgcolor : ''"
height: 150px
background-image: "=props.bg_image_url ? 'url(/static/' + (props.bg_image_url) + ')' : ''"
background-position: down;
background-repeat: no-repeat;
background-size: cover
background-brightness: 60%
font-size: medium
text-shadow: -1px -1px 0 black, 1px -1px 0 black, -1px 1px 0 black, 1px 1px 0 black
slots:
content:
- component: f7-card-header
config:
style:
padding: 0
margin-top: -15px
min-height: 30px
justify-content: flex-start
slots:
default:
- component: f7-icon
config:
f7: =props.icon
size: 20
visible: "=props.icon ? true : false"
- component: Label
config:
text: "=props.title ? props.title : ''"
style:
font-size: 18px
margin-left: 5px
- component: f7-card-content
config:
style:
padding: 0
margin-top: 5px
width: 100%
justify-content: flex-start
slots:
default:
- component: f7-row
config:
visible: "=props.temp_item ? true : false"
style:
justify-content: flex-start
slots:
default:
- component: oh-icon
config:
icon: temperature
item: =props.temp_item
width: 23
- component: Label
config:
text: =items[props.temp_item].state
style:
margin-left: 5px
color: '=(Number.parseFloat(items[props.temp_item].state.split(" ")[0]) > 30) ? "red" : (Number.parseFloat(items[props.temp_item].state.split(" ")[0]) < 10) ? "blue" : "white"'
- component: f7-row
config:
visible: "=props.humidity_item ? true : false"
style:
justify-content: flex-start
z-index: 2
slots:
default:
- component: oh-icon
config:
icon: humidity
item: =props.humidity_item
width: 23
action: analyser
actionAnalyzerItems: =props.humidity_item
- component: Label
config:
text: =items[props.humidity_item].state
style:
color: '=(Number.parseFloat(items[props.humidity_item].state.split(" ")[0]) < 35) ? "red" : (Number.parseFloat(items[props.humidity_item].state.split(" ")[0]) > 75) ? "green" : "white"'
margin-left: 5px
- component: f7-row
config:
visible: "=props.lightlevel_item ? true : false"
style:
justify-content: flex-start
z-index: 2
slots:
default:
- component: oh-icon
config:
icon: sun
width: 23
- component: Label
config:
text: =items[props.lightlevel_item].state
style:
color: "=(items[props.lightlevel_item].state < 5) ? 'gray' : 'white'"
margin-left: 5px
- component: f7-row
config:
visible: "=props.CO_item ? true : false"
style:
justify-content: flex-start
z-index: 2
slots:
default:
- component: oh-icon
config:
icon: carbondioxide
width: 23
- component: Label
config:
text: =items[props.CO_item].state
style:
color: '=(Number.parseFloat(items[props.CO_item].state.split(" ")[0]) > 1500) ? "red" : (Number.parseFloat(items[props.CO_item].state.split(" ")[0]) > 1000) ? "yellow"'
margin-left: 5px
- component: f7-col
config:
visible: "=props.motion_item ? true : false"
style:
position: absolute
top: 0px
right: 0px
z-index: 2
slots:
default:
- component: oh-icon
config:
icon: "=(items[props.motion_item].state === 'ON') ? 'mymotion-on' : 'mymotion-off'"
width: 30
- component: Label
config:
text: =items[props.motion_item].state
- component: f7-block
config:
style:
visible: "=props.temp_item ? true : false"
position: absolute
top: 10px
left: 10px
height: 300px
width: 100%
z-index: 1
slots:
default:
- component: oh-trend
config:
trendItem: =props.temp_item
trendGradient:
- "#d4220f"
- "#cc561e"
- "#ef8d32"
- "#beca5c"
style:
--f7-theme-color-bg-color: transparent
background: var(--f7-theme-color-bg-color)
filter: opacity(60%)
- component: oh-link
config:
actionAnalyzerChartType: day
action: analyzer
actionAnalyzerItems: "=props.CO_item ? [props.temp_item, props.humidity_item, props.lightlevel_item, props.CO_item] : (props.lightlevel_item ? [props.temp_item, props.humidity_item, props.lightlevel_item] : (props.humidity_item ? [props.temp_item, props.humidity_item] : [props.temp_item]))"
actionAnalyzerCoordSystem: time
style:
padding: 0
position: absolute
left: 0px
top: 0px
height: 100%
width: 100%
z-index: 3