Open deuxzero opened 1 year ago
i did manage to make it but for some reason i cant see any entity in the light menu.. i change it like that :
light_1: switch.sonoff_1000739592_1 light_2: switch.sonoff_1000739592_3 light_3: light.bulb_rgbcw_4f2452 light_4: light.led_bar
light_1_title: entré light_2_title: escalier light_3_title: lampe salon light_4_title: led bar
but nothing appear in page 3
do i need to add some configuration in hass config file?
Hi,
You don't need to add anything on the home assistant end. The lights should be on page one btw.
Do let me know if you need anymore help..
tk for the reply. page one is not suppose to be home remote boot screen? i did try several approach but i did not have any success ... The clock , wifi batterie statut and weather work fine but nothing on light page and media page. here the code in case you can spot the bug (i even try to change font but did not work) : `esphome: name: telecommande
on_boot: then:
script.execute: auto_sleep_manager
on_shutdown: then:
substitutions:
temprature_sensor: sensor.vulaines_sur_seine_temperatur weather: sensor.77_weather_alert
scenes: input_select.scenes
light_1: switch.sonoff_1000739592_3
light_2: switch.sonoff_1000739592_1
light_3: light.bulb_rgbcw_4f2452
light_4: light.living_room_lamp
light_1_title: Bedroom light_2_title: Bathroom light_3_title: Kitchen light_4_title: Livingroom
media: media_player.freebox_player_mini_v2
esp32: board: esp32dev framework: type: arduino
api: encryption: key: "Dyrd8TMvh8Q1CeSw7ImWKb5rKgL9CDGqyfQOE7Lkx28="
ota: password: "67cde2bfd831e201161a6eaddb0f09a3"
wifi: ssid: !secret wifi_ssid password: !secret wifi_password fast_connect: true
globals:
deep_sleep: id: deep_sleep_esp
wakeup_pin: number: GPIO26 inverted: true
i2c: sda: 21 scl: 22 scan: false frequency: 800kHz
font:
'', #pause '', #play '', #next '' #back ]
"", # mdi-weather-sunny "", # mdi-weather-night "", # mdi-weather-cloudy "", # mdi-weather-pouring "", # mdi-weather-windy-variant "", # mdi-weather-fog "", # mdi-weather-night-partly-cloudy "", # mdi-weather-partly-cloudy ]
"", # battery 100
"", # battery 90
"", # battery 80
"", # battery 70
"", # battery 60
"", # battery 50
"", # battery 40
"", # battery 30
"", # battery 20
"", # battery 10
"", # wifi - 0
"", # wifi - 1
"", # wifi - 2
"", # wifi - 3
"", # wifi - 4
"", # charging
]
"", # button off "" # button on ]
script:
switch:
time:
binary_sensor:
platform: gpio name: "Home Remote Battery State" id: battery_state device_class: battery_charging pin: number: GPIO14 on_press: then:
platform: homeassistant id: prevent_deep_sleep entity_id: input_boolean.remote_wake
platform: status name: "Home Remote Status"
platform: homeassistant id: light_1 entity_id: "${light_1}" internal: true
platform: homeassistant id: light_2 entity_id: "${light_2}" internal: true
platform: homeassistant id: light_3 entity_id: "${light_3}" internal: true
platform: homeassistant id: light_4 entity_id: "${light_4}" internal: true
##################################NAVIGATION BUTTONS############################
############################ SELECT/OK BUTTON #################################
platform: gpio
name: "Ok"
pin:
number: GPIO26
inverted: true
mode:
input: true
pullup: true
internal: true
on_press:
then:
script.execute: auto_sleep_manager
if: condition: display.is_displaying_page: page4 then:
if: condition: display.is_displaying_page: page3 then:
######################### PAGE NAVINGATION BUTTONS #############################
platform: gpio
name: home
id: home_button
pin:
number: GPIO03
inverted: true
mode:
input: true
pullup: true
internal: true
on_click:
on_multi_click:
############################# WAKE SLEEP BUTTON ################################
button:
sensor:
platform: homeassistant id: inside_temperature entity_id: "${temprature_sensor}" internal: true
platform: homeassistant id: media_volume entity_id: "${media}" attribute: volume_level internal: true
platform: wifi_signal name: "Home Remote WiFi Signal" id: signal_strength update_interval: 30s
platform: adc pin: 36 name: "Home Remote Battery Voltage" id: battery_voltage attenuation: 11dB update_interval: 30s filters: multiply: 1.44
text_sensor:
platform: homeassistant id: scene entity_id: "${scenes}" internal: true
platform: homeassistant id: media_title entity_id: "${media}" attribute: media_title internal: true
platform: homeassistant id: media_artist entity_id: "${media}" attribute: media_artist internal: true
platform: homeassistant id: weather entity_id: "${weather}" internal: true
platform: homeassistant id: media_status entity_id: "${media}" internal: true
display:
############################# INITIAL BLANK PAGE ###############################
################################# HOME PAGE ####################################
id: page2 lambda: |-
//Scene display
if (id(scene).has_state()) {
it.printf(64, 0, id(media_artist_font),TextAlign::TOP_CENTER, "< %s >",to_string(id(scene).state).c_str());
}
//wifi
if (id(signal_strength).state > -50)
{ it.printf(6, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); }
else{
if (id(signal_strength).state > -60)
{ it.printf(6, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); }
else{
if (id(signal_strength).state > -70)
{ it.printf(6, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); }
else{
if (id(signal_strength).state > -80)
{ it.printf(6, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); }
else{
if (id(signal_strength).state > -90)
{ it.printf(6, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); }
}}}}
//battery
if (id(battery_voltage).state > 4.11)
{ it.printf(124, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); } //100
else{
if (id(battery_voltage).state > 4.02)
{ it.printf(124, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); } //90
else{
if (id(battery_voltage).state > 3.95)
{ it.printf(124, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); } //80
else{
if (id(battery_voltage).state > 3.87)
{ it.printf(124, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); } //70
else{
if (id(battery_voltage).state > 3.84)
{ it.printf(124, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); } //60
else{
if (id(battery_voltage).state > 3.8)
{ it.printf(124, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); } //50
else{
if (id(battery_voltage).state > 3.77)
{ it.printf(124, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); } //40
else{
if (id(battery_voltage).state > 3.73)
{ it.printf(124, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); } //30
else{
if (id(battery_voltage).state > 3.69)
{ it.printf(124, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); } //20
else
{ it.printf(124, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); } //10
}}}}}}}}
//Battery charging state
if(id(battery_state).state)
{ it.printf(114, 0, id(wifi_battery_font),TextAlign::TOP_CENTER, ""); }
//Weather display
if (id(weather).state == "sunny")
{ it.printf(110, 36, id(weather_font),TextAlign::CENTER, ""); }
if (id(weather).state == "night")
{ it.printf(110, 36, id(weather_font),TextAlign::CENTER, ""); }
if (id(weather).state == "cloudy")
{ it.printf(110, 36, id(weather_font),TextAlign::CENTER, ""); }
if (id(weather).state == "pouring")
{ it.printf(110, 36, id(weather_font),TextAlign::CENTER, ""); }
if (id(weather).state == "rainy")
{ it.printf(110, 36, id(weather_font),TextAlign::CENTER, ""); }
if (id(weather).state == "windy")
{ it.printf(110, 36, id(weather_font),TextAlign::CENTER, ""); }
if (id(weather).state == "fog")
{ it.printf(110, 36, id(weather_font),TextAlign::CENTER, ""); }
if (id(weather).state == "night-partly-cloudy")
{ it.printf(110, 36, id(weather_font),TextAlign::CENTER, ""); }
if (id(weather).state == "partly-cloudy")
{ it.printf(110, 36, id(weather_font),TextAlign::CENTER, ""); }
// Time
it.strftime(0, 60, id(clock_font), TextAlign::BASELINE_LEFT, "%H:%M", id(esptime).now());
// Temprature
if (id(inside_temperature).has_state()) {
it.printf(127, 60, id(media_title_font), TextAlign::BASELINE_RIGHT , "%.1f°", id(inside_temperature).state);
}
############################### LIGHTS PAGE ####################################
id: page3 lambda: |- if (id(scene).has_state()) {
//Rectangle
if (id(select_pos) == 0)
{
it.rectangle(0, 0, 127, 17);
}
if (id(select_pos) == 1)
{
it.rectangle(0, 16, 127, 17);
}
if (id(select_pos) == 2)
{
it.rectangle(0, 32, 127, 17);
}
if (id(select_pos) == 3)
{
it.rectangle(0, 46, 127, 17);
}
//Lamp
it.printf(4, 0, id(media_title_font),TextAlign::LEFT, "${light_1_title}");
if(id(light_1).state == 1)
{
it.printf(102, 0, id(toggle_switch_font),TextAlign::LEFT, "");
}
else
{
it.printf(102, 0, id(toggle_switch_font),TextAlign::LEFT, "");
}
it.printf(4, 16, id(media_title_font),TextAlign::LEFT, "${light_2_title}");
if(id(light_2).state == 1)
{
it.printf(102, 16, id(toggle_switch_font),TextAlign::LEFT, "");
}
else
{
it.printf(102, 16, id(toggle_switch_font),TextAlign::LEFT, "");
}
it.printf(4,31, id(media_title_font),TextAlign::LEFT, "${light_3_title}");
if(id(light_3).state == 1)
{
it.printf(102,31, id(toggle_switch_font),TextAlign::LEFT, "");
}
else
{
it.printf(102, 31, id(toggle_switch_font),TextAlign::LEFT, "");
}
it.printf(4, 46, id(media_title_font),TextAlign::LEFT, "${light_4_title}");
if(id(light_4).state == 1)
{
it.printf(102, 46, id(toggle_switch_font),TextAlign::LEFT, "");
}
else
{
it.printf(102, 46, id(toggle_switch_font),TextAlign::LEFT, "");
}
}
################################ MEDIA PAGE ####################################
id: page4 lambda: |- if (id(media_title).has_state()) { it.printf(64, 0, id(media_title_font),TextAlign::TOP_CENTER, "%s",to_string(id(media_title).state).c_str()); it.printf(64, 16, id(media_artist_font),TextAlign::TOP_CENTER, "%s",to_string(id(media_artist).state).c_str());
it.rectangle(15, 33, 98, 5);
it.filled_rectangle(15, 33, (id(media_volume).state*98), 5);
it.printf(26, 52, id(media_font),TextAlign::CENTER, "");
it.printf(102, 52, id(media_font),TextAlign::CENTER, "");
if(id(media_status).state == "playing")
{
it.printf(64, 52, id(media_font),TextAlign::CENTER, "");
}
else
{
it.printf(64, 52, id(media_font),TextAlign::CENTER, "");
}
}
################################# BOOT PAGE ####################################
############################ BATTERY CHARGING PAGE #############################
i ve just change stuff in substitution section / time zone and add some api
Um I think it might be an issue with the buttons. Does pressing the button change anything on the display?
Ooh i found the problem. Just remove "if (id(scene).has_state()) {" from the lights page. You may not have that entity setup. So the if condition would return false all the time. Be sure to remove the extra "}" at the end too. You can do the same for the media player. Let me know if it works...
Nice project! do you have some wiring schematic, visualisation is easiere for me ;)