Repository navigation
Expand file tree
/
Copy pathLTC2983_Temp_Module.yaml
More file actions
275 lines (246 loc) · 7.01 KB
/
Copy pathLTC2983_Temp_Module.yaml
File metadata and controls
275 lines (246 loc) · 7.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# ESP32-S3-1 N16R8 — LTC2983 temperature IO module (5 RTD + 5 TC + CJC).
# Board: Espressif ESP32-S3-DevKitC-1 class modules (16 MB flash / 8 MB PSRAM).
#
# Workflow: flash over OTA, debug over the USB-C port.
# esphome run LTC2983_Temp_Module.yaml --device cst-temp-module.local
# esphome logs LTC2983_Temp_Module.yaml --device /dev/cu.wchusbserial*
# See LTC2983_CONFIGURATION.md for the full channel map, register values,
# fault decoding and SPI hardening rationale.
# No BLE — this is an IO module. WiFi/API is the transport, USB is for logs.
substitutions:
name: cst-temp-module
friendly_name: CST Temp Module
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
build_path: /tmp/esphome-build/cst-temp-module
includes:
- ltc2983_handler.h
platformio_options:
board_build.flash_mode: dio
board_build.flash_size: 16MB
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
framework:
type: esp-idf
flash_size: 16MB
api:
ota:
- platform: esphome
packages:
wifi: !include common/wifi.yaml
captive_portal:
logger:
level: DEBUG
hardware_uart: UART0
baud_rate: 115200
logs:
api.connection: ERROR
spi: ERROR
LTC2983: INFO
psram:
mode: octal
speed: 80MHz
number:
- platform: template
name: "Setpoint"
id: setpoint
min_value: -40
max_value: 500
step: 0.5
optimistic: true
initial_value: 110
unit_of_measurement: "°C"
entity_category: config
# RULE: always 5 RTD + 5 TC entities (never trim). Each has temp (°F) + fault.
# RTD1–5 → CH4/6/8/10/12 TC1–5 → CH13/14/15/16/17 CJC → CH20
# All ten channels are wired. An unwired or open channel reports
# "Sensor Hard Fault" and publishes no value.
# Fault names come from datasheet Table 10; see ltc2983_handler.h FAULT_TEXT.
# SPI: CS=GPIO2 CLK=GPIO9 MOSI=GPIO5 MISO=GPIO4 (ltc2983_handler.h)
# I2C: SDA=GPIO10 SCL=GPIO11 (VL53L0X @ 0x29)
i2c:
- id: i2c_bus
sda: GPIO10
scl: GPIO11
scan: true
#timeout: 100ms
#frequency: 50kHz
sensor:
- platform: vl53l0x
name: "Pellet Level"
id: pellet_level
address: 0x29
long_range: true
timeout: 200us
update_interval: 5s
unit_of_measurement: "m"
accuracy_decimals: 2
device_class: distance
state_class: measurement
- platform: wifi_signal
id: io_wifi_signal_db
internal: true
update_interval: 30s
- platform: template
name: "RTD CH4"
id: rtd_1
unit_of_measurement: "°F"
accuracy_decimals: 1
state_class: "measurement"
- platform: template
name: "RTD CH6"
id: rtd_2
unit_of_measurement: "°F"
accuracy_decimals: 1
state_class: "measurement"
- platform: template
name: "RTD CH8"
id: rtd_3
unit_of_measurement: "°F"
accuracy_decimals: 1
state_class: "measurement"
- platform: template
name: "RTD CH10"
id: rtd_4
unit_of_measurement: "°F"
accuracy_decimals: 1
state_class: "measurement"
- platform: template
name: "RTD CH12"
id: rtd_5
unit_of_measurement: "°F"
accuracy_decimals: 1
state_class: "measurement"
- platform: template
name: "TC1"
id: tc_1
unit_of_measurement: "°F"
accuracy_decimals: 1
state_class: "measurement"
- platform: template
name: "TC2"
id: tc_2
unit_of_measurement: "°F"
accuracy_decimals: 1
state_class: "measurement"
- platform: template
name: "TC3"
id: tc_3
unit_of_measurement: "°F"
accuracy_decimals: 1
state_class: "measurement"
- platform: template
name: "TC4"
id: tc_4
unit_of_measurement: "°F"
accuracy_decimals: 1
state_class: "measurement"
- platform: template
name: "TC5"
id: tc_5
unit_of_measurement: "°F"
accuracy_decimals: 1
state_class: "measurement"
# Cold junction (CH20 diode). Feeds every TC result — if this drifts or
# faults, all five thermocouples are wrong with it.
- platform: template
name: "Cold Junction"
id: cjc_temp
unit_of_measurement: "°F"
accuracy_decimals: 1
state_class: "measurement"
entity_category: diagnostic
# SPI link health. The LTC2983 bus has no CRC, so a corrupted write can
# silently unconfigure a channel. These counters only climb when the wire
# misbehaves — a rising SPI error count is an early warning that a connector
# or solder joint is going, well before readings start dropping out.
- platform: template
name: "LTC2983 SPI Errors"
id: diag_spi_errors
accuracy_decimals: 0
state_class: "total_increasing"
icon: "mdi:lan-disconnect"
entity_category: diagnostic
- platform: template
name: "LTC2983 Config Reloads"
id: diag_reconfigs
accuracy_decimals: 0
state_class: "total_increasing"
icon: "mdi:reload-alert"
entity_category: diagnostic
text_sensor:
- platform: template
name: "Fault RTD CH4"
id: fault_rtd_1
icon: "mdi:alert-circle"
- platform: template
name: "Fault RTD CH6"
id: fault_rtd_2
icon: "mdi:alert-circle"
- platform: template
name: "Fault RTD CH8"
id: fault_rtd_3
icon: "mdi:alert-circle"
- platform: template
name: "Fault RTD CH10"
id: fault_rtd_4
icon: "mdi:alert-circle"
- platform: template
name: "Fault RTD CH12"
id: fault_rtd_5
icon: "mdi:alert-circle"
- platform: template
name: "Fault TC1"
id: fault_tc_1
icon: "mdi:alert-circle"
- platform: template
name: "Fault TC2"
id: fault_tc_2
icon: "mdi:alert-circle"
- platform: template
name: "Fault TC3"
id: fault_tc_3
icon: "mdi:alert-circle"
- platform: template
name: "Fault TC4"
id: fault_tc_4
icon: "mdi:alert-circle"
- platform: template
name: "Fault TC5"
id: fault_tc_5
icon: "mdi:alert-circle"
- platform: template
name: "Fault Cold Junction"
id: fault_cjc
icon: "mdi:alert-circle"
entity_category: diagnostic
# Online / Online (degraded) / Fault / Offline — alarm on anything but Online.
- platform: template
name: "LTC2983 Link"
id: diag_link
icon: "mdi:chip"
entity_category: diagnostic
interval:
# Drives the LTC2983 state machine one step per tick. A single conversion
# takes 2-3 ticks, so all 11 channels refresh roughly every 4-8s. Each tick
# costs only a few SPI byte transfers, keeping the main loop free.
- interval: 250ms
then:
- lambda: |-
LtcSensors s = {
.rtd = {id(rtd_1), id(rtd_2), id(rtd_3), id(rtd_4), id(rtd_5)},
.tc = {id(tc_1), id(tc_2), id(tc_3), id(tc_4), id(tc_5)},
.cjc = id(cjc_temp),
.fault_rtd = {id(fault_rtd_1), id(fault_rtd_2), id(fault_rtd_3),
id(fault_rtd_4), id(fault_rtd_5)},
.fault_tc = {id(fault_tc_1), id(fault_tc_2), id(fault_tc_3),
id(fault_tc_4), id(fault_tc_5)},
.fault_cjc = id(fault_cjc),
.diag_spi_errors = id(diag_spi_errors),
.diag_reconfigs = id(diag_reconfigs),
.diag_link = id(diag_link),
};
read_ltc2983_sensors(s);