Skip to content

Commit

Permalink
Adding Plant Card
Browse files Browse the repository at this point in the history
  • Loading branch information
avenger11 committed Jan 24, 2024
1 parent 8090f08 commit e0ff7b9
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 27 deletions.
2 changes: 1 addition & 1 deletion configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ scene: !include scenes.yaml
homekit: !include homekit.yaml
group: !include group.yaml
mqtt: !include mqtt.yaml
plant: !include plant.yaml
#plant: !include plant.yaml

# +----------------------------------------------------------------------------+
# | This is for the container health check |
Expand Down
98 changes: 72 additions & 26 deletions homeos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ homeos_configuration:
scene4: &config_scene4 'input_boolean.homeos_scene_morning_coffee'
scene4_icon: &config_scene4_icon 'icon_empty'


# Garbage Card Configuration
garbage: &config_garbage 'schedule.garbage'
recyling: &config_recycling 'schedule.recycle'
Expand All @@ -73,8 +72,15 @@ homeos_configuration:
travel_work: &config_travel_work 'sensor.seb_to_work'


# Plant Card
hum_plant_1: &config_hum_plant_1 'sensor.flower_care_hhccjcy01hhcc_moi_2'
# Plant Card 1
plant_1: &config_plant_1 'plant.pin_de_norfolks'
hum_plant_1: &config_hum_plant_1 'sensor.pin_de_norfolks_soil_moisture'
min_plant_1: &config_min_plant_1 'number.pin_de_norfolks_min_soil_moisture'

# Plant Card 2
plant_2: &config_plant_2 'plant.anthurium_2'
hum_plant_2: &config_hum_plant_2 'sensor.anthurium_soil_moisture_2'
min_plant_2: &config_min_plant_2 'number.anthurium_min_soil_moisture_2'

# ==============================================================================
# | Do not change code after this box |
Expand Down Expand Up @@ -383,7 +389,7 @@ views:
grid-template-areas: |
"weather weather map map map map person_car person_bus"
"weather weather map map map map garbage washer"
"weather weather map map map map plant ."
"weather weather map map map map . plant"
"calendar calendar map map map map 4 ."
"calendar calendar box box scene . 5 ."
Expand Down Expand Up @@ -606,29 +612,69 @@ views:
- sensor.seventeentrack_packages_ready_to_be_picked_up
- sensor.seventeentrack_packages_in_transit


# +----------------------------------------------------------------------------+
# | Plant Area Definition |
# +----------------------------------------------------------------------------+
- type: custom:mod-card
view_layout:
grid-area: plant
style:
.: >
:host {
margin: 0px !important;
}
swipe-card:
$: |
.swiper-container {
box-shadow: var(--homeos-card-box-shadow);
border-radius: var(--homeos-card-border-radius);
background-color: var(--homeos-card-background);
backdrop-filter: var(--homeos-card-backdrop-filter);
border-style: var(--homeos-card-border-style);
border-color: var(--homeos-card-border-color);
border-width: var(--homeos-card-border-width);
}
.swiper-pagination {
bottom: 0vw !important;
}
.swiper-pagination-bullet-active {
--swiper-pagination-color: var(--homeos-icon-color-primary) !important;
opacity: 0.6 !important;
width: 0.5vw;
height: 0.5vw;
}
.swiper-pagination-bullets>span {
width: 0.5vw;
height: 0.5vw;
background: var(--homeos-icon-color-primary);
}
card:
type: custom:swipe-card
start_card: 1
reset_after: 10
parameters:
effect: cards
spaceBetween: 10
pagination:
type: "bullets"
clickable: true
cards:

- type: custom:button-card
entity: *config_hum_plant_1
variables:
var_custom_name: *config_plant_1
min_hum: *config_min_plant_1
template:
- template_plant

- type: custom:button-card
entity: *config_hum_plant_2
variables:
var_custom_name: *config_plant_2
min_hum: *config_min_plant_2
template:
- template_plant

# - type: custom:mod-card
# view_layout:
# grid-area: plant
# style: |
# ha-card {
# display: contents;
# }
# :host {
# margin: 0px !important;
# }
# card:
# type: custom:swipe-card
# parameters:
# effect: cards
# spaceBetween: 8
# pagination:
# type: "bullets"
# clickable: true
# cards:
# - type: custom:button-card
# entity: *config_hum_plant_1


1 change: 1 addition & 0 deletions homeos_module/calendar/calendar_card.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ custom_fields:
showDatePerEvent: true # Show the date next to each event entry
hideFinishedEvents: true # if set true will hide any finished events
showAllDayHours: true # Show “All Day” text under full day events
showHiddenText: false # Show x hidden events when limited number of events selected
europeanDate: true
titleLength: 30
fullDayEventText: 'toute la journée'
Expand Down
63 changes: 63 additions & 0 deletions homeos_module/plant/plant_card.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
template_plant:
show_entity_picture: false
show_name: false
show_state: true
show_label: true
show_icon: false
styles:
card:
- border-radius: var(--homeos-card-border-radius)
- background: >
[[[
return 'left top / contain no-repeat fixed url(' + states[variables.var_custom_name].attributes["entity_picture"] + ')'
]]]
- border-style: none
- height: var(--homeos-card-grid-square)
- width: var(--homeos-card-grid-square)
grid:
- grid-template-areas: |
". icon custom_name custom_name"
". s s d"
". l l ."
- grid-template-columns: 1vw 1vw 6vw 1fr
- grid-template-rows: 2vw 3.5vw 3.8vw
state:
- justify-self: left
- font-size: 2.1vw
- font-weight: 400
label:
- font-size: 1vw
- white-space: normal
- text-align: left
- align-self: end

custom_fields:
icon:
- opacity: 0.6
custom_name:
- font-size: 1vw
- justify-self: left
- opacity: 0.6
- padding-left: 0.3vw

label: >
[[[
if (entity.state <= states[variables.min_hum].state ) {
return 'Arroser maintenant' ;
}
return 'Arroser dans quelques jours';
]]]
custom_fields:
custom_name: >
[[[ return states[variables.var_custom_name].attributes["friendly_name"] ]]]
icon: >
<svg viewBox="0 0 28 28" >
<style>
.primary {
fill: var(--homeos-icon-color-primary);
}
</style>
<path class="primary" d="M1.33984 4.41797C1.09375 5.61328 1 7.17188 1 8.21484C1 16.9805 6.21484 22.7695 14.1836 22.7695C19.3164 22.7695 21.7305 19.7461 22.2578 18.7734L20.793 18.7383C22.3164 20.332 22.9961 22.043 23.7695 24.4688C23.9453 25.0312 24.332 25.2305 24.7422 25.2305C25.6094 25.2305 26.3008 24.4805 26.3008 23.4492C26.3008 21.832 23.9805 19.0195 22.7734 17.8828C17.6406 13.1484 9.82422 15.9492 7.80859 10.7227C7.65625 10.3242 8.07812 9.97266 8.46484 10.3711C12.5078 14.4141 17.7109 11.0039 22.7734 15.668C23.1719 16.0195 23.6406 15.832 23.7109 15.4102C23.7695 15.0703 23.8047 14.5312 23.8047 14.0156C23.8047 8.29688 19.8203 5.54297 14.2188 5.54297C12.3438 5.54297 10.1523 6 8.42969 6C6.54297 6 4.42188 5.84766 2.73438 4.04297C2.25391 3.55078 1.52734 3.6211 1.33984 4.41797Z" fill="black"/>
</svg>
23 changes: 23 additions & 0 deletions packages/plant_package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
plant:
MiFlora_Pin:
name: Pin de Norfolks
sensors:
moisture: sensor.flower_care_hhccjcy01hhcc_moi
temperature: sensor.flower_care_hhccjcy01hhcc_tempc
conductivity: sensor.flower_care_hhccjcy01hhcc_fer
brightness: sensor.flower_care_hhccjcy01hhcc_lux
min_moisture: 15
min_conductivity: 350
min_temperature: 5


MiFlora_Anthurium:
name: Anthurium
sensors:
moisture: sensor.flower_care_hhccjcy01hhcc_moi_2
temperature: sensor.flower_care_hhccjcy01hhcc_tempc_2
conductivity: sensor.flower_care_hhccjcy01hhcc_fer_2
brightness: sensor.flower_care_hhccjcy01hhcc_lux_2
min_moisture: 15
min_conductivity: 350
min_temperature: 15
1 change: 1 addition & 0 deletions themes/homeos/general_theme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ homeos:
homeos-card-border-radius: 2.5vw
homeos-card-box-shadow: 0px 0px 0.5vw 0vw rgba(0,0,0,0.6)
homeos-card-border-style: solid
homeos-card-border-width: 1px

# +----------------------------------------------------------------------------+
# | Apple Fonts |
Expand Down
Binary file added www/homeos/plant_media/Anthurium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/homeos/plant_media/Norfolk-Pine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e0ff7b9

Please sign in to comment.