├── LICENSE
├── README.md
├── rdtech-controller.yaml
└── rdtech-controller-c3.yaml
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 wildekek
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RDTech Power Supply Controller via ESPHome
2 |
3 | This is a configuration for [ESPHome](https://esphome.io/) that allows you to control the RDTech (aka Riden/Riuden) RD series of power supplies via [Home Assistant](https://www.home-assistant.io/).
4 |
5 | 
6 |
7 |
8 | ## Model support
9 | * RD6006: ✅
10 | * RD6018: ✅
11 | * RD6006P:✅
12 | * RD6012: ✅
13 | * RD6024: 🛑 Not properly supported, as there is no Unisoft firmware yet.
14 |
15 | ## Credits
16 | This repo was based on a Python project by [Baldanos](https://github.com/Baldanos/rd6006).
17 |
18 | ## What you'll need:
19 | - A [Riden RD](https://rdtech.aliexpress.com/store/923042) power supply with WiFi module
20 | - An [FTDI adapter](https://www.aliexpress.com/item/32273550144.html)
21 | - A [Home Assistant](https://www.home-assistant.io/) installation [with ESPHome](https://esphome.io/guides/getting_started_hassio.html)
22 |
23 | ## How to:
24 | - Flash your device with the [UniSoft firmware](https://github.com/wildekek/rdtech-firmware-unisoft)
25 | - Create a new ESPHome device and load this [configuration](/rdtech-powersupply.yaml)
26 | - Update your WiFi credentials in ESPHome
27 | - [Flash the Riden WiFi module with ESPHome](https://esphome.io/guides/physical_device_connection.html)
28 | - Set the right settings in the Riden power supply:
29 | - UART Interface to "TTL+EN"
30 | - UART Baudrate to "115200"
31 | - Address to "1"
32 | - Skip keys lock to "ON"
33 |
34 | ## Features
35 |
36 |
37 | ## Dashboard example
38 |
39 |
--------------------------------------------------------------------------------
/rdtech-controller.yaml:
--------------------------------------------------------------------------------
1 | substitutions:
2 | # Change this model to fit your particular one.
3 | # You can find it in Home Assistant as the device diagnostic "Model Name".
4 | model: "RD6006"
5 | device_name: "rd6006-controller"
6 | device_friendly_name: "RD 6006"
7 | device_description: "Power Supply"
8 | time_timezone: "Europe/Amsterdam"
9 |
10 | # Model specific settings (Don't change these!)
11 | RD6006_voltage_maximum: "60"
12 | RD6006_voltage_accuracy: "2"
13 | RD6006_voltage_multiplier: "0.01"
14 | RD6006_current_maximum: "6"
15 | RD6006_current_accuracy: "3"
16 | RD6006_current_multiplier: "0.001"
17 | RD6006_power_accuracy: "2"
18 | RD6006_power_multiplier: "0.01"
19 |
20 | RD6006P_voltage_maximum: "60"
21 | RD6006P_voltage_accuracy: "3"
22 | RD6006P_voltage_multiplier: "0.001"
23 | RD6006P_current_maximum: "6"
24 | RD6006P_current_accuracy: "4"
25 | RD6006P_current_multiplier: "0.0001"
26 | RD6006P_power_accuracy: "3"
27 | RD6006P_power_multiplier: "0.001"
28 |
29 | RD6012_voltage_maximum: "60"
30 | RD6012_voltage_accuracy: "2"
31 | RD6012_voltage_multiplier: "0.01"
32 | RD6012_current_maximum: "12"
33 | RD6012_current_accuracy: "2"
34 | RD6012_current_multiplier: "0.01"
35 | RD6012_power_accuracy: "2"
36 | RD6012_power_multiplier: "0.01"
37 |
38 | RD6018_voltage_maximum: "60"
39 | RD6018_voltage_accuracy: "2"
40 | RD6018_voltage_multiplier: "0.01"
41 | RD6018_current_maximum: "18"
42 | RD6018_current_accuracy: "2"
43 | RD6018_current_multiplier: "0.01"
44 | RD6018_power_accuracy: "2"
45 | RD6018_power_multiplier: "0.01"
46 |
47 | esphome:
48 | name: $device_name
49 | friendly_name: $device_friendly_name
50 | comment: $device_description
51 | name_add_mac_suffix: false
52 | project:
53 | name: "wildekek.rd6006-controller"
54 | version: "1.5"
55 |
56 | esp8266:
57 | board: esp01_1m
58 |
59 | # Enable logging
60 | logger:
61 | level: INFO
62 | # Disable logging via UART, since we're using this for modbus communication
63 | baud_rate: 0
64 |
65 | # Enable status LED
66 | status_led:
67 | pin:
68 | number: GPIO2
69 | inverted: true
70 |
71 | # Enable Home Assistant API
72 | api:
73 | encryption:
74 | key: !secret home_assistant_key
75 |
76 | ota:
77 | - platform: esphome
78 | password: !secret ota_password
79 |
80 | # Configure WiFi
81 | wifi:
82 | ssid: !secret wifi_ssid
83 | password: !secret wifi_password
84 |
85 | # Enable fallback hotspot (captive portal) in case wifi connection fails
86 | ap:
87 | ssid: $device_friendly_name
88 | password: !secret wifi_fallback_password
89 | captive_portal:
90 |
91 | uart:
92 | id: mod_bus
93 | tx_pin: GPIO1
94 | rx_pin: GPIO3
95 | baud_rate: 115200
96 | data_bits: 8
97 | stop_bits: 1
98 | parity: none
99 |
100 | modbus:
101 | id: modbus1
102 |
103 | modbus_controller:
104 | - id: powersupply
105 | ## This address should be set to the "Address" value in the config menu
106 | address: 0x01
107 | modbus_id: modbus1
108 | setup_priority: -10
109 | update_interval: 5s
110 |
111 | time:
112 | # Get the time from HA, so we can use it for uptime
113 | - platform: homeassistant
114 | id: time_homeassistant
115 | timezone: "${time_timezone}"
116 | on_time_sync:
117 | - logger.log: Time has been set and is valid!
118 | - component.update: sensor_uptime_timestamp
119 | - number.set:
120 | id: date_year
121 | value: !lambda return id(time_homeassistant).now().year;
122 | - number.set:
123 | id: date_month
124 | value: !lambda return id(time_homeassistant).now().month;
125 | - number.set:
126 | id: date_day
127 | value: !lambda return id(time_homeassistant).now().day_of_month;
128 | - number.set:
129 | id: date_hour
130 | value: !lambda return id(time_homeassistant).now().hour;
131 | - number.set:
132 | id: date_minute
133 | value: !lambda return id(time_homeassistant).now().minute;
134 | - number.set:
135 | id: date_second
136 | value: !lambda return id(time_homeassistant).now().second;
137 |
138 | sensor:
139 | - platform: modbus_controller
140 | id: model_number
141 | name: "Model Number"
142 | entity_category: diagnostic
143 | disabled_by_default: True
144 | modbus_controller_id: powersupply
145 | address: 0
146 | skip_updates: 10
147 | unit_of_measurement: ""
148 | register_type: holding
149 | value_type: U_WORD
150 | accuracy_decimals: 0
151 | on_value:
152 | then:
153 | - lambda: |-
154 | id(model_name).publish_state(value_accuracy_to_string(x, 0));
155 |
156 | - platform: modbus_controller
157 | name: "Serial Number"
158 | entity_category: diagnostic
159 | disabled_by_default: True
160 | modbus_controller_id: powersupply
161 | address: 1
162 | skip_updates: 10
163 | register_type: holding
164 | value_type: U_DWORD
165 | accuracy_decimals: 0
166 |
167 | - platform: modbus_controller
168 | modbus_controller_id: powersupply
169 | address: 3
170 | name: "Firmware version"
171 | entity_category: diagnostic
172 | disabled_by_default: True
173 | unit_of_measurement: ""
174 | register_type: holding
175 | value_type: U_WORD
176 | accuracy_decimals: 2
177 | filters:
178 | - multiply: 0.01
179 |
180 | - platform: modbus_controller
181 | modbus_controller_id: powersupply
182 | address: 10
183 | name: "Output voltage"
184 | device_class: voltage
185 | state_class: measurement
186 | unit_of_measurement: "V"
187 | register_type: holding
188 | value_type: U_WORD
189 | accuracy_decimals: ${${model}_voltage_accuracy}
190 | filters:
191 | - multiply: ${${model}_voltage_multiplier}
192 |
193 | - platform: modbus_controller
194 | modbus_controller_id: powersupply
195 | address: 11
196 | name: "Output current"
197 | device_class: current
198 | state_class: measurement
199 | unit_of_measurement: "A"
200 | register_type: holding
201 | value_type: U_WORD
202 | accuracy_decimals: ${${model}_current_accuracy}
203 | filters:
204 | - multiply: ${${model}_current_multiplier}
205 |
206 | - platform: modbus_controller
207 | modbus_controller_id: powersupply
208 | address: 12
209 | name: "Output Power"
210 | device_class: power
211 | state_class: measurement
212 | unit_of_measurement: "W"
213 | register_type: holding
214 | value_type: U_DWORD
215 | accuracy_decimals: ${${model}_power_accuracy}
216 | filters:
217 | - multiply: ${${model}_power_multiplier}
218 |
219 | - platform: modbus_controller
220 | modbus_controller_id: powersupply
221 | address: 33
222 | name: "Battery voltage"
223 | device_class: voltage
224 | state_class: measurement
225 | unit_of_measurement: "V"
226 | register_type: holding
227 | value_type: U_WORD
228 | accuracy_decimals: 2
229 | filters:
230 | - multiply: 0.01
231 |
232 | - platform: modbus_controller
233 | modbus_controller_id: powersupply
234 | address: 38
235 | name: "Battery charge"
236 | device_class: "energy_storage"
237 | state_class: measurement
238 | unit_of_measurement: "Ah"
239 | icon: "mdi:battery-60"
240 | register_type: holding
241 | value_type: U_DWORD
242 | accuracy_decimals: 3
243 | filters:
244 | - multiply: 0.001
245 |
246 | - platform: modbus_controller
247 | modbus_controller_id: powersupply
248 | address: 40
249 | name: "Battery energy"
250 | device_class: "energy_storage"
251 | state_class: measurement
252 | unit_of_measurement: "Wh"
253 | icon: "mdi:battery-60"
254 | register_type: holding
255 | value_type: U_DWORD
256 | accuracy_decimals: 3
257 | filters:
258 | - multiply: 0.001
259 |
260 | - platform: modbus_controller
261 | modbus_controller_id: powersupply
262 | address: 14
263 | name: "Input voltage"
264 | device_class: voltage
265 | unit_of_measurement: "V"
266 | register_type: holding
267 | value_type: U_WORD
268 | accuracy_decimals: 2
269 | filters:
270 | - multiply: 0.01
271 |
272 | - platform: modbus_controller
273 | name: "Temperature"
274 | device_class: temperature
275 | state_class: measurement
276 | modbus_controller_id: powersupply
277 | register_type: holding
278 | address: 4
279 | value_type: S_DWORD
280 | unit_of_measurement: "°C"
281 |
282 | - platform: modbus_controller
283 | name: "Temperature external"
284 | state_class: measurement
285 | modbus_controller_id: powersupply
286 | register_type: holding
287 | address: 34
288 | value_type: S_DWORD
289 | device_class: temperature
290 | unit_of_measurement: "°C"
291 |
292 | - platform: wifi_signal
293 | name: "Wi-Fi Signal"
294 | disabled_by_default: True
295 | update_interval: 60s
296 |
297 | # Uptime is used internally only
298 | - platform: uptime
299 | id: sensor_uptime
300 | # This sensor is an alternative for the uptime sensor, which only sends the
301 | # startup timestamp of the device to home assistant once
302 | - platform: template
303 | id: sensor_uptime_timestamp
304 | name: "Uptime"
305 | entity_category: diagnostic
306 | device_class: "timestamp"
307 | accuracy_decimals: 0
308 | update_interval: never
309 | lambda: |-
310 | static float timestamp = (
311 | id(time_homeassistant).utcnow().timestamp - id(sensor_uptime).state
312 | );
313 | return timestamp;
314 |
315 | text_sensor:
316 | - platform: wifi_info
317 | ip_address:
318 | name: "IP Address"
319 | disabled_by_default: True
320 | ssid:
321 | name: "Wi-Fi SSID"
322 | disabled_by_default: True
323 | bssid:
324 | name: "Wi-Fi BSSID"
325 | disabled_by_default: True
326 | - platform: template
327 | id: model_name
328 | name: "Model Name"
329 | entity_category: diagnostic
330 | # Updated by model number
331 | update_interval: never
332 | filters:
333 | - map:
334 | - 60062 -> RD6006
335 | - 60065 -> RD6006P
336 | - 60121 -> RD6012
337 | - 60181 -> RD6018
338 |
339 | binary_sensor:
340 | - platform: modbus_controller
341 | modbus_controller_id: powersupply
342 | name: "Keypad lock"
343 | entity_category: diagnostic
344 | device_class: lock
345 | address: 15
346 | register_type: holding
347 | bitmask: 0x1
348 | filters:
349 | - invert:
350 | - platform: modbus_controller
351 | modbus_controller_id: powersupply
352 | address: 32
353 | name: "Battery mode"
354 | device_class: connectivity
355 | register_type: holding
356 | bitmask: 0x1
357 | - platform: modbus_controller
358 | modbus_controller_id: powersupply
359 | name: "Over Voltage Protection"
360 | device_class: problem
361 | address: 16
362 | register_type: holding
363 | bitmask: 0x1
364 | - platform: modbus_controller
365 | modbus_controller_id: powersupply
366 | name: "Over Current Protection"
367 | device_class: problem
368 | address: 16
369 | register_type: holding
370 | bitmask: 0x2
371 | - platform: modbus_controller
372 | modbus_controller_id: powersupply
373 | name: "Constant Voltage"
374 | address: 17
375 | register_type: holding
376 | bitmask: 0x1
377 | filters:
378 | - invert:
379 | - platform: modbus_controller
380 | modbus_controller_id: powersupply
381 | name: "Constant Current"
382 | address: 17
383 | register_type: holding
384 | bitmask: 0x1
385 |
386 | number:
387 | - platform: modbus_controller
388 | modbus_controller_id: powersupply
389 | name: "Backlight"
390 | icon: "mdi:lightbulb"
391 | entity_category: config
392 | address: 72
393 | value_type: U_WORD
394 | min_value: 0
395 | max_value: 5
396 |
397 | - platform: modbus_controller
398 | modbus_controller_id: powersupply
399 | name: "Output voltage"
400 | device_class: voltage
401 | unit_of_measurement: "V"
402 | entity_category: config
403 | address: 8
404 | value_type: U_WORD
405 | min_value: 0
406 | max_value: ${${model}_voltage_maximum}
407 | step: ${${model}_voltage_multiplier}
408 | lambda: !lambda return x * ${${model}_voltage_multiplier};
409 | write_lambda: !lambda return x * (1/${${model}_voltage_multiplier});
410 |
411 | - platform: modbus_controller
412 | modbus_controller_id: powersupply
413 | name: "Output current"
414 | device_class: current
415 | unit_of_measurement: "A"
416 | entity_category: config
417 | address: 9
418 | value_type: U_WORD
419 | min_value: 0
420 | max_value: ${${model}_current_maximum}
421 | step: ${${model}_current_multiplier}
422 | lambda: !lambda return x * ${${model}_current_multiplier};
423 | write_lambda: !lambda return x * (1/${${model}_current_multiplier});
424 |
425 | - platform: modbus_controller
426 | modbus_controller_id: powersupply
427 | name: "Over Voltage Protection"
428 | device_class: voltage
429 | unit_of_measurement: "V"
430 | address: 82
431 | entity_category: config
432 | value_type: U_WORD
433 | min_value: 0
434 | max_value: ${${model}_voltage_maximum}
435 | step: ${${model}_voltage_multiplier}
436 | lambda: !lambda return x * ${${model}_voltage_multiplier};
437 | write_lambda: !lambda return x * (1/${${model}_voltage_multiplier});
438 |
439 |
440 | - platform: modbus_controller
441 | modbus_controller_id: powersupply
442 | name: "Over Current Protection"
443 | device_class: current
444 | unit_of_measurement: "A"
445 | address: 83
446 | entity_category: config
447 | value_type: U_WORD
448 | min_value: 0
449 | max_value: ${${model}_current_maximum}
450 | step: ${${model}_current_multiplier}
451 | lambda: !lambda return x * ${${model}_current_multiplier};
452 | write_lambda: !lambda return x * (1/${${model}_current_multiplier});
453 |
454 | # Date components are kept internal
455 | - platform: modbus_controller
456 | id: date_year
457 | modbus_controller_id: powersupply
458 | entity_category: diagnostic
459 | register_type: holding
460 | address: 48
461 | value_type: U_WORD
462 | - platform: modbus_controller
463 | id: date_month
464 | modbus_controller_id: powersupply
465 | entity_category: diagnostic
466 | register_type: holding
467 | address: 49
468 | value_type: U_WORD
469 | - platform: modbus_controller
470 | id: date_day
471 | modbus_controller_id: powersupply
472 | entity_category: diagnostic
473 | register_type: holding
474 | address: 50
475 | value_type: U_WORD
476 | - platform: modbus_controller
477 | id: date_hour
478 | modbus_controller_id: powersupply
479 | entity_category: diagnostic
480 | register_type: holding
481 | address: 51
482 | value_type: U_WORD
483 | - platform: modbus_controller
484 | id: date_minute
485 | modbus_controller_id: powersupply
486 | entity_category: diagnostic
487 | register_type: holding
488 | address: 52
489 | value_type: U_WORD
490 | - platform: modbus_controller
491 | id: date_second
492 | modbus_controller_id: powersupply
493 | entity_category: diagnostic
494 | register_type: holding
495 | address: 53
496 | value_type: U_WORD
497 |
498 | switch:
499 | - platform: modbus_controller
500 | modbus_controller_id: powersupply
501 | name: "Output"
502 | address: 18
503 | register_type: holding
504 | bitmask: 0x1
505 | entity_category: config
506 |
507 | button:
508 | - platform: safe_mode
509 | name: "Safe mode"
510 |
--------------------------------------------------------------------------------
/rdtech-controller-c3.yaml:
--------------------------------------------------------------------------------
1 | substitutions:
2 | # Change this model to fit your particular one.
3 | # You can find it in Home Assistant as the device diagnostic "Model Name".
4 | model: "RD6006"
5 | device_name: "rd6006-controller-c3"
6 | device_friendly_name: "RD 6006"
7 | device_description: "Power Supply"
8 | time_timezone: "Europe/Amsterdam"
9 |
10 | # Model specific settings (Don't change these!)
11 | RD6006_voltage_maximum: "60"
12 | RD6006_voltage_accuracy: "2"
13 | RD6006_voltage_multiplier: "0.01"
14 | RD6006_current_maximum: "6"
15 | RD6006_current_accuracy: "3"
16 | RD6006_current_multiplier: "0.001"
17 | RD6006_power_accuracy: "2"
18 | RD6006_power_multiplier: "0.01"
19 |
20 | RD6006P_voltage_maximum: "60"
21 | RD6006P_voltage_accuracy: "3"
22 | RD6006P_voltage_multiplier: "0.001"
23 | RD6006P_current_maximum: "6"
24 | RD6006P_current_accuracy: "4"
25 | RD6006P_current_multiplier: "0.0001"
26 | RD6006P_power_accuracy: "3"
27 | RD6006P_power_multiplier: "0.001"
28 |
29 | RD6012_voltage_maximum: "60"
30 | RD6012_voltage_accuracy: "2"
31 | RD6012_voltage_multiplier: "0.01"
32 | RD6012_current_maximum: "12"
33 | RD6012_current_accuracy: "2"
34 | RD6012_current_multiplier: "0.01"
35 | RD6012_power_accuracy: "2"
36 | RD6012_power_multiplier: "0.01"
37 |
38 | RD6018_voltage_maximum: "60"
39 | RD6018_voltage_accuracy: "2"
40 | RD6018_voltage_multiplier: "0.01"
41 | RD6018_current_maximum: "18"
42 | RD6018_current_accuracy: "2"
43 | RD6018_current_multiplier: "0.01"
44 | RD6018_power_accuracy: "2"
45 | RD6018_power_multiplier: "0.01"
46 |
47 | esphome:
48 | name: $device_name
49 | friendly_name: $device_friendly_name
50 | comment: $device_description
51 | name_add_mac_suffix: false
52 | project:
53 | name: "wildekek.rd6006-controller"
54 | version: "1.5"
55 |
56 | esp32:
57 | board: esp32-c3-devkitm-1
58 | framework:
59 | type: arduino
60 |
61 | # Enable logging
62 | logger:
63 | level: INFO
64 | # Disable logging via UART, since we're using this for modbus communication
65 | baud_rate: 0
66 |
67 | # Enable status LED
68 | status_led:
69 | pin:
70 | number: GPIO2
71 | inverted: true
72 |
73 | # Enable Home Assistant API
74 | api:
75 | encryption:
76 | key: !secret home_assistant_key
77 |
78 | ota:
79 | - platform: esphome
80 | password: !secret ota_password
81 |
82 | # Configure WiFi
83 | wifi:
84 | ssid: !secret wifi_ssid
85 | password: !secret wifi_password
86 |
87 | # Enable fallback hotspot (captive portal) in case wifi connection fails
88 | ap:
89 | ssid: $device_friendly_name
90 | password: !secret wifi_fallback_password
91 | captive_portal:
92 |
93 | uart:
94 | id: mod_bus
95 | tx_pin: GPIO1
96 | rx_pin: GPIO3
97 | baud_rate: 115200
98 | data_bits: 8
99 | stop_bits: 1
100 | parity: none
101 |
102 | modbus:
103 | id: modbus1
104 |
105 | modbus_controller:
106 | - id: powersupply
107 | ## This address should be set to the "Address" value in the config menu
108 | address: 0x01
109 | modbus_id: modbus1
110 | setup_priority: -10
111 | update_interval: 5s
112 |
113 | time:
114 | # Get the time from HA, so we can use it for uptime
115 | - platform: homeassistant
116 | id: time_homeassistant
117 | timezone: "${time_timezone}"
118 | on_time_sync:
119 | - logger.log: Time has been set and is valid!
120 | - component.update: sensor_uptime_timestamp
121 | - number.set:
122 | id: date_year
123 | value: !lambda return id(time_homeassistant).now().year;
124 | - number.set:
125 | id: date_month
126 | value: !lambda return id(time_homeassistant).now().month;
127 | - number.set:
128 | id: date_day
129 | value: !lambda return id(time_homeassistant).now().day_of_month;
130 | - number.set:
131 | id: date_hour
132 | value: !lambda return id(time_homeassistant).now().hour;
133 | - number.set:
134 | id: date_minute
135 | value: !lambda return id(time_homeassistant).now().minute;
136 | - number.set:
137 | id: date_second
138 | value: !lambda return id(time_homeassistant).now().second;
139 |
140 | sensor:
141 | - platform: modbus_controller
142 | id: model_number
143 | name: "Model Number"
144 | entity_category: diagnostic
145 | disabled_by_default: True
146 | modbus_controller_id: powersupply
147 | address: 0
148 | skip_updates: 10
149 | unit_of_measurement: ""
150 | register_type: holding
151 | value_type: U_WORD
152 | accuracy_decimals: 0
153 | on_value:
154 | then:
155 | - lambda: |-
156 | id(model_name).publish_state(value_accuracy_to_string(x, 0));
157 |
158 | - platform: modbus_controller
159 | name: "Serial Number"
160 | entity_category: diagnostic
161 | disabled_by_default: True
162 | modbus_controller_id: powersupply
163 | address: 1
164 | skip_updates: 10
165 | register_type: holding
166 | value_type: U_DWORD
167 | accuracy_decimals: 0
168 |
169 | - platform: modbus_controller
170 | modbus_controller_id: powersupply
171 | address: 3
172 | name: "Firmware version"
173 | entity_category: diagnostic
174 | disabled_by_default: True
175 | unit_of_measurement: ""
176 | register_type: holding
177 | value_type: U_WORD
178 | accuracy_decimals: 2
179 | filters:
180 | - multiply: 0.01
181 |
182 | - platform: modbus_controller
183 | modbus_controller_id: powersupply
184 | address: 10
185 | name: "Output voltage"
186 | device_class: voltage
187 | state_class: measurement
188 | unit_of_measurement: "V"
189 | register_type: holding
190 | value_type: U_WORD
191 | accuracy_decimals: ${${model}_voltage_accuracy}
192 | filters:
193 | - multiply: ${${model}_voltage_multiplier}
194 |
195 | - platform: modbus_controller
196 | modbus_controller_id: powersupply
197 | address: 11
198 | name: "Output current"
199 | device_class: current
200 | state_class: measurement
201 | unit_of_measurement: "A"
202 | register_type: holding
203 | value_type: U_WORD
204 | accuracy_decimals: ${${model}_current_accuracy}
205 | filters:
206 | - multiply: ${${model}_current_multiplier}
207 |
208 | - platform: modbus_controller
209 | modbus_controller_id: powersupply
210 | address: 12
211 | name: "Output Power"
212 | device_class: power
213 | state_class: measurement
214 | unit_of_measurement: "W"
215 | register_type: holding
216 | value_type: U_DWORD
217 | accuracy_decimals: ${${model}_power_accuracy}
218 | filters:
219 | - multiply: ${${model}_power_multiplier}
220 |
221 | - platform: modbus_controller
222 | modbus_controller_id: powersupply
223 | address: 33
224 | name: "Battery voltage"
225 | device_class: voltage
226 | state_class: measurement
227 | unit_of_measurement: "V"
228 | register_type: holding
229 | value_type: U_WORD
230 | accuracy_decimals: 2
231 | filters:
232 | - multiply: 0.01
233 |
234 | - platform: modbus_controller
235 | modbus_controller_id: powersupply
236 | address: 38
237 | name: "Battery charge"
238 | device_class: "energy_storage"
239 | state_class: measurement
240 | unit_of_measurement: "Ah"
241 | icon: "mdi:battery-60"
242 | register_type: holding
243 | value_type: U_DWORD
244 | accuracy_decimals: 3
245 | filters:
246 | - multiply: 0.001
247 |
248 | - platform: modbus_controller
249 | modbus_controller_id: powersupply
250 | address: 40
251 | name: "Battery energy"
252 | device_class: "energy_storage"
253 | state_class: measurement
254 | unit_of_measurement: "Wh"
255 | icon: "mdi:battery-60"
256 | register_type: holding
257 | value_type: U_DWORD
258 | accuracy_decimals: 3
259 | filters:
260 | - multiply: 0.001
261 |
262 | - platform: modbus_controller
263 | modbus_controller_id: powersupply
264 | address: 14
265 | name: "Input voltage"
266 | device_class: voltage
267 | unit_of_measurement: "V"
268 | register_type: holding
269 | value_type: U_WORD
270 | accuracy_decimals: 2
271 | filters:
272 | - multiply: 0.01
273 |
274 | - platform: modbus_controller
275 | name: "Temperature"
276 | device_class: temperature
277 | state_class: measurement
278 | modbus_controller_id: powersupply
279 | register_type: holding
280 | address: 4
281 | value_type: S_DWORD
282 | unit_of_measurement: "°C"
283 |
284 | - platform: modbus_controller
285 | name: "Temperature external"
286 | state_class: measurement
287 | modbus_controller_id: powersupply
288 | register_type: holding
289 | address: 34
290 | value_type: S_DWORD
291 | device_class: temperature
292 | unit_of_measurement: "°C"
293 |
294 | - platform: wifi_signal
295 | name: "Wi-Fi Signal"
296 | disabled_by_default: True
297 | update_interval: 60s
298 |
299 | # Uptime is used internally only
300 | - platform: uptime
301 | id: sensor_uptime
302 | # This sensor is an alternative for the uptime sensor, which only sends the
303 | # startup timestamp of the device to home assistant once
304 | - platform: template
305 | id: sensor_uptime_timestamp
306 | name: "Uptime"
307 | entity_category: diagnostic
308 | device_class: "timestamp"
309 | accuracy_decimals: 0
310 | update_interval: never
311 | lambda: |-
312 | static float timestamp = (
313 | id(time_homeassistant).utcnow().timestamp - id(sensor_uptime).state
314 | );
315 | return timestamp;
316 |
317 | text_sensor:
318 | - platform: wifi_info
319 | ip_address:
320 | name: "IP Address"
321 | disabled_by_default: True
322 | ssid:
323 | name: "Wi-Fi SSID"
324 | disabled_by_default: True
325 | bssid:
326 | name: "Wi-Fi BSSID"
327 | disabled_by_default: True
328 | - platform: template
329 | id: model_name
330 | name: "Model Name"
331 | entity_category: diagnostic
332 | # Updated by model number
333 | update_interval: never
334 | filters:
335 | - map:
336 | - 60062 -> RD6006
337 | - 60065 -> RD6006P
338 | - 60121 -> RD6012
339 | - 60181 -> RD6018
340 |
341 | binary_sensor:
342 | - platform: modbus_controller
343 | modbus_controller_id: powersupply
344 | name: "Keypad lock"
345 | entity_category: diagnostic
346 | device_class: lock
347 | address: 15
348 | register_type: holding
349 | bitmask: 0x1
350 | filters:
351 | - invert:
352 | - platform: modbus_controller
353 | modbus_controller_id: powersupply
354 | address: 32
355 | name: "Battery mode"
356 | device_class: connectivity
357 | register_type: holding
358 | bitmask: 0x1
359 | - platform: modbus_controller
360 | modbus_controller_id: powersupply
361 | name: "Over Voltage Protection"
362 | device_class: problem
363 | address: 16
364 | register_type: holding
365 | bitmask: 0x1
366 | - platform: modbus_controller
367 | modbus_controller_id: powersupply
368 | name: "Over Current Protection"
369 | device_class: problem
370 | address: 16
371 | register_type: holding
372 | bitmask: 0x2
373 | - platform: modbus_controller
374 | modbus_controller_id: powersupply
375 | name: "Constant Voltage"
376 | address: 17
377 | register_type: holding
378 | bitmask: 0x1
379 | filters:
380 | - invert:
381 | - platform: modbus_controller
382 | modbus_controller_id: powersupply
383 | name: "Constant Current"
384 | address: 17
385 | register_type: holding
386 | bitmask: 0x1
387 |
388 | number:
389 | - platform: modbus_controller
390 | modbus_controller_id: powersupply
391 | name: "Backlight"
392 | icon: "mdi:lightbulb"
393 | entity_category: config
394 | address: 72
395 | value_type: U_WORD
396 | min_value: 0
397 | max_value: 5
398 |
399 | - platform: modbus_controller
400 | modbus_controller_id: powersupply
401 | name: "Output voltage"
402 | device_class: voltage
403 | unit_of_measurement: "V"
404 | entity_category: config
405 | address: 8
406 | value_type: U_WORD
407 | min_value: 0
408 | max_value: ${${model}_voltage_maximum}
409 | step: ${${model}_voltage_multiplier}
410 | lambda: !lambda return x * ${${model}_voltage_multiplier};
411 | write_lambda: !lambda return x * (1/${${model}_voltage_multiplier});
412 |
413 | - platform: modbus_controller
414 | modbus_controller_id: powersupply
415 | name: "Output current"
416 | device_class: current
417 | unit_of_measurement: "A"
418 | entity_category: config
419 | address: 9
420 | value_type: U_WORD
421 | min_value: 0
422 | max_value: ${${model}_current_maximum}
423 | step: ${${model}_current_multiplier}
424 | lambda: !lambda return x * ${${model}_current_multiplier};
425 | write_lambda: !lambda return x * (1/${${model}_current_multiplier});
426 |
427 | - platform: modbus_controller
428 | modbus_controller_id: powersupply
429 | name: "Over Voltage Protection"
430 | device_class: voltage
431 | unit_of_measurement: "V"
432 | address: 82
433 | entity_category: config
434 | value_type: U_WORD
435 | min_value: 0
436 | max_value: ${${model}_voltage_maximum}
437 | step: ${${model}_voltage_multiplier}
438 | lambda: !lambda return x * ${${model}_voltage_multiplier};
439 | write_lambda: !lambda return x * (1/${${model}_voltage_multiplier});
440 |
441 |
442 | - platform: modbus_controller
443 | modbus_controller_id: powersupply
444 | name: "Over Current Protection"
445 | device_class: current
446 | unit_of_measurement: "A"
447 | address: 83
448 | entity_category: config
449 | value_type: U_WORD
450 | min_value: 0
451 | max_value: ${${model}_current_maximum}
452 | step: ${${model}_current_multiplier}
453 | lambda: !lambda return x * ${${model}_current_multiplier};
454 | write_lambda: !lambda return x * (1/${${model}_current_multiplier});
455 |
456 | # Date components are kept internal
457 | - platform: modbus_controller
458 | id: date_year
459 | modbus_controller_id: powersupply
460 | entity_category: diagnostic
461 | register_type: holding
462 | address: 48
463 | value_type: U_WORD
464 | - platform: modbus_controller
465 | id: date_month
466 | modbus_controller_id: powersupply
467 | entity_category: diagnostic
468 | register_type: holding
469 | address: 49
470 | value_type: U_WORD
471 | - platform: modbus_controller
472 | id: date_day
473 | modbus_controller_id: powersupply
474 | entity_category: diagnostic
475 | register_type: holding
476 | address: 50
477 | value_type: U_WORD
478 | - platform: modbus_controller
479 | id: date_hour
480 | modbus_controller_id: powersupply
481 | entity_category: diagnostic
482 | register_type: holding
483 | address: 51
484 | value_type: U_WORD
485 | - platform: modbus_controller
486 | id: date_minute
487 | modbus_controller_id: powersupply
488 | entity_category: diagnostic
489 | register_type: holding
490 | address: 52
491 | value_type: U_WORD
492 | - platform: modbus_controller
493 | id: date_second
494 | modbus_controller_id: powersupply
495 | entity_category: diagnostic
496 | register_type: holding
497 | address: 53
498 | value_type: U_WORD
499 |
500 | switch:
501 | - platform: modbus_controller
502 | modbus_controller_id: powersupply
503 | name: "Output"
504 | address: 18
505 | register_type: holding
506 | bitmask: 0x1
507 | entity_category: config
508 |
509 | button:
510 | - platform: safe_mode
511 | name: "Safe mode"
--------------------------------------------------------------------------------