I’ve started using HA this week, after I using my own custom system for a long time.
The configuration really came up nicely, and the system looks cool.
There are a couple of things I’m having trouble with, probably due to lack of understanding how to work with HA, I would appreciate you helping me configuring them correctly.
IR Device:
I have a couple of Broadlink IR adapters that are used to control IR devices.
One of them is a ceiling fan.
I was able, using the remote.learn_command and remote.send_command creating buttons on the dashboard to control the fan.
However, the fan is not a “device” in the HA system, and I couldn’t figure out how to create it.
I wanted to use the “climate-fan-modes” card (as shown here), but for that I need the fan to be a device in the system, right?
What am I missing?
Custom Card:
I wanted to create a custom blank card, to be used in a grid (I have a 4 column grid, and in 2 of the rows I only want 3 buttons).
I followed the instructions here.
I created the js file in a www folder (I also created the www folder in the config folder), restarted the system, created a resource on the dashboard and restarted the system again (just to be sure).
When adding the card to the grid, I’m getting an error:
Custom element doesn't exist: content-card-blank.
name: Blank
type: custom:content-card-blank
How can I debug it, and find out what the issue is?
Hi welcome. Seems you are doing great for a newbie!
You indeed need a fan entity (not per se a device) could try to build a template fan, but the problem is that for a fan template to work properly, you’d want to know the state of the fan, which you don’t. You could try to solve that part with a power metering smart olug (just for the meter, not the switch). I kind of went overboard with that trying to guess the fan speed and oscilation by looking at power consumption. It looks like this, placed in fans.yaml:
- platform: template
fans:
dakkapel:
friendly_name: "Ventilator dakkapel"
unique_id: fan.dakkapel
value_template: "{{ is_state('switch.fan_dakkapel', 'on') and states('sensor.fan_dakkapel_power') | float(0) > 5 }}"
direction_template: "{{ iif(this.attributes.direction == 'reverse','reverse','forward','forward') }}"
percentage_template: >-
{% set p = states('sensor.fan_dakkapel_power') | float(0) %}
{% if p <= 5 %}0
{% elif p <= 19 %}40
{% elif p <= 21 %}20
{% elif p <= 22.2 %}40
{% elif p <= 23.5 %}20
{% elif p <= 25.1 %}60
{% elif p <= 25.6 %}80
{% elif p <= 26.5 %}100
{% elif p <= 27.5 %}60
{% elif p <= 27.6 %}80
{% else %}100
{% endif %}
oscillating_template: >-
{% set p = states('sensor.fan_dakkapel_power') | float(0) %}
{{ p > 22.2 and p <= 23.5 or p >= 26.5 }}
turn_on:
action: remote.send_command
data:
num_repeats: 1
command: power
device: Fan dakkapel
target:
entity_id: remote.remote_dakkapel
turn_off:
action: remote.send_command
data:
num_repeats: 1
delay_secs: 0.4
command: power
device: Fan dakkapel
target:
entity_id: remote.remote_dakkapel
set_percentage:
action: remote.send_command
data:
num_repeats: >-
{% set n = (100 + percentage - (this.attributes.percentage | int(0))) / 20 % 5 %}
{{ iif(n < 1, 1, n, 1) }}
delay_secs: 0.4
command: speed
device: Fan dakkapel
target:
entity_id: remote.remote_dakkapel
set_oscillating:
action: remote.send_command
data:
num_repeats: 0
delay_secs: 0.4
command: rotate
device: Fan dakkapel
target:
entity_id: remote.remote_dakkapel
set_direction:
action: remote.send_command
data:
num_repeats: 1
delay_secs: 0.4
command: rotate
device: Fan dakkapel
target:
entity_id: remote.remote_dakkapel
speed_count: 5
What do you need the card for? There are many custom cards on offer to get you started. Starting from scratch is possible, but may not be needed.
About the fan, I’m not interested in its state or power consumption, I just want to use the climate card, and not have 4 buttons like I have today.
I’ll try to implement the fan as an entity, there is no new entity button, so I have to do it via the configuration.yaml file, right?
About the card, I don’t really need a card, just a spacer.
I will implement @tom_l’s idea (transparent png), it’s simple and easy.
I was able to create a custom entity for the fan, and now I can select it as an entity on a dashboard.
I’m working now on the script, that the entity configuration is triggering.
I tried to use the same “Remote: Send Command” action, that I have used on the dashboard button, but there is something wrong.
When trying to run it (from the 3 dots on the top right corner), the command actually sent to the fan, but then it shows an unknown error:
When trying to run the whole script it also sends the command, and then shows a different error message:
“Failed to perform the action script/lv_fan_off. Enum RemoteKeyCode has no value defined for name ‘KEYCODE_fan_off’”