[ci skip] home assistant integration
This commit is contained in:
120
homeassistant/dashboards/invertergui_mqtt_dashboard.yaml
Normal file
120
homeassistant/dashboards/invertergui_mqtt_dashboard.yaml
Normal file
@@ -0,0 +1,120 @@
|
||||
title: Victron Inverter MQTT
|
||||
views:
|
||||
- title: Inverter
|
||||
path: victron-inverter
|
||||
icon: mdi:flash
|
||||
badges:
|
||||
- entity: binary_sensor.victron_online
|
||||
- entity: binary_sensor.victron_data_valid
|
||||
- entity: sensor.victron_last_command_status
|
||||
cards:
|
||||
- type: vertical-stack
|
||||
cards:
|
||||
- type: markdown
|
||||
content: |
|
||||
## Remote Panel Control
|
||||
Mode and current limit are published together over MQTT, matching `set_remote_panel_state`.
|
||||
- type: entities
|
||||
title: Current Remote State
|
||||
state_color: true
|
||||
show_header_toggle: false
|
||||
entities:
|
||||
- entity: select.victron_remote_panel_mode
|
||||
name: Mode
|
||||
- entity: number.victron_remote_panel_current_limit
|
||||
name: AC Input Current Limit
|
||||
- entity: switch.victron_remote_panel_standby
|
||||
name: Prevent Sleep While Off
|
||||
- entity: sensor.victron_last_command_error
|
||||
name: Last Command Error
|
||||
- type: entities
|
||||
title: Apply Mode + Current Limit
|
||||
show_header_toggle: false
|
||||
entities:
|
||||
- entity: input_select.victron_remote_panel_mode_target
|
||||
name: Target Mode
|
||||
- entity: input_number.victron_remote_panel_current_limit_target
|
||||
name: Target Current Limit
|
||||
- entity: script.victron_mqtt_set_remote_panel_state
|
||||
name: Apply Mode + Current Limit
|
||||
- type: entities
|
||||
title: Apply Standby
|
||||
show_header_toggle: false
|
||||
entities:
|
||||
- entity: input_boolean.victron_remote_panel_standby_target
|
||||
name: Target Standby
|
||||
- entity: script.victron_mqtt_set_remote_panel_standby
|
||||
name: Apply Standby
|
||||
|
||||
- type: grid
|
||||
columns: 3
|
||||
square: false
|
||||
cards:
|
||||
- type: entities
|
||||
title: Output
|
||||
show_header_toggle: false
|
||||
entities:
|
||||
- entity: sensor.victron_output_current
|
||||
name: Output Current
|
||||
- entity: sensor.victron_output_voltage
|
||||
name: Output Voltage
|
||||
- entity: sensor.victron_output_frequency
|
||||
name: Output Frequency
|
||||
- entity: sensor.victron_output_power
|
||||
name: Output Power
|
||||
- type: entities
|
||||
title: Input
|
||||
show_header_toggle: false
|
||||
entities:
|
||||
- entity: sensor.victron_input_current
|
||||
name: Input Current
|
||||
- entity: sensor.victron_input_voltage
|
||||
name: Input Voltage
|
||||
- entity: sensor.victron_input_frequency
|
||||
name: Input Frequency
|
||||
- entity: sensor.victron_input_power
|
||||
name: Input Power
|
||||
- entity: sensor.victron_input_minus_output_power
|
||||
name: Input - Output Power
|
||||
- type: entities
|
||||
title: Battery
|
||||
show_header_toggle: false
|
||||
entities:
|
||||
- entity: sensor.victron_battery_current
|
||||
name: Battery Current
|
||||
- entity: sensor.victron_battery_voltage
|
||||
name: Battery Voltage
|
||||
- entity: sensor.victron_battery_power
|
||||
name: Battery Power
|
||||
- entity: sensor.victron_battery_charge
|
||||
name: Battery Charge
|
||||
|
||||
- type: entities
|
||||
title: LED Status
|
||||
show_header_toggle: false
|
||||
entities:
|
||||
- entity: sensor.victron_led_mains
|
||||
name: Mains
|
||||
- entity: sensor.victron_led_absorb
|
||||
name: Absorb
|
||||
- entity: sensor.victron_led_bulk
|
||||
name: Bulk
|
||||
- entity: sensor.victron_led_float
|
||||
name: Float
|
||||
- entity: sensor.victron_led_inverter
|
||||
name: Inverter
|
||||
- entity: sensor.victron_led_overload
|
||||
name: Overload
|
||||
- entity: sensor.victron_led_low_battery
|
||||
name: Low Battery
|
||||
- entity: sensor.victron_led_over_temp
|
||||
name: Over Temperature
|
||||
|
||||
- type: history-graph
|
||||
title: Power (Last 2 Hours)
|
||||
hours_to_show: 2
|
||||
refresh_interval: 60
|
||||
entities:
|
||||
- entity: sensor.victron_input_power
|
||||
- entity: sensor.victron_output_power
|
||||
- entity: sensor.victron_battery_power
|
||||
350
homeassistant/packages/invertergui_mqtt.yaml
Normal file
350
homeassistant/packages/invertergui_mqtt.yaml
Normal file
@@ -0,0 +1,350 @@
|
||||
# MQTT-only Home Assistant package for invertergui.
|
||||
# This avoids duplicate entities from MQTT auto-discovery/custom integration.
|
||||
#
|
||||
# Requirements:
|
||||
# - invertergui started with MQTT publishing enabled.
|
||||
# - invertergui MQTT discovery disabled (`--mqtt.ha.enabled=false`) when using this package.
|
||||
|
||||
mqtt:
|
||||
sensor:
|
||||
- name: Victron Battery Voltage
|
||||
unique_id: invertergui_mqtt_battery_voltage
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ value_json.BatVoltage }}"
|
||||
unit_of_measurement: V
|
||||
device_class: voltage
|
||||
state_class: measurement
|
||||
- name: Victron Battery Current
|
||||
unique_id: invertergui_mqtt_battery_current
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ value_json.BatCurrent }}"
|
||||
unit_of_measurement: A
|
||||
device_class: current
|
||||
state_class: measurement
|
||||
- name: Victron Battery Charge
|
||||
unique_id: invertergui_mqtt_battery_charge
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ ((value_json.ChargeState | float(0)) * 100) | round(1) }}"
|
||||
unit_of_measurement: "%"
|
||||
device_class: battery
|
||||
state_class: measurement
|
||||
- name: Victron Input Voltage
|
||||
unique_id: invertergui_mqtt_input_voltage
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ value_json.InVoltage }}"
|
||||
unit_of_measurement: V
|
||||
device_class: voltage
|
||||
state_class: measurement
|
||||
- name: Victron Input Current
|
||||
unique_id: invertergui_mqtt_input_current
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ value_json.InCurrent }}"
|
||||
unit_of_measurement: A
|
||||
device_class: current
|
||||
state_class: measurement
|
||||
- name: Victron Input Frequency
|
||||
unique_id: invertergui_mqtt_input_frequency
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ value_json.InFrequency }}"
|
||||
unit_of_measurement: Hz
|
||||
device_class: frequency
|
||||
state_class: measurement
|
||||
- name: Victron Output Voltage
|
||||
unique_id: invertergui_mqtt_output_voltage
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ value_json.OutVoltage }}"
|
||||
unit_of_measurement: V
|
||||
device_class: voltage
|
||||
state_class: measurement
|
||||
- name: Victron Output Current
|
||||
unique_id: invertergui_mqtt_output_current
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ value_json.OutCurrent }}"
|
||||
unit_of_measurement: A
|
||||
device_class: current
|
||||
state_class: measurement
|
||||
- name: Victron Output Frequency
|
||||
unique_id: invertergui_mqtt_output_frequency
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ value_json.OutFrequency }}"
|
||||
unit_of_measurement: Hz
|
||||
device_class: frequency
|
||||
state_class: measurement
|
||||
- name: Victron Input Power
|
||||
unique_id: invertergui_mqtt_input_power
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ ((value_json.InVoltage | float(0)) * (value_json.InCurrent | float(0))) | round(1) }}"
|
||||
unit_of_measurement: VA
|
||||
state_class: measurement
|
||||
- name: Victron Output Power
|
||||
unique_id: invertergui_mqtt_output_power
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ ((value_json.OutVoltage | float(0)) * (value_json.OutCurrent | float(0))) | round(1) }}"
|
||||
unit_of_measurement: VA
|
||||
state_class: measurement
|
||||
- name: Victron Last Command Status
|
||||
unique_id: invertergui_mqtt_last_command_status
|
||||
state_topic: invertergui/settings/status
|
||||
value_template: "{{ value_json.status | default('unknown') }}"
|
||||
icon: mdi:message-alert-outline
|
||||
- name: Victron Last Command Error
|
||||
unique_id: invertergui_mqtt_last_command_error
|
||||
state_topic: invertergui/settings/status
|
||||
value_template: >-
|
||||
{% if value_json.status == 'error' %}
|
||||
{{ value_json.error | default('unknown error') }}
|
||||
{% else %}
|
||||
none
|
||||
{% endif %}
|
||||
icon: mdi:alert-circle-outline
|
||||
- name: Victron LED Mains
|
||||
unique_id: invertergui_mqtt_led_mains
|
||||
state_topic: invertergui/updates
|
||||
value_template: >-
|
||||
{% set leds = value_json.LEDs | default({}) %}
|
||||
{% set v = leds['0'] | default(0) | int(0) %}
|
||||
{% if v == 1 %}on{% elif v == 2 %}blink{% else %}off{% endif %}
|
||||
icon: mdi:transmission-tower
|
||||
- name: Victron LED Absorb
|
||||
unique_id: invertergui_mqtt_led_absorb
|
||||
state_topic: invertergui/updates
|
||||
value_template: >-
|
||||
{% set leds = value_json.LEDs | default({}) %}
|
||||
{% set v = leds['1'] | default(0) | int(0) %}
|
||||
{% if v == 1 %}on{% elif v == 2 %}blink{% else %}off{% endif %}
|
||||
icon: mdi:water-outline
|
||||
- name: Victron LED Bulk
|
||||
unique_id: invertergui_mqtt_led_bulk
|
||||
state_topic: invertergui/updates
|
||||
value_template: >-
|
||||
{% set leds = value_json.LEDs | default({}) %}
|
||||
{% set v = leds['2'] | default(0) | int(0) %}
|
||||
{% if v == 1 %}on{% elif v == 2 %}blink{% else %}off{% endif %}
|
||||
icon: mdi:battery-plus
|
||||
- name: Victron LED Float
|
||||
unique_id: invertergui_mqtt_led_float
|
||||
state_topic: invertergui/updates
|
||||
value_template: >-
|
||||
{% set leds = value_json.LEDs | default({}) %}
|
||||
{% set v = leds['3'] | default(0) | int(0) %}
|
||||
{% if v == 1 %}on{% elif v == 2 %}blink{% else %}off{% endif %}
|
||||
icon: mdi:battery-heart-variant
|
||||
- name: Victron LED Inverter
|
||||
unique_id: invertergui_mqtt_led_inverter
|
||||
state_topic: invertergui/updates
|
||||
value_template: >-
|
||||
{% set leds = value_json.LEDs | default({}) %}
|
||||
{% set v = leds['4'] | default(0) | int(0) %}
|
||||
{% if v == 1 %}on{% elif v == 2 %}blink{% else %}off{% endif %}
|
||||
icon: mdi:power-plug
|
||||
- name: Victron LED Overload
|
||||
unique_id: invertergui_mqtt_led_overload
|
||||
state_topic: invertergui/updates
|
||||
value_template: >-
|
||||
{% set leds = value_json.LEDs | default({}) %}
|
||||
{% set v = leds['5'] | default(0) | int(0) %}
|
||||
{% if v == 1 %}on{% elif v == 2 %}blink{% else %}off{% endif %}
|
||||
icon: mdi:alert-octagon
|
||||
- name: Victron LED Low Battery
|
||||
unique_id: invertergui_mqtt_led_low_battery
|
||||
state_topic: invertergui/updates
|
||||
value_template: >-
|
||||
{% set leds = value_json.LEDs | default({}) %}
|
||||
{% set v = leds['6'] | default(0) | int(0) %}
|
||||
{% if v == 1 %}on{% elif v == 2 %}blink{% else %}off{% endif %}
|
||||
icon: mdi:battery-alert-variant-outline
|
||||
- name: Victron LED Over Temp
|
||||
unique_id: invertergui_mqtt_led_over_temp
|
||||
state_topic: invertergui/updates
|
||||
value_template: >-
|
||||
{% set leds = value_json.LEDs | default({}) %}
|
||||
{% set v = leds['7'] | default(0) | int(0) %}
|
||||
{% if v == 1 %}on{% elif v == 2 %}blink{% else %}off{% endif %}
|
||||
icon: mdi:thermometer-alert
|
||||
|
||||
binary_sensor:
|
||||
- name: Victron Online
|
||||
unique_id: invertergui_mqtt_online
|
||||
state_topic: invertergui/updates
|
||||
value_template: "ON"
|
||||
payload_on: "ON"
|
||||
payload_off: "OFF"
|
||||
expire_after: 120
|
||||
device_class: connectivity
|
||||
- name: Victron Data Valid
|
||||
unique_id: invertergui_mqtt_data_valid
|
||||
state_topic: invertergui/updates
|
||||
value_template: "{{ value_json.Valid }}"
|
||||
payload_on: "true"
|
||||
payload_off: "false"
|
||||
entity_category: diagnostic
|
||||
|
||||
select:
|
||||
- name: Victron Remote Panel Mode
|
||||
unique_id: invertergui_mqtt_remote_panel_mode
|
||||
state_topic: invertergui/homeassistant/remote_panel_mode/state
|
||||
command_topic: invertergui/settings/set
|
||||
command_template: '{"kind":"panel_state","switch":"{{ value }}"}'
|
||||
options:
|
||||
- charger_only
|
||||
- inverter_only
|
||||
- on
|
||||
- off
|
||||
icon: mdi:transmission-tower-export
|
||||
|
||||
number:
|
||||
- name: Victron Remote Panel Current Limit
|
||||
unique_id: invertergui_mqtt_remote_panel_current_limit
|
||||
state_topic: invertergui/homeassistant/remote_panel_current_limit/state
|
||||
command_topic: invertergui/settings/set
|
||||
command_template: '{"kind":"panel_state","current_limit":{{ value | float(0) }}}'
|
||||
unit_of_measurement: A
|
||||
device_class: current
|
||||
mode: box
|
||||
min: 0
|
||||
max: 100
|
||||
step: 0.1
|
||||
icon: mdi:current-ac
|
||||
|
||||
switch:
|
||||
- name: Victron Remote Panel Standby
|
||||
unique_id: invertergui_mqtt_remote_panel_standby
|
||||
state_topic: invertergui/homeassistant/remote_panel_standby/state
|
||||
command_topic: invertergui/settings/set
|
||||
payload_on: '{"kind":"standby","standby":true}'
|
||||
payload_off: '{"kind":"standby","standby":false}'
|
||||
state_on: "ON"
|
||||
state_off: "OFF"
|
||||
icon: mdi:power-sleep
|
||||
|
||||
input_select:
|
||||
victron_remote_panel_mode_target:
|
||||
name: Victron Target Mode
|
||||
options:
|
||||
- charger_only
|
||||
- inverter_only
|
||||
- on
|
||||
- off
|
||||
icon: mdi:transmission-tower-export
|
||||
|
||||
input_number:
|
||||
victron_remote_panel_current_limit_target:
|
||||
name: Victron Target Current Limit
|
||||
min: 0
|
||||
max: 100
|
||||
step: 0.1
|
||||
unit_of_measurement: A
|
||||
mode: box
|
||||
icon: mdi:current-ac
|
||||
|
||||
input_boolean:
|
||||
victron_remote_panel_standby_target:
|
||||
name: Victron Target Standby
|
||||
icon: mdi:power-sleep
|
||||
|
||||
script:
|
||||
victron_mqtt_set_remote_panel_state:
|
||||
alias: Victron MQTT Set Remote Panel State
|
||||
description: Set panel mode and current limit in one MQTT command.
|
||||
mode: single
|
||||
icon: mdi:send
|
||||
sequence:
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: invertergui/settings/set
|
||||
qos: 1
|
||||
payload: >-
|
||||
{"kind":"panel_state","switch":"{{ states('input_select.victron_remote_panel_mode_target') }}","current_limit":{{ states('input_number.victron_remote_panel_current_limit_target') | float(0) | round(1) }}}
|
||||
|
||||
victron_mqtt_set_remote_panel_standby:
|
||||
alias: Victron MQTT Set Remote Panel Standby
|
||||
description: Set standby state from helper input.
|
||||
mode: single
|
||||
icon: mdi:send-circle
|
||||
sequence:
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: invertergui/settings/set
|
||||
qos: 1
|
||||
payload: >-
|
||||
{"kind":"standby","standby":{% if is_state('input_boolean.victron_remote_panel_standby_target', 'on') %}true{% else %}false{% endif %}}
|
||||
|
||||
template:
|
||||
- sensor:
|
||||
- name: Victron Battery Power
|
||||
unique_id: invertergui_mqtt_battery_power
|
||||
unit_of_measurement: W
|
||||
state_class: measurement
|
||||
icon: mdi:battery-charging
|
||||
state: >-
|
||||
{{ ((states('sensor.victron_battery_voltage') | float(0)) * (states('sensor.victron_battery_current') | float(0))) | round(1) }}
|
||||
- name: Victron Input Minus Output Power
|
||||
unique_id: invertergui_mqtt_input_minus_output_power
|
||||
unit_of_measurement: VA
|
||||
state_class: measurement
|
||||
icon: mdi:flash-triangle
|
||||
state: >-
|
||||
{{ (states('sensor.victron_input_power') | float(0) - states('sensor.victron_output_power') | float(0)) | round(1) }}
|
||||
|
||||
automation:
|
||||
- id: victron_mqtt_sync_target_mode
|
||||
alias: Victron MQTT Sync Mode Target
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: select.victron_remote_panel_mode
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{{ states('select.victron_remote_panel_mode') in ['charger_only', 'inverter_only', 'on', 'off'] }}
|
||||
action:
|
||||
- service: input_select.select_option
|
||||
target:
|
||||
entity_id: input_select.victron_remote_panel_mode_target
|
||||
data:
|
||||
option: "{{ states('select.victron_remote_panel_mode') }}"
|
||||
|
||||
- id: victron_mqtt_sync_target_current_limit
|
||||
alias: Victron MQTT Sync Current Limit Target
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: number.victron_remote_panel_current_limit
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{{ states('number.victron_remote_panel_current_limit') not in ['unknown', 'unavailable'] }}
|
||||
action:
|
||||
- service: input_number.set_value
|
||||
target:
|
||||
entity_id: input_number.victron_remote_panel_current_limit_target
|
||||
data:
|
||||
value: "{{ states('number.victron_remote_panel_current_limit') | float(0) }}"
|
||||
|
||||
- id: victron_mqtt_sync_target_standby
|
||||
alias: Victron MQTT Sync Standby Target
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: switch.victron_remote_panel_standby
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: switch.victron_remote_panel_standby
|
||||
state: "on"
|
||||
sequence:
|
||||
- service: input_boolean.turn_on
|
||||
target:
|
||||
entity_id: input_boolean.victron_remote_panel_standby_target
|
||||
- conditions:
|
||||
- condition: state
|
||||
entity_id: switch.victron_remote_panel_standby
|
||||
state: "off"
|
||||
sequence:
|
||||
- service: input_boolean.turn_off
|
||||
target:
|
||||
entity_id: input_boolean.victron_remote_panel_standby_target
|
||||
Reference in New Issue
Block a user