Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 48 additions & 9 deletions rdtech-controller-c3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ substitutions:
device_friendly_name: "RD 6006"
device_description: "Power Supply"
time_timezone: "Europe/Amsterdam"
# Base Modbus poll interval. Dynamic measurements (V/I/W) update every
# cycle; slower-changing entities use skip_updates further down to
# divide this rate (e.g. skip_updates: 4 with update_interval 1s
# gives 5s effective). 1s is comfortable for the PSU at 115200 baud.
# Raise this if you see bus contention or want lighter traffic.
update_interval: "1s"

# Model specific settings (Don't change these!)
RD6006_voltage_maximum: "60"
Expand Down Expand Up @@ -108,7 +114,7 @@ modbus_controller:
address: 0x01
modbus_id: modbus1
setup_priority: -10
update_interval: 5s
update_interval: ${update_interval}

time:
# Get the time from HA, so we can use it for uptime
Expand Down Expand Up @@ -145,7 +151,8 @@ sensor:
disabled_by_default: True
modbus_controller_id: powersupply
address: 0
skip_updates: 10
# Static identity register; once per minute is plenty.
skip_updates: 60
unit_of_measurement: ""
register_type: holding
value_type: U_WORD
Expand All @@ -161,11 +168,12 @@ sensor:
disabled_by_default: True
modbus_controller_id: powersupply
address: 1
skip_updates: 10
# Static; never changes after manufacture.
skip_updates: 60
register_type: holding
value_type: U_DWORD
accuracy_decimals: 0

- platform: modbus_controller
modbus_controller_id: powersupply
address: 3
Expand All @@ -176,6 +184,8 @@ sensor:
register_type: holding
value_type: U_WORD
accuracy_decimals: 2
# Static between firmware flashes.
skip_updates: 60
filters:
- multiply: 0.01

Expand Down Expand Up @@ -268,9 +278,11 @@ sensor:
register_type: holding
value_type: U_WORD
accuracy_decimals: 2
# Input rail moves slowly compared to load step transients.
skip_updates: 4
filters:
- multiply: 0.01

- platform: modbus_controller
name: "Temperature"
device_class: temperature
Expand All @@ -280,7 +292,9 @@ sensor:
address: 4
value_type: S_DWORD
unit_of_measurement: "°C"

# Thermal mass is large; once per ~5 s is plenty.
skip_updates: 4

- platform: modbus_controller
name: "Temperature external"
state_class: measurement
Expand All @@ -290,6 +304,7 @@ sensor:
value_type: S_DWORD
device_class: temperature
unit_of_measurement: "°C"
skip_updates: 4

- platform: wifi_signal
name: "Wi-Fi Signal"
Expand Down Expand Up @@ -347,6 +362,8 @@ binary_sensor:
address: 15
register_type: holding
bitmask: 0x1
# User-toggled config; ~10 s is responsive enough.
skip_updates: 9
filters:
- invert:
- platform: modbus_controller
Expand All @@ -356,6 +373,12 @@ binary_sensor:
device_class: connectivity
register_type: holding
bitmask: 0x1
# Polled every cycle: the battery_charge / battery_energy sensor
# filters in the battery-availability-gate change consult this
# sensor's state to decide whether to publish a real value or
# NaN. Slowing it down with skip_updates would let stale Ah/Wh
# values leak into HA statistics for several seconds after the
# PSU exits battery mode.
- platform: modbus_controller
modbus_controller_id: powersupply
name: "Over Voltage Protection"
Expand Down Expand Up @@ -395,6 +418,8 @@ number:
value_type: U_WORD
min_value: 0
max_value: 5
# User-set; rarely changes from outside HA. ~30s is plenty.
skip_updates: 29

- platform: modbus_controller
modbus_controller_id: powersupply
Expand All @@ -407,9 +432,12 @@ number:
min_value: 0
max_value: ${${model}_voltage_maximum}
step: ${${model}_voltage_multiplier}
# Setpoint can be changed from the front panel knob; refresh ~5s
# so HA stays in sync without flooding the bus.
skip_updates: 4
lambda: !lambda return x * ${${model}_voltage_multiplier};
write_lambda: !lambda return x * (1/${${model}_voltage_multiplier});

- platform: modbus_controller
modbus_controller_id: powersupply
name: "Output current"
Expand All @@ -421,6 +449,7 @@ number:
min_value: 0
max_value: ${${model}_current_maximum}
step: ${${model}_current_multiplier}
skip_updates: 4
lambda: !lambda return x * ${${model}_current_multiplier};
write_lambda: !lambda return x * (1/${${model}_current_multiplier});

Expand All @@ -435,10 +464,11 @@ number:
min_value: 0
max_value: ${${model}_voltage_maximum}
step: ${${model}_voltage_multiplier}
# Protection thresholds change rarely.
skip_updates: 29
lambda: !lambda return x * ${${model}_voltage_multiplier};
write_lambda: !lambda return x * (1/${${model}_voltage_multiplier});


- platform: modbus_controller
modbus_controller_id: powersupply
name: "Over Current Protection"
Expand All @@ -450,52 +480,61 @@ number:
min_value: 0
max_value: ${${model}_current_maximum}
step: ${${model}_current_multiplier}
skip_updates: 29
lambda: !lambda return x * ${${model}_current_multiplier};
write_lambda: !lambda return x * (1/${${model}_current_multiplier});

# Date components are kept internal
# Date components are kept internal. Polled every ~30s so the
# time-sync delta check has fresh PSU-side values to compare against
# without spamming the bus every second.
- platform: modbus_controller
id: date_year
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 48
value_type: U_WORD
skip_updates: 29
- platform: modbus_controller
id: date_month
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 49
value_type: U_WORD
skip_updates: 29
- platform: modbus_controller
id: date_day
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 50
value_type: U_WORD
skip_updates: 29
- platform: modbus_controller
id: date_hour
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 51
value_type: U_WORD
skip_updates: 29
- platform: modbus_controller
id: date_minute
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 52
value_type: U_WORD
skip_updates: 29
- platform: modbus_controller
id: date_second
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 53
value_type: U_WORD
skip_updates: 29

switch:
- platform: modbus_controller
Expand Down
Loading