It all started out that I need to control my heating due to the new huge variations in price.
In the manual for my air-to-water heat pump CTC i350 I found that it have an internal interface, two ports, that can be controlled via two simple switches. So now I need some automation to control this…
Thanks to @EdwardTFN and @ondras12345 I have a solution that will work for my heater, CTC i350.
Summary table from the CTC i350 user’s manual:
So by switching two switches, Smart A and Smart B, we can signal 4 different modes/levels to CTC i350.
This is what I did so far (edited 2022-10-06 after a cleanup and added comments):
Added code to configuration.yaml:
template:
- sensor:
# The daily reported Price Average is needed in the threshold calculations.
- name: Electricity Price Average
unit_of_measurement: "SEK/kWh"
icon: mdi:currency-usd
state: "{{ state_attr('sensor.electricity_price_majbosv6', 'avg_price') | float(0) }}"
# Only used to set up a simple graph.
- name: Electricity Price Min
unit_of_measurement: "SEK/kWh"
icon: mdi:currency-usd
state: "{{ state_attr('sensor.electricity_price_majbosv6', 'min_price') | float(0) }}"
# Only used to set up a simple graph.
- name: Electricity Price Max
unit_of_measurement: "SEK/kWh"
icon: mdi:currency-usd
state: "{{ state_attr('sensor.electricity_price_majbosv6', 'max_price') | float(0) }}"
# Calculation from the requested percentage limits and daily Price Average into
# actual "SEK/kWh" limits.
# Please note that the 3 "input_number.threshold..." are "helpers" created from
# Settings -> Devices & Services -> Helpers.
# Then you can create sliders for easy control, by adding the helpers in the
# “Entities Card Configuration”.
- name: Electricity Threshold Limit 1
unit_of_measurement: "SEK/kWh"
icon: mdi:currency-usd
state: >
{% set price_avg = state_attr('sensor.electricity_price_majbosv6', 'avg_price') | float(0) %}
{% set threshold = states('input_number.threshold_1_low') | float(0) %}
{{ (price_avg * threshold / 100) | round(2) }}
- name: Electricity Threshold Limit 2
unit_of_measurement: "SEK/kWh"
icon: mdi:currency-usd
state: >
{% set price_avg = state_attr('sensor.electricity_price_majbosv6', 'avg_price') | float(0) %}
{% set threshold = states('input_number.threshold_2_medium') | float(0) %}
{{ (price_avg * threshold / 100) | round(2) }}
- name: Electricity Threshold Limit 3
unit_of_measurement: "SEK/kWh"
icon: mdi:currency-usd
state: >
{% set price_avg = state_attr('sensor.electricity_price_majbosv6', 'avg_price') | float(0) %}
{% set threshold = states('input_number.threshold_3_high') | float(0) %}
{{ (price_avg * threshold / 100) | round(2) }}
# From the above calculations, choose the appropriate Price Level.
- name: Electricity Price 4 Levels (24h)
unit_of_measurement: ""
icon: mdi:currency-usd
state: >-
{% set price_cur = states('sensor.electricity_price_majbosv6') | float(0) %}
{% set price_avg = state_attr('sensor.electricity_price_majbosv6', 'avg_price') | float(0) %}
{% set threshold_1 = states('input_number.threshold_1_low') | float(0) %}
{% set threshold_2 = states('input_number.threshold_2_medium') | float(0) %}
{% set threshold_3 = states('input_number.threshold_3_high') | float(0) %}
{% if price_cur == 0 or price_avg == 0 %}
-1
{% else %}
{% set price_ratio = (price_cur / price_avg) %}
{% if price_ratio >= (threshold_3 / 100) %}
4
{% elif price_ratio >= (threshold_2 / 100) %}
3
{% elif price_ratio <= (threshold_1 / 100) %}
1
{% else %}
2
{% endif %}
{% endif %}
The “simple graph” looks like this:
I’m using three “helpers” to be able to adjust/trim the threshold values. These helpers can be created from Settings → Devices & Services → Helpers.
Then you can create sliders for easy control in a Dashboard page, by adding the helpers in the “Entities Card Configuration”:
For the controlling of CTC i350 we also need to add some automation:
The following is added to the automations.yaml:
- alias: CTC SmartGrid control
# CTC level Meaning Smart A Smart B
# 4 expensive Closed Open
# 3 normal Open Open
# 2 cheap Open Closed
# 1 very cheap Closed Closed
trigger:
- platform: state
entity_id: sensor.electricity_price_majbosv6
mode: restart
action:
- choose:
# IF above 3 -> level 4: expensive
- conditions:
- condition: numeric_state
entity_id: sensor.electricity_price_4_levels_24h
above: 3
sequence:
- service: switch.turn_on # Closed
target:
# Smart A
entity_id: switch.badrum_xx_wmr_3000_ch1
- service: switch.turn_off # Open
target:
# Smart B
entity_id: switch.badrum_yy_wmr_3000_ch2
- service: notify.notify
data:
message: "level 4: most expensive"
# ELIF above 2 -> level 3: normal
- conditions:
- condition: numeric_state
entity_id: sensor.electricity_price_4_levels_24h
above: 2
sequence:
- service: switch.turn_off # Open
target:
# Smart A
entity_id: switch.badrum_xx_wmr_3000_ch1
- service: switch.turn_off # Open
target:
# Smart B
entity_id: switch.badrum_yy_wmr_3000_ch2
- service: notify.notify
data:
message: "level 3: normal"
# ELIF above 1 -> level 2: cheap
- conditions:
- condition: numeric_state
entity_id: sensor.electricity_price_4_levels_24h
above: 1
sequence:
- service: switch.turn_off # Open
target:
# Smart A
entity_id: switch.badrum_xx_wmr_3000_ch1
- service: switch.turn_on # Closed
target:
# Smart B
entity_id: switch.badrum_yy_wmr_3000_ch2
- service: notify.notify
data:
message: "level 2: cheap"
# ELSE below 2 -> level 1: very cheap
default:
- service: switch.turn_on # Closed
target:
# Smart A
entity_id: switch.badrum_xx_wmr_3000_ch1
- service: switch.turn_on # Closed
target:
# Smart B
entity_id: switch.badrum_yy_wmr_3000_ch2
- service: notify.notify
data:
message: "level 1: very cheap"
Why am I using 24h average? I don’t like the Tibber style Levels due to the fact that they are using “three days old” average. This will be problematic when you’ve had a couple of cheap days because when the price goes up the heater could be blocked for a whole day since the average are too old. The heating system is a slow system, but not as slow as several days…
Here you can see the difference between Tibber Levels and Today average Levels (in this graph only three levels though)
Some of my “debug” graphs:
2022-10-08 Adding more of the integration
Inside the CTC i350 I can identify the interfaces which needs to be connected.
Close up of the Alarm interface.
I have chosen the Shelly 2.5 as an implant for my CTC i350 and it is now connected
Some more settings needed to be done from the CTC i350 menu defining Smartgrid.
Then the CTC i350 was restarted and I could make some tests to see the response:
Here the Shelly ports are set to Over capacity - and it shows up on the display.
Also, the Alarm was tested and now I can get a notice to Home Assistant Companion App
Right now the weather here is still quite warm and we don’t need any heating. So I am only affecting the heat water production. Later, when it gets colder we will see if the settings are fine or if i need to tweak anything…
I hope this can help someone else as well