Ive been busy programming my M5stack basic to act as a wifi alarm fob in conjuction with alarmo.
Now ive hit a bit I cant figure out, while importing the attribute sensors_open from HA, it displays the entity id.
Id prefer to have it display the entity name, Is this possible or am I going about it the wrong way?
name: alarm-fob
friendly_name: Alarm Fob
esp32:
board: esp32dev
framework:
type: arduino
spi:
clk_pin: GPIO18
mosi_pin: GPIO23
#miso_pin: GPIO12
i2s_audio:
i2s_lrclk_pin: GPIO25
i2s_bclk_pin: GPIO26
media_player:
- platform: i2s_audio
name: Alarm Fob
dac_type: external
i2s_dout_pin: 25
mode: mono
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "???"
ota:
password: "???"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Alarm-Fob Fallback Hotspot"
password: "???"
captive_portal:
text_sensor:
- platform: homeassistant
name: "alarm state"
entity_id: alarm_control_panel.alarmo
id: alarm_state
- platform: homeassistant
name: "${friendly_name}"
id: failed_sensors
entity_id: alarm_control_panel.alarmo
attribute: open_sensors
image:
- file: "caution.png"
id: my_caution
resize: 100x100
type: rgb565
- file: "greentick.png"
id: my_tick
resize: 100x100
type: rgb565
- file: "redcross.png"
id: my_cross
resize: 100x100
type: rgb565
- file: "moon.png"
id: my_moon
resize: 100x100
type: rgb565
font:
- file: "fonts/comic.ttf"
id: my_font
size: 20
color:
- id: my_red
red: 100%
green: 3%
blue: 5%
- id: my_green
red: 0%
green: 100%
blue: 0%
- id: my_blue
red: 0%
green: 0%
blue: 100%
- id: my_grey
red: 50%
green: 50%
blue: 50%
- id: my_black
red: 0%
green: 0 %
blue: 0%
- id: my_white
red: 100%
green: 100 %
blue: 100%
binary_sensor:
- platform: gpio
pin: 39
name: "Left Button"
device_class: opening
- platform: gpio
pin: 38
name: "Middle Button"
device_class: opening
- platform: gpio
pin: 37
name: "Right Button"
device_class: opening
output:
- platform: ledc
pin: 32
id: gpio_32_backlight_pwm
# Define a monochromatic, dimmable light for the backlight
light:
- platform: monochromatic
output: gpio_32_backlight_pwm
name: "Display Backlight"
id: back_light
restore_mode: ALWAYS_ON
display:
- platform: ili9xxx
model: m5stack
cs_pin: 14
dc_pin: 27
reset_pin: 33
lambda: |-
it.fill(my_black);
it.line(0, 238, 320, 238);
it.line(0, 188, 320, 188);
it.line(0, 188, 0, 238);
it.line(110, 188, 110, 238);
it.line(210, 188, 210, 238);
it.line(318, 188, 318, 238);
it.printf(50, 0, id(my_font), id(my_green), TextAlign::TOP_LEFT, id(alarm_state).state.c_str());
it.printf(50, 20, id(my_font), id(my_green), TextAlign::TOP_LEFT, id(failed_sensors).state.c_str());
if (id(wifi_signal_db).state < 5) {
it.printf(200, 0, id(my_font), id(my_green), "Wifi: %.1f", id(wifi_signal_percent).state);
it.print(30, 200, id(my_font), id(my_red), TextAlign::TOP_LEFT, "Arm");
it.print(235, 200, id(my_font), id(my_green), TextAlign::TOP_LEFT, "Disarm");
} else {
it.print(200, 0, id(my_font), id(my_red), "No Wifi");
it.print(30, 200, id(my_font), id(my_grey), TextAlign::TOP_LEFT, "Arm");
it.print(235, 200, id(my_font), id(my_grey), TextAlign::TOP_LEFT, "Disarm");
}
if (id(alarm_state).state == "disarmed") {
it.image(110, 70, id(my_tick));
}
if (id(alarm_state).state == "armed_away") {
it.image(110, 70, id(my_cross));
}
if (id(alarm_state).state == "arming") {
it.image(110, 70, id(my_caution));
}
if (id(alarm_state).state == "armed_night") {
it.image(110, 70, id(my_moon));
}
sensor:
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "WiFi Signal dB"
id: wifi_signal_db
update_interval: 5s
entity_category: "diagnostic"
- platform: copy # Reports the WiFi signal strength in %
source_id: wifi_signal_db
name: "WiFi Signal Percent"
id: wifi_signal_percent
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "Signal %"
entity_category: "diagnostic"