Skip to content

Instantly share code, notes, and snippets.

@signmeuptwice
Last active January 24, 2024 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save signmeuptwice/3e985033781c3188226e43aad6b9cf5b to your computer and use it in GitHub Desktop.
Save signmeuptwice/3e985033781c3188226e43aad6b9cf5b to your computer and use it in GitHub Desktop.
Afterburner Home Assistant
- trigger:
- platform: homeassistant
event: start
action:
- delay: "00:00:02"
- service: mqtt.publish
data:
topic: AFTERBURNER/cmd/Refresh
payload: "1"
mode: single
- trigger:
- platform: mqtt
topic: "AFTERBURNER/cmd/ThermostatOvertemp"
action:
- delay: "00:00:01"
- service: mqtt.publish
data:
topic: AFTERBURNER/cmd/Refresh
payload: "1"
mode: restart
- trigger:
- platform: mqtt
topic: "AFTERBURNER/cmd/ThermostatUndertemp"
action:
- delay: "00:00:01"
- service: mqtt.publish
data:
topic: AFTERBURNER/cmd/Refresh
payload: "1"
mode: restart
- trigger:
- platform: mqtt
topic: "AFTERBURNER/cmd/CyclicTemp"
action:
- service: mqtt.publish
data:
topic: AFTERBURNER/cmd/Refresh
payload: "1"
mode: restart
- trigger:
- platform: mqtt
topic: AFTERBURNER/sts/TempDesired
condition:
- condition: template
value_template: "{{ (state_attr('climate.localhost_afterburner_2', 'target_temp_high')|float()) != ((states('sensor.afterburner_desired_cyclic_temperature')|float() + states('sensor.afterburner_thermostat_over_temperature')|float()) ) or (state_attr('climate.localhost_afterburner_2', 'target_temp_low')|float()) != ((states('sensor.afterburner_desired_cyclic_temperature')|float() + states('sensor.afterburner_thermostat_under_temperature')|float()) ) }}"
action:
- service: mqtt.publish
data:
topic: AFTERBURNER/cmd/Refresh
payload: "1"
mode: restart
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
http:
ssl_certificate: ./ssl/fullchain.pem
ssl_key: ./ssl/privkey.pem
logger:
filters:
homeassistant.components.homeassistant_alerts:
- "Timeout fetching homeassistant_alerts data"
homeassistant:
external_url: "https://home.lan:8123"
internal_url: "https://home.lan:8123"
allowlist_external_urls: ["http://afterburner.lan"]
mqtt:
sensor:
# AFTERBURNER
- name: Software Version
unique_id: afterburner_software_version
state_topic: "AFTERBURNER/JSONout"
value_template: "{{ value_json.SysVer if value_json.SysVer is defined else this.state }}"
- name: Cyclic Mode
unique_id: afterburner_cyclic_mode
state_topic: "AFTERBURNER/JSONout"
value_template: "{{ value_json.CyclicOff if value_json.CyclicOff is defined else this.state }}"
- name: Status
unique_id: afterburner_status
state_topic: "AFTERBURNER/sts/RunString"
- name: Error
unique_id: afterburner_error
state_topic: "AFTERBURNER/sts/ErrorString"
- name: Thermostat Enabled
unique_id: afterburner_thermostat_enabled
state_topic: "AFTERBURNER/sts/Thermostat"
value_template: >
{% if value == "1" %}
Enabled
{% else %}
Disabled
{% endif %}
# COMPUTED MAX TEMP FOR CYCLIC MODE
- name: Thermostat Set Over Temperature
unique_id: afterburner_thermostat_set_over_temperature
state_topic: "AFTERBURNER/JSONout"
value_template: >
{% if "ThermostatOvertemp" in value_json %}
{% if "ThermostatOvertemp" in value_json and "CyclicTemp" in value_json %}
{{ value_json.ThermostatOvertemp|float() + value_json.CyclicTemp|float() }}
{% else %}
{{ value_json.ThermostatOvertemp|float() + states('sensor.afterburner_desired_cyclic_temperature')|float() }}
{% endif %}
{% endif %}
state_class: measurement
# COMPUTED FOR MIN TEMP CYCLIC MODE
- name: Thermostat Set Under Temperature
unique_id: afterburner_thermostat_set_under_temperature
state_topic: "AFTERBURNER/JSONout"
value_template: >
{% if "ThermostatUndertemp" in value_json %}
{% if "ThermostatUndertemp" in value_json and "CyclicTemp" in value_json %}
{{ value_json.ThermostatUndertemp|float() + value_json.CyclicTemp|float() }}
{% else %}
{{ value_json.ThermostatUndertemp|float() + states('sensor.afterburner_desired_cyclic_temperature')|float() }}
{% endif %}
{% endif %}
state_class: measurement
- name: Desired Temperature
unique_id: afterburner_desired_temperature
state_topic: "AFTERBURNER/sts/TempDesired"
device_class: temperature
unit_of_measurement: °C
state_class: measurement
- name: Desired Cyclic Temperature
unique_id: afterburner_desired_cyclic_temperature
state_topic: "AFTERBURNER/JSONout"
value_template: >
{% if "CyclicTemp" in value_json %}
{{value_json.CyclicTemp|float}}
{% endif %}
device_class: temperature
unit_of_measurement: °C
state_class: measurement
- name: Thermostat Over Temperature
unique_id: afterburner_thermostat_over_temperature
state_topic: "AFTERBURNER/JSONout"
value_template: >
{% if "ThermostatOvertemp" in value_json %}
{{value_json.ThermostatOvertemp|float}}
{% endif %}
state_class: measurement
- name: Thermostat Under Temperature
unique_id: afterburner_thermostat_under_temperature
state_topic: "AFTERBURNER/JSONout"
value_template: >
{% if "ThermostatUndertemp" in value_json %}
{{value_json.ThermostatUndertemp|float}}
{% endif %}
state_class: measurement
- name: Internal Temperature
unique_id: afterburner_internal_temperature
state_topic: "AFTERBURNER/sts/TempBody"
device_class: temperature
unit_of_measurement: °C
state_class: measurement
- name: External Temperature
unique_id: afterburner_external_temperature
state_topic: "AFTERBURNER/sts/TempCurrent"
device_class: temperature
unit_of_measurement: °C
state_class: measurement
- name: Fan Speed
unique_id: afterburner_fan
state_topic: "AFTERBURNER/sts/FanRPM"
unit_of_measurement: RPM
state_class: measurement
- name: Battery Voltage
unique_id: afterburner_supply_voltage
state_topic: "AFTERBURNER/sts/InputVoltage"
device_class: voltage
unit_of_measurement: V
state_class: measurement
# Modify 5.5 to match your own correct value
- name: Humidity
unique_id: afterburner_humidity
state_topic: "AFTERBURNER/JSONout"
value_template: "{{ value_json.Humidity|float(1)+10 if value_json.Humidity is defined else this.state }}"
- name: Altitude
unique_id: afterburner_altitude
state_topic: "AFTERBURNER/JSONout"
value_template: "{{ value_json.Altitude if value_json.Altitude is defined else this.state }}"
- name: Pressure
unique_id: afterburner_pressure
state_topic: "AFTERBURNER/JSONout"
value_template: "{{ value_json.Pressure if value_json.Pressure is defined else this.state }}"
- name: Glow Plug Current
unique_id: afterburner_glowplug_current
state_topic: "AFTERBURNER/sts/GlowCurrent"
device_class: current
unit_of_measurement: A
state_class: measurement
- name: Glow Plug Voltage
unique_id: afterburner_glowplug_voltage
state_topic: "AFTERBURNER/sts/GlowVoltage"
device_class: voltage
unit_of_measurement: V
state_class: measurement
- name: Glow Plug Time (Total)
unique_id: afterburner_glowplug_time_total
state_topic: "AFTERBURNER/JSONout"
unit_of_measurement: "Hrs"
state_class: total_increasing
value_template: >
{% if "SysGlowTime" in value_json %}
{{ (value_json.SysGlowTime/3600|float*1.00)|round(1) }}
{% endif %}
- name: Pump Frequency
unique_id: afterburner_pump_frequency
state_topic: "AFTERBURNER/sts/PumpActual"
unit_of_measurement: Hz
device_class: frequency
state_class: measurement
- name: Pump Fixed Frequency
unique_id: afterburner_pump_fixed_frequency
state_topic: "AFTERBURNER/sts/PumpFixed"
unit_of_measurement: Hz
device_class: frequency
state_class: measurement
- name: Fuel Level
unique_id: afterburner_fuel_level
state_topic: "AFTERBURNER/sts/FuelUsage"
value_template: "{{(200-value|float*0.001)|round(2)}}"
unit_of_measurement: L
state_class: measurement
- name: Fuel Consumption
unique_id: afterburner_fuel_consumption
state_topic: "AFTERBURNER/sts/FuelRate"
value_template: "{{(value|float*0.001)|round(2)}}"
unit_of_measurement: L/Hr
state_class: measurement
- name: Fuel Consumed Since Reset
unique_id: afterburner_current_fuel_consumed
state_topic: "AFTERBURNER/sts/FuelUsage"
value_template: "{{(value|float*0.001)|round(2)}}"
unit_of_measurement: L
state_class: measurement
- name: Total Fuel Consumed
unique_id: afterburner_total_fuel_consumed
state_topic: "AFTERBURNER/sts/TotalFuelUsage"
value_template: "{{(value|float*0.001)|round(2)}}"
unit_of_measurement: L
state_class: total_increasing
- name: System Run Time
unique_id: afterburner_total_run_time
state_topic: "AFTERBURNER/JSONout"
value_template: >
{% if "SysUpTime" in value_json %}
{{ (value_json.SysUpTime/3600|float*1.00)|round(1) }}
{% endif %}
unit_of_measurement: "Hrs"
state_class: total_increasing
button:
- name: Fuel Reset
unique_id: afterburner_fuel_reset
command_topic: "AFTERBURNER/JSONin"
payload_press: '{"PumpCount": 0}'
icon: mdi:refresh
qos: 0
retain: false
- name: Refresh
unique_id: afterburner_refresh
command_topic: "AFTERBURNER/cmd/Refresh"
payload_press: "1"
icon: mdi:refresh
qos: 0
retain: false
climate:
# REGULAR WITH TARGET TEMPERATURE SETUP
- name: Afterburner
# identification
unique_id: afterburner_climate_control
device:
identifiers: ["Afterburner"]
# put your AB web page link
configuration_url: http://afterburner.lan
# what is displayed according to RunState: allowed are ['cooling', 'drying', 'fan', 'heating', 'idle', 'off', 'preheating']
action_topic: "AFTERBURNER/sts/RunState"
action_template: >
{% if value in ("0", "6", "7", "8", "11", "12") %}
off
{% elif value in ("1", "2", "9", "3") %}
preheating
{% elif value in ("10", "12") %}
idle
{% else %}
heating
{% endif %}
current_temperature_topic: "AFTERBURNER/sts/TempCurrent"
max_temp: 35
min_temp: 8
# enabled modes; allowed modes are [“auto”, “off”, “cool”, “heat”, “dry”, “fan_only”]
# auto is used for suspend
modes:
- "off"
- "auto" #suspend
- "heat"
- "cool"
# - "dry"
# - "fan_only"
# Updating card state mode according to RunState value; must correspond to enabled modes
mode_state_topic: "AFTERBURNER/sts/RunState"
mode_state_template: >
{% if value in ("1", "9", "2", "4", "5") %}
heat
{% elif value in ("10", "11", "12") %}
cool
{% else %}
off
{% endif %}
# When button is pressed Update afterburner according to curent mode
# -1 is for suspend
mode_command_topic: "AFTERBURNER/cmd/Run"
mode_command_template: >
{% if value == "heat" %}
1
{% elif value == "cool" %}
-1
{% else %}
0
{% endif %}
# Updating card state according to curent mode, this one works fine
temp_step: 0.5
precision: 0.1
retain: false
temperature_command_topic: "AFTERBURNER/cmd/CyclicTemp"
temperature_command_template: >
{{ value|float() }}
temperature_state_topic: "AFTERBURNER/JSONout"
temperature_state_template: >
{% if value_json is not none and "CyclicTemp" in value_json %}
{{ value_json.CyclicTemp|float() }}
{% endif %}
# CYCLIC VERSION
- name: Afterburner
# identification
unique_id: afterburner_cyclic_climate_control
device:
identifiers: ["Afterburner"]
# put your AB web page link
configuration_url: http://afterburner.lan
# what is displayed according to RunState: allowed are ['cooling', 'drying', 'fan', 'heating', 'idle', 'off', 'preheating']
action_topic: "AFTERBURNER/sts/RunState"
action_template: >
{% if value in ("0", "6", "7", "8", "11", "12") %}
off
{% elif value in ("1", "2", "9", "3") %}
preheating
{% elif value in ("10", "12") %}
idle
{% else %}
heating
{% endif %}
current_temperature_topic: "AFTERBURNER/sts/TempCurrent"
max_temp: 35
min_temp: 8
# enabled modes; allowed modes are [“auto”, “off”, “cool”, “heat”, “dry”, “fan_only”]
# auto is used for suspend
modes:
- "off"
- "heat"
- "cool" #suspend
# - "dry"
# - "fan_only"
# Updating card state mode according to RunState value; must correspond to enabled modes
mode_state_topic: "AFTERBURNER/sts/RunState"
mode_state_template: >
{% if value in ("1", "9", "2", "4", "5") %}
heat
{% elif value in ("10", "11", "12") %}
cool
{% else %}
off
{% endif %}
# When button is pressed Update afterburner according to curent mode
# -1 is for suspend
mode_command_topic: "AFTERBURNER/cmd/Run"
mode_command_template: >
{% if value == "heat" %}
1
{% elif value == "cool" %}
-1
{% else %}
0
{% endif %}
# Updating card state according to curent mode, this one works fine
temp_step: 0.5
precision: 0.1
retain: false
temperature_high_command_topic: "AFTERBURNER/cmd/ThermostatOvertemp"
temperature_high_command_template: >
{% if ( ( value|float() - states('sensor.afterburner_desired_cyclic_temperature')|float() ) >= 1.5|float() ) and ( (value|float() - states('sensor.afterburner_desired_cyclic_temperature')|float() ) <= 10|float() ) %}
{{ value|float() - states('sensor.afterburner_desired_cyclic_temperature')|float() }}
{% else %}
{{ 1.5|float() }}
{% endif %}
temperature_high_state_topic: "AFTERBURNER/JSONout"
temperature_high_state_template: >
{% if "ThermostatOvertemp" in value_json and "CyclicTemp" in value_json and "TempCurrent" not in value_json %}
{{ value_json.ThermostatOvertemp|float() + value_json.CyclicTemp|float() }}
{% endif %}
temperature_low_command_topic: "AFTERBURNER/cmd/ThermostatUndertemp"
temperature_low_command_template: >
{% if ( ( value|float() - states('sensor.afterburner_desired_cyclic_temperature')|float() ) >= -10|float() ) and ( (value|float() - states('sensor.afterburner_desired_cyclic_temperature' )|float() ) <= -1|float() ) %}
{{ value|float() - states('sensor.afterburner_desired_cyclic_temperature')|float() }}
{% else %}
{{ -1|float() }}
{% endif %}
temperature_low_state_topic: "AFTERBURNER/JSONout"
temperature_low_state_template: >
{% if "ThermostatUndertemp" in value_json and "CyclicTemp" in value_json %}
{{ value_json.ThermostatUndertemp|float() + value_json.CyclicTemp|float() }}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment