mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 13:08:19 -04:00
added charger to modbuss
This commit is contained in:
@@ -147,6 +147,152 @@ modbus:
|
||||
state_class: measurement
|
||||
unique_id: gps_altitude
|
||||
|
||||
# ---- CHARGER (Unit ID 223) ----
|
||||
- name: Charger Output 1 Voltage
|
||||
slave: 223
|
||||
address: 2307
|
||||
input_type: holding
|
||||
data_type: uint16
|
||||
scale: 0.01
|
||||
precision: 2
|
||||
unit_of_measurement: "V"
|
||||
device_class: voltage
|
||||
state_class: measurement
|
||||
unique_id: charger_output_1_voltage
|
||||
|
||||
- name: Charger Output 1 Current
|
||||
slave: 223
|
||||
address: 2308
|
||||
input_type: holding
|
||||
data_type: int16
|
||||
scale: 0.1
|
||||
precision: 1
|
||||
unit_of_measurement: "A"
|
||||
device_class: current
|
||||
state_class: measurement
|
||||
unique_id: charger_output_1_current
|
||||
|
||||
- name: Charger Output 1 Temperature
|
||||
slave: 223
|
||||
address: 2309
|
||||
input_type: holding
|
||||
data_type: int16
|
||||
scale: 0.1
|
||||
precision: 1
|
||||
unit_of_measurement: "°C"
|
||||
device_class: temperature
|
||||
state_class: measurement
|
||||
unique_id: charger_output_1_temperature
|
||||
|
||||
- name: Charger AC Current
|
||||
slave: 223
|
||||
address: 2314
|
||||
input_type: holding
|
||||
data_type: int16
|
||||
scale: 0.1
|
||||
precision: 1
|
||||
unit_of_measurement: "A"
|
||||
device_class: current
|
||||
state_class: measurement
|
||||
unique_id: charger_ac_current
|
||||
|
||||
- name: Charger AC Current Limit
|
||||
slave: 223
|
||||
address: 2316
|
||||
input_type: holding
|
||||
data_type: int16
|
||||
scale: 0.1
|
||||
precision: 1
|
||||
unit_of_measurement: "A"
|
||||
device_class: current
|
||||
state_class: measurement
|
||||
unique_id: charger_ac_current_limit
|
||||
|
||||
- name: Charger On Off Raw
|
||||
slave: 223
|
||||
address: 2317
|
||||
input_type: holding
|
||||
data_type: uint16
|
||||
scale: 1
|
||||
state_class: measurement
|
||||
unique_id: charger_on_off_raw
|
||||
|
||||
- name: Charger Charge State Raw
|
||||
slave: 223
|
||||
address: 2318
|
||||
input_type: holding
|
||||
data_type: uint16
|
||||
scale: 1
|
||||
state_class: measurement
|
||||
unique_id: charger_charge_state_raw
|
||||
|
||||
- name: Charger Error Code
|
||||
slave: 223
|
||||
address: 2319
|
||||
input_type: holding
|
||||
data_type: uint16
|
||||
scale: 1
|
||||
state_class: measurement
|
||||
unique_id: charger_error_code
|
||||
|
||||
- name: Charger Relay State
|
||||
slave: 223
|
||||
address: 2320
|
||||
input_type: holding
|
||||
data_type: uint16
|
||||
scale: 1
|
||||
state_class: measurement
|
||||
unique_id: charger_relay_state
|
||||
|
||||
- name: Charger Low Voltage Alarm
|
||||
slave: 223
|
||||
address: 2321
|
||||
input_type: holding
|
||||
data_type: uint16
|
||||
scale: 1
|
||||
state_class: measurement
|
||||
unique_id: charger_low_voltage_alarm
|
||||
|
||||
- name: Charger High Voltage Alarm
|
||||
slave: 223
|
||||
address: 2322
|
||||
input_type: holding
|
||||
data_type: uint16
|
||||
scale: 1
|
||||
state_class: measurement
|
||||
unique_id: charger_high_voltage_alarm
|
||||
|
||||
template:
|
||||
- sensor:
|
||||
- name: Charger On Off
|
||||
state: >-
|
||||
{% set v = states('sensor.charger_on_off_raw')|int %}
|
||||
{{ {0:'Off',1:'On',2:'Error',3:'Unavailable'}.get(v, 'Unknown') }}
|
||||
|
||||
- name: Charger Charge State
|
||||
state: >-
|
||||
{% set v = states('sensor.charger_charge_state_raw')|int %}
|
||||
{{ {
|
||||
0:'Off',1:'Low Power',2:'Fault',3:'Bulk',4:'Absorption',5:'Float',
|
||||
6:'Storage',7:'Equalize/Manual',8:'External Control'
|
||||
}.get(v,'Unknown') }}
|
||||
|
||||
- name: "Charger DC Wattage"
|
||||
unique_id: charger_dc_wattage
|
||||
unit_of_measurement: "W"
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
state: >-
|
||||
{% set v = states('sensor.charger_output_1_voltage')|float(0) %}
|
||||
{% set a = states('sensor.charger_output_1_current')|float(0) %}
|
||||
{{ (v * a) | round(1) }}
|
||||
|
||||
- binary_sensor:
|
||||
- name: Charger Low Voltage Alarm Active
|
||||
state: "{{ states('sensor.charger_low_voltage_alarm')|int == 2 }}"
|
||||
- name: Charger High Voltage Alarm Active
|
||||
state: "{{ states('sensor.charger_high_voltage_alarm')|int == 2 }}"
|
||||
|
||||
sensor:
|
||||
- platform: integration
|
||||
source: sensor.dc_wattage
|
||||
@@ -166,14 +312,14 @@ sensor:
|
||||
max_sub_interval:
|
||||
minutes: 5
|
||||
|
||||
template:
|
||||
- sensor:
|
||||
- name: "Fake Energy Zero"
|
||||
unique_id: fake_energy_zero
|
||||
state: "0"
|
||||
unit_of_measurement: "kWh"
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
- platform: integration
|
||||
source: sensor.charger_dc_wattage
|
||||
name: DC Charger Energy
|
||||
unit_prefix: k
|
||||
round: 2
|
||||
method: trapezoidal
|
||||
max_sub_interval:
|
||||
minutes: 5
|
||||
|
||||
utility_meter:
|
||||
dc_load_energy_daily:
|
||||
@@ -192,10 +338,10 @@ utility_meter:
|
||||
source: sensor.solar_yield
|
||||
cycle: monthly
|
||||
|
||||
fake_energy_zero_daily:
|
||||
source: sensor.fake_energy_zero
|
||||
charger_ac_wattage_daily:
|
||||
source: sensor.dc_charger_energy
|
||||
cycle: daily
|
||||
|
||||
fake_energy_zero_monthly:
|
||||
source: sensor.fake_energy_zero
|
||||
charger_ac_wattage_monthly:
|
||||
source: sensor.dc_charger_energy
|
||||
cycle: monthly
|
||||
|
||||
Reference in New Issue
Block a user