-
Notifications
You must be signed in to change notification settings - Fork 40
1.54" Soil Sensor w trending data
Fauropitotto edited this page Dec 6, 2023
·
2 revisions
We know that "graphing" functions aren't yet available, so this was brute forced in a way.
I am not a programmer or proficient with HA or YAML, so this is the best solution I could adapt. Using helper functions (to allow easy universal access to the variables), the automation runs every 3 hours and triggers a systematic update of historical data. It may be possible to use this to actually build a bar graph or a line graph where the length, size, color, or location of the line or bar is driven off these helpers/globalvariables.
I think we're only scratching the surface of what this can do for accessible hobby displays.
Trigger model here:
trigger:
- platform: time_pattern
hours: /3
id: Time
condition: []
action:
- service: input_number.set_value
data:
value: "{{ states('input_number.soil_moisture_previous_2') | int }}"
target:
entity_id: input_number.soil_moisture_previous_3
- service: input_number.set_value
data:
value: "{{ states('input_number.soil_moisture_previous_1') | int }}"
target:
entity_id: input_number.soil_moisture_previous_2
- service: input_number.set_value
data:
value: "{{ states('input_number.soil_moisture_current') | int }}"
target:
entity_id: input_number.soil_moisture_previous_1
- service: input_number.set_value
data:
value: "{{ states('sensor.tuya_soil_sensor_soil_moisture') | int }}"
target:
entity_id: input_number.soil_moisture_current
- service: input_number.set_value
data:
value: "{{ states('input_number.soil_temp_previous_2') | int }}"
target:
entity_id: input_number.soil_temp_previous_3
- service: input_number.set_value
data:
value: "{{ states('input_number.soil_temp_previous_1') | int }}"
target:
entity_id: input_number.soil_temp_previous_2
- service: input_number.set_value
data:
value: "{{ states('input_number.soil_temp_current') | int }}"
target:
entity_id: input_number.soil_temp_previous_1
- service: input_number.set_value
data:
value: "{{ states('sensor.tuya_soil_sensor_temperature') | int }}"
target:
entity_id: input_number.soil_temp_current
- service: open_epaper_link.drawcustom
Dashboard blueprint here
#Current Build Soil Sensor
service: open_epaper_link.drawcustom
target:
entity_id:
- open_epaper_link.0000021EF2EE3416
data:
background: white
rotate: 0
payload:
#Header and Title
- type: icon
value: flower-tulip-outline
x: 0
y: 0
size: 30
color: black
- type: text
value: "Soil Sensor"
font: "ppb.ttf"
x: 89
y: 8
size: 15
color: black
anchor: mm
- type: line
x_start: 30
x_end: 152
y_start: 15
y_end: 15
width: 1
fill: black
#Last Update
- type: text
value: " Last Update {{ states('sensor.time') | string }} "
font: "ppb.ttf"
x: 89
y: 23
size: 9
color: red
anchor: mm
- type: line
x_start: 0
x_end: 152
y_start: 31
y_end: 31
width: 1
fill: black
#Soil Moisture Header
- type: icon
value: water-outline
x: 0
y: 31
size: 28
color: black
- type: text
value: "Soil"
font: "ppb.ttf"
x: 15
y: 60
size: 8
color: black
anchor: mm
#Soil Moisture Marker
- type: rectangle
x_start: 130
x_end: 150
y_start: 33
y_end: 47
width: 1
fill: white
outline: black
- type: text
value: "{{ states('input_number.soil_moisture_previous_3') | int }}"
font: "ppb.ttf"
x: 40
y: 40
size: 10
color: red
anchor: mm
- type: text
value: "{{ states('input_number.soil_moisture_previous_2') | int }}"
font: "ppb.ttf"
x: 73
y: 40
size: 10
color: red
anchor: mm
- type: text
value: "{{ states('input_number.soil_moisture_previous_1') | int }}"
font: "ppb.ttf"
x: 106
y: 40
size: 10
color: red
anchor: mm
- type: text
value: "{{ states('input_number.soil_moisture_current') | int }}"
font: "ppb.ttf"
x: 140
y: 40
size: 10
color: red
anchor: mm
#Soil Line Graph
- type: line
x_start: 40
x_end: 140
y_start: 52
y_end: 52
width: 1
fill: black
- type: line
x_start: 40
x_end: 40
y_start: 47
y_end: 52
width: 1
fill: black
- type: line
x_start: 73
x_end: 73
y_start: 47
y_end: 52
width: 1
fill: black
- type: line
x_start: 106
x_end: 106
y_start: 47
y_end: 52
width: 1
fill: black
- type: line
x_start: 140
x_end: 140
y_start: 47
y_end: 52
width: 1
fill: black
#Soil Hour Marker
- type: text
value: "9h"
font: "ppb.ttf"
x: 40
y: 60
size: 8
color: black
anchor: mm
- type: text
value: "6h"
font: "ppb.ttf"
x: 73
y: 60
size: 8
color: black
anchor: mm
- type: text
value: "3h"
font: "ppb.ttf"
x: 106
y: 60
size: 8
color: black
anchor: mm
- type: text
value: "Curr"
font: "ppb.ttf"
x: 140
y: 60
size: 8
color: black
anchor: mm
- type: line
x_start: 0
x_end: 152
y_start: 68
y_end: 68
width: 1
fill: black
#Soil Temperature
- type: icon
value: thermometer
x: 2
y: 68
size: 26
color: black
- type: text
value: "Soil"
font: "ppb.ttf"
x: 15
y: 97
size: 8
color: black
anchor: mm
#Soil Temperature Marker
- type: rectangle
x_start: 130
x_end: 150
y_start: 70
y_end: 84
width: 1
fill: white
outline: black
- type: text
value: "{{ states('input_number.soil_temp_previous_3') | int }}"
font: "ppb.ttf"
x: 40
y: 77
size: 10
color: red
anchor: mm
- type: text
value: "{{ states('input_number.soil_temp_previous_2') | int }}"
font: "ppb.ttf"
x: 73
y: 77
size: 10
color: red
anchor: mm
- type: text
value: "{{ states('input_number.soil_temp_previous_1') | int }}"
font: "ppb.ttf"
x: 106
y: 77
size: 10
color: red
anchor: mm
- type: text
value: "{{ states('input_number.soil_temp_current') | int }}"
font: "ppb.ttf"
x: 140
y: 77
size: 10
color: red
anchor: mm
#Soil Temp Line Graph
- type: line
x_start: 40
x_end: 140
y_start: 89
y_end: 89
width: 1
fill: black
- type: line
x_start: 40
x_end: 40
y_start: 84
y_end: 89
width: 1
fill: black
- type: line
x_start: 73
x_end: 73
y_start: 84
y_end: 89
width: 1
fill: black
- type: line
x_start: 106
x_end: 106
y_start: 84
y_end: 89
width: 1
fill: black
- type: line
x_start: 140
x_end: 140
y_start: 84
y_end: 89
width: 1
fill: black
#Soil Temp Hour Marker
- type: text
value: "9h"
font: "ppb.ttf"
x: 40
y: 97
size: 8
color: black
anchor: mm
- type: text
value: "6h"
font: "ppb.ttf"
x: 73
y: 97
size: 8
color: black
anchor: mm
- type: text
value: "3h"
font: "ppb.ttf"
x: 106
y: 97
size: 8
color: black
anchor: mm
- type: text
value: "Curr"
font: "ppb.ttf"
x: 140
y: 97
size: 8
color: black
anchor: mm
- type: line
x_start: 0
x_end: 152
y_start: 105
y_end: 105
width: 1
fill: black
#Soil Condition Flag
- type: rectangle
x_start: 0
x_end: 51
y_start: 105
y_end: 151
width: 1
fill: white
outline: black
- type: icon
value: "{{ 'alert' if is_state('binary_sensor.soil_moisture_low', 'on') else 'check-outline' }}"
x: 9
y: 105
size: 30
color: "{{ 'red' if is_state('binary_sensor.soil_moisture_low', 'on') else 'black' }}"
- type: text
value: "Soil"
font: "ppb.ttf"
x: 26
y: 142
size: 10
color: black
anchor: mm
#Battery Condition Flag
- type: rectangle
x_start: 51
x_end: 102
y_start: 105
y_end: 151
width: 1
fill: white
outline: black
- type: icon
value: "{{ 'battery-alert-variant-outline' if is_state('binary_sensor.soil_battery_low', 'on') else 'battery-check-outline' }}"
x: 60
y: 105
size: 30
color: "{{ 'red' if is_state('binary_sensor.soil_battery_low', 'on') else 'black' }}"
- type: text
value: "Battery"
font: "ppb.ttf"
x: 76
y: 142
size: 10
color: black
anchor: mm
- type: text
value: "{{ states('sensor.tuya_soil_sensor_battery') | string }}"
font: "ppb.ttf"
x: 94
y: 130
size: 8
color: black
anchor: mm
#Link Condition Flag
- type: rectangle
x_start: 102
x_end: 151
y_start: 105
y_end: 151
width: 1
fill: white
outline: black
- type: icon
value: "{{ 'signal-cellular-3' if is_state('binary_sensor.soil_link_low', 'on') else 'signal-cellular-outline' }}"
x: 105
y: 105
size: 30
color: "{{ 'red' if is_state('binary_sensor.soil_link_low', 'on') else 'black' }}"
- type: text
value: "Link"
font: "ppb.ttf"
x: 126
y: 142
size: 10
color: black
anchor: mm
- type: text
value: "{{ states('sensor.tuya_soil_sensor_linkquality') | string }}"
font: "ppb.ttf"
x: 144
y: 130
size: 8
color: black
anchor: mm