minion.yaml 124 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855
  1. ## You can change the friendly name if you wish on line 7 below. The friendly name is how the device will show in HA
  2. ## However the <name:> is how HA connects to the device eg. esp32-s3-box-3.local is the mDNS hostname for the device.
  3. ## Once added to HA changing the device name can lead to connection issues, between HA and the device.
  4. substitutions:
  5. name: minion
  6. friendly_name: minion
  7. encryption_key: "cl+UvrGxxeAFVNtdkT9zj0dAvl2C1QQB+8/IigP6aIk="
  8. ota_password: "c211e0e8d3b4c2a62f0b81041563b369"
  9. external_media_player: your_media_player ##change this to your external media player enity_id: do not include media_player.
  10. home_assistant_host: http://iris.dgtlu.net:8123 ##change to the full url or IP of your HA server including port
  11. tts_voice_speed: "16000" #options #nabu casa "24000" #piper "16000" elevenlabs "44100" must include quotes
  12. #################### ON DEVICE WAKE WORDS #######################################
  13. #### all of the below wakewords are installed on the device #####
  14. #### you can use any of these without re-compiling - just say them! #####
  15. #################################################################################
  16. # TO REMOVE A WAKE WORD - COMMENT OUT THE CORESPONDING LINE FROM THE CONFIG BELOW - CTRL + F to search for "models"
  17. micro_wake_word_model_1: alexa
  18. micro_wake_word_model_2: hey_jarvis
  19. micro_wake_word_model_3: okay_nabu
  20. micro_wake_word_model_4: hey_mycroft
  21. ####################################################################
  22. ##### Days and months #####
  23. ## Change the values on the right to match your locale ##
  24. monday: Monday
  25. tuesday: Tuesday
  26. wednesday: Wednesday
  27. thursday: Thursday
  28. friday: Friday
  29. saturday: Saturday
  30. sunday: Sunday
  31. jan: January
  32. feb: February
  33. mar: March
  34. apr: April
  35. may: May
  36. jun: June
  37. jul: July
  38. aug: August
  39. sept: September
  40. oct: October
  41. nov: November
  42. dec: December
  43. #####################################################################
  44. ##### DO NOT CHANGE SUBSTITUTIONS BELOW THIS LINE ######
  45. ##### UNLESS YOU KNOW WHAT YOU ARE DOING ######
  46. font_glyphs: '&@!"''%()+=,-_.:°/$€£¥?0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyzÀàÁáÂâÃãÄäĀāĂăÅåǺǻẠạĄąÆæǼǽĆćĈĉČčĊċÇçĎďĐđÐðÈèÉéÊêẼẽĚěËëĒēĔĕĖėẸẹĘęĜĝǦǧĞğĠġĢģĤĥĦħıÌìÍíÎîĨĩÏïĪīĬĭİỊịĮįȷĴĵĶķĸĹ弾ĻļŁłĿŀŃńÑñŇňŅņƝɲŊŋʼnÒòÓóÔôÕõÖöŌōŎŏŐőỌọǪǫØøǾǿŒœŔŕŘřŖŗŚśŜŝŠšŞşȘșẞߍťŢţȚțŦŧÞþÙùÚúÛûŨũÜüŪūŬŭŮůŰűỤụŲųẀẁẂẃŴŵẄẅỲỳÝýŶŷỸỹŸÿȲȳŹźŽžŻżIJijƏə'
  47. ############# END OF SUBSTITUTIONS #################
  48. ####################################################
  49. esphome:
  50. name: ${name}
  51. friendly_name: ${friendly_name}
  52. min_version: 2025.2.0
  53. on_boot:
  54. priority: 600
  55. then:
  56. - lambda: "id(led).turn_on().set_brightness(id(s_default_brightness).state /100).perform();"
  57. - display.page.show: loading_page
  58. - component.update: s3_box_lcd
  59. - script.execute: saver_enabled
  60. - lambda: 'id(time_remaining_0).publish_state ("0:00:00");'
  61. - if:
  62. condition:
  63. switch.is_on: output_audio
  64. then:
  65. media_player.volume_set:
  66. id: speaker_media_player
  67. volume: 0
  68. project:
  69. name: "BigBobbas.s3box"
  70. version: "2024.09.02"
  71. esp32:
  72. board: esp32s3box
  73. flash_size: 16MB
  74. framework:
  75. type: esp-idf
  76. sdkconfig_options:
  77. CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
  78. CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
  79. CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
  80. psram:
  81. mode: octal
  82. speed: 80MHz
  83. api:
  84. on_client_connected:
  85. - lambda: |-
  86. id(api_connection) = true;
  87. - lambda: "id(led).turn_on().set_brightness(id(s_default_brightness).state /100).perform();"
  88. - component.update: s3_box_lcd
  89. - script.execute: saver_enabled
  90. on_client_disconnected:
  91. - lambda: |-
  92. id(api_connection) = false;
  93. encryption:
  94. key: ${encryption_key}
  95. ota:
  96. - platform: esphome
  97. on_begin:
  98. - lambda: |-
  99. id(led).turn_on().set_brightness(1.0).set_transition_length(0).perform();
  100. id(led).loop();
  101. - display.page.show: ota_page
  102. - component.update: s3_box_lcd
  103. logger:
  104. hardware_uart: USB_SERIAL_JTAG
  105. logs:
  106. text_sensor: WARN
  107. component: ERROR
  108. wifi:
  109. ssid: !secret wifi_ssid
  110. password: !secret wifi_password
  111. ap:
  112. ssid: ${name}
  113. password: s3box123
  114. on_connect:
  115. - lambda: |-
  116. id(wifi_connection) = true;
  117. - display.page.show: idle_page
  118. - component.update: s3_box_lcd
  119. - switch.turn_on: speaker_enable
  120. on_disconnect:
  121. - lambda: |-
  122. id(wifi_connection) = false;
  123. captive_portal:
  124. time:
  125. - platform: homeassistant
  126. id: ha_time
  127. interval:
  128. - interval: 30s
  129. then:
  130. - component.update: s3_box_lcd
  131. - interval: 10s
  132. then:
  133. - if:
  134. condition:
  135. - lambda: "return { (id(api_connection) != true) };"
  136. then:
  137. - if:
  138. condition:
  139. api.connected:
  140. then:
  141. - lambda: "id(api_connection) = true;"
  142. else:
  143. - if:
  144. condition:
  145. not:
  146. api.connected:
  147. then:
  148. - lambda: "id(api_connection) = false;"
  149. - interval: 10s
  150. then:
  151. - if:
  152. condition:
  153. - lambda: "return { (id(wifi_connection) != true) };"
  154. then:
  155. - if:
  156. condition:
  157. wifi.connected:
  158. then:
  159. - lambda: "id(wifi_connection) = true;"
  160. else:
  161. - if:
  162. condition:
  163. not:
  164. wifi.connected:
  165. then:
  166. - lambda: "id(wifi_connection) = false;"
  167. select:
  168. - platform: template
  169. entity_category: config
  170. name: Wake word engine location
  171. id: wake_word_engine_location
  172. optimistic: true
  173. restore_value: true
  174. options:
  175. - In Home Assistant
  176. - On device
  177. initial_option: In Home Assistant
  178. on_value:
  179. - if:
  180. condition:
  181. lambda: 'return x == "In Home Assistant";'
  182. then:
  183. - micro_wake_word.stop
  184. - delay: 500ms
  185. - lambda: "id(va).set_use_wake_word(true);"
  186. - voice_assistant.start_continuous:
  187. - text_sensor.template.publish:
  188. id: wakeword_location
  189. state: !lambda 'return "Home Assistant";'
  190. - component.update: s3_box_lcd
  191. - if:
  192. condition:
  193. lambda: 'return x == "On device";'
  194. then:
  195. - text_sensor.template.publish:
  196. id: wakeword_location
  197. state: !lambda 'return "On Device";'
  198. - lambda: "id(va).set_use_wake_word(false);"
  199. - voice_assistant.stop
  200. - delay: 500ms
  201. - micro_wake_word.start
  202. - component.update: s3_box_lcd
  203. - platform: template
  204. entity_category: config
  205. name: Time Format
  206. id: time_format
  207. optimistic: true
  208. restore_value: true
  209. options:
  210. - 12 Hr
  211. - 24 Hr
  212. initial_option: 24 Hr
  213. on_value:
  214. then:
  215. - if:
  216. condition:
  217. lambda: 'return x == "24 Hr";'
  218. then:
  219. - text_sensor.template.publish:
  220. id: time_display_format
  221. state: !lambda 'return "24 Hr";'
  222. else:
  223. - text_sensor.template.publish:
  224. id: time_display_format
  225. state: !lambda 'return "12 Hr";'
  226. - component.update: s3_box_lcd
  227. script:
  228. - id: start_voice_assistant
  229. then:
  230. - if:
  231. condition:
  232. switch.is_off: mute_switch
  233. then:
  234. - if:
  235. condition:
  236. lambda: 'return id(wake_word_engine_location).state == "In Home Assistant";'
  237. then:
  238. - lambda: "id(va).set_use_wake_word(true);"
  239. - voice_assistant.start_continuous:
  240. - if:
  241. condition:
  242. lambda: 'return id(wake_word_engine_location).state == "On device";'
  243. then:
  244. - lambda: "id(va).set_use_wake_word(false);"
  245. - micro_wake_word.start
  246. - id: stop_voice_assistant
  247. then:
  248. - if:
  249. condition:
  250. lambda: 'return id(wake_word_engine_location).state == "In Home Assistant";'
  251. then:
  252. - lambda: "id(va).set_use_wake_word(false);"
  253. - voice_assistant.stop:
  254. - if:
  255. condition:
  256. lambda: 'return id(wake_word_engine_location).state == "On device";'
  257. then:
  258. - voice_assistant.stop:
  259. - micro_wake_word.stop:
  260. - id: set_volume
  261. then:
  262. - media_player.volume_set:
  263. volume: !lambda "return 0.5 + id(speaker_volume) * 0.05 ;"
  264. - id: saver_enabled
  265. then:
  266. - if:
  267. condition:
  268. switch.is_on: s_saver
  269. then:
  270. - lambda: "id(led).turn_on().set_brightness(id(s_default_brightness).state /100).perform();"
  271. - delay: !lambda "return id(s_saver_delay).state * 1000;"
  272. - lambda: "id(led).turn_on().set_brightness(id(s_saver_brightness).state /100).perform();"
  273. - display.page.show: saver_page
  274. - component.update: s3_box_lcd
  275. - if:
  276. condition:
  277. - switch.is_on: s_saver_mode
  278. then:
  279. - delay: !lambda "return id(s_saver_blank_delay).state * 1000;"
  280. - light.turn_off: led
  281. mode: restart
  282. - id: saver_enabled_manual
  283. then:
  284. - if:
  285. condition:
  286. - switch.is_on: s_saver
  287. then:
  288. - lambda: "id(led).turn_on().set_brightness(id(s_saver_brightness).state /100).perform();"
  289. - display.page.show: saver_page
  290. - component.update: s3_box_lcd
  291. - if:
  292. condition:
  293. - switch.is_on: s_saver_mode
  294. then:
  295. - delay: !lambda "return id(s_saver_blank_delay).state * 1000;"
  296. - light.turn_off: led
  297. - component.update: s3_box_lcd
  298. mode: restart
  299. # - id: timer_started
  300. # then:
  301. # while:
  302. # condition:
  303. # switch.is_on: timer_ringing
  304. # then:
  305. # - media_player.play_media:
  306. # media_url: "${home_assistant_host}/local/sounds/timer_finished.mp3"
  307. # - delay: 1s
  308. - id: timer_started_external
  309. then:
  310. while:
  311. condition:
  312. switch.is_on: timer_ringing
  313. then:
  314. - homeassistant.service:
  315. service: media_player.play_media
  316. data:
  317. entity_id: media_player.${external_media_player}
  318. media_content_id: "${home_assistant_host}/local/sounds/timer_finished.mp3"
  319. media_content_type: music
  320. - delay: 1700ms
  321. - id: timer_ending
  322. then:
  323. - wait_until:
  324. - lambda: 'return (id(time_remaining_0).state == "0:00:10");'
  325. - script.execute: saver_enabled
  326. - display.page.show: time_remaining_page
  327. - component.update: s3_box_lcd
  328. - id: increment_digit_1
  329. then:
  330. - lambda: |-
  331. id(current_pin) += "1";
  332. ESP_LOGD("increment_digit_1", "Current PIN: %s", id(current_pin).c_str());
  333. - id: increment_digit_2
  334. then:
  335. - lambda: |-
  336. id(current_pin) += "2";
  337. ESP_LOGD("increment_digit_2", "Current PIN: %s", id(current_pin).c_str());
  338. - id: increment_digit_3
  339. then:
  340. - lambda: |-
  341. id(current_pin) += "3";
  342. ESP_LOGD("increment_digit_3", "Current PIN: %s", id(current_pin).c_str());
  343. - id: increment_digit_4
  344. then:
  345. - lambda: |-
  346. id(current_pin) += "4";
  347. ESP_LOGD("increment_digit_4", "Current PIN: %s", id(current_pin).c_str());
  348. - id: increment_digit_5
  349. then:
  350. - lambda: |-
  351. id(current_pin) += "5";
  352. ESP_LOGD("increment_digit_5", "Current PIN: %s", id(current_pin).c_str());
  353. - id: increment_digit_6
  354. then:
  355. - lambda: |-
  356. id(current_pin) += "6";
  357. ESP_LOGD("increment_digit_6", "Current PIN: %s", id(current_pin).c_str());
  358. - id: increment_digit_7
  359. then:
  360. - lambda: |-
  361. id(current_pin) += "7";
  362. ESP_LOGD("increment_digit_7", "Current PIN: %s", id(current_pin).c_str());
  363. - id: increment_digit_8
  364. then:
  365. - lambda: |-
  366. id(current_pin) += "8";
  367. ESP_LOGD("increment_digit_8", "Current PIN: %s", id(current_pin).c_str());
  368. - id: increment_digit_9
  369. then:
  370. - lambda: |-
  371. id(current_pin) += "9";
  372. ESP_LOGD("increment_digit_9", "Current PIN: %s", id(current_pin).c_str());
  373. - id: increment_digit_0
  374. then:
  375. - lambda: |-
  376. id(current_pin) += "0";
  377. ESP_LOGD("increment_digit_0", "Current PIN: %s", id(current_pin).c_str());
  378. - id: show_notification
  379. then:
  380. - lambda: "id(led).turn_on().set_brightness(id(s_default_brightness).state /100).perform();"
  381. - display.page.show: notification_page
  382. - component.update: s3_box_lcd
  383. - delay: 10s
  384. - display.page.show: idle_page
  385. - script.execute: saver_enabled
  386. - component.update: s3_box_lcd
  387. globals:
  388. - id: wifi_connection
  389. type: bool
  390. restore_value: no
  391. initial_value: "false"
  392. - id: api_connection
  393. type: bool
  394. restore_value: no
  395. initial_value: "false"
  396. - id: mute_value
  397. type: bool
  398. restore_value: no
  399. initial_value: "false"
  400. - id: speaker_volume
  401. type: int
  402. restore_value: no
  403. initial_value: "5"
  404. - id: media_state
  405. type: bool
  406. restore_value: no
  407. initial_value: "false"
  408. - id: global_first_active_timer
  409. type: voice_assistant::Timer
  410. restore_value: false
  411. - id: global_is_timer_active
  412. type: bool
  413. restore_value: false
  414. - id: global_first_timer
  415. type: voice_assistant::Timer
  416. restore_value: false
  417. - id: global_is_timer
  418. type: bool
  419. restore_value: false
  420. - id: current_pin
  421. type: std::string
  422. initial_value: ""
  423. - id: global_is_assisting
  424. type: bool
  425. restore_value: false
  426. - id: previous_notification_text
  427. type: std::string
  428. initial_value: ""
  429. number:
  430. - id: s_saver_delay
  431. platform: template
  432. name: "Scr/save delay"
  433. icon: "mdi:sleep"
  434. entity_category: config
  435. unit_of_measurement: "secs"
  436. optimistic: true
  437. restore_value: true
  438. initial_value: 30
  439. step: 5
  440. min_value: 10
  441. max_value: 999999
  442. on_value:
  443. - component.update: s3_box_lcd
  444. - component.update: s_saver_delay
  445. - script.execute: saver_enabled
  446. - id: s_saver_blank_delay
  447. platform: template
  448. name: "Scr/off delay"
  449. icon: "mdi:monitor-off"
  450. entity_category: config
  451. unit_of_measurement: "secs"
  452. optimistic: true
  453. restore_value: true
  454. initial_value: 30
  455. step: 5
  456. min_value: 10
  457. max_value: 999999
  458. on_value:
  459. - component.update: s_saver_blank_delay
  460. - script.execute: saver_enabled
  461. - component.update: s3_box_lcd
  462. - id: s_saver_brightness
  463. platform: template
  464. name: "Scr/save Brightness"
  465. icon: "mdi:sleep"
  466. entity_category: config
  467. unit_of_measurement: "%"
  468. optimistic: true
  469. restore_value: true
  470. initial_value: 30
  471. step: 5
  472. min_value: 20
  473. max_value: 100
  474. on_value:
  475. - component.update: s_saver_brightness
  476. - script.execute: saver_enabled
  477. - component.update: s3_box_lcd
  478. - id: s_default_brightness
  479. platform: template
  480. name: "Default Brightness"
  481. icon: "mdi:monitor"
  482. entity_category: config
  483. unit_of_measurement: "%"
  484. optimistic: true
  485. restore_value: true
  486. initial_value: 100
  487. step: 5
  488. min_value: 20
  489. max_value: 100
  490. on_value:
  491. - component.update: s_default_brightness
  492. - script.execute: saver_enabled
  493. - component.update: s3_box_lcd
  494. button:
  495. - platform: restart
  496. id: reboot
  497. name: "Reboot"
  498. entity_category: diagnostic
  499. switch:
  500. - platform: gpio
  501. name: Speaker Enable
  502. id: speaker_enable
  503. pin:
  504. number: GPIO46
  505. ignore_strapping_warning: true
  506. restore_mode: ALWAYS_OFF
  507. entity_category: config
  508. disabled_by_default: true
  509. - platform: template
  510. name: Display conversation
  511. id: display_conversation
  512. optimistic: true
  513. restore_mode: RESTORE_DEFAULT_ON
  514. entity_category: config
  515. icon: "mdi:chat"
  516. - platform: template
  517. name: Output audio externally
  518. id: output_audio
  519. icon: "mdi:volume-off"
  520. optimistic: true
  521. restore_mode: RESTORE_DEFAULT_OFF
  522. entity_category: config
  523. on_turn_on:
  524. media_player.volume_set:
  525. id: speaker_media_player
  526. volume: 0
  527. on_turn_off:
  528. media_player.volume_set:
  529. id: speaker_media_player
  530. volume: 1.0
  531. - platform: template
  532. name: Mute
  533. id: mute_switch
  534. icon: "mdi:microphone-off"
  535. optimistic: true
  536. restore_mode: RESTORE_DEFAULT_OFF
  537. entity_category: config
  538. on_turn_on:
  539. then:
  540. - voice_assistant.stop
  541. - micro_wake_word.stop
  542. on_turn_off:
  543. - if:
  544. condition:
  545. not:
  546. - voice_assistant.is_running
  547. then:
  548. - if:
  549. condition:
  550. lambda: 'return id(wake_word_engine_location).state == "In Home Assistant";'
  551. then:
  552. - lambda: "id(va).set_use_wake_word(true);"
  553. - delay: 50ms
  554. - voice_assistant.start_continuous
  555. - if:
  556. condition:
  557. lambda: 'return id(wake_word_engine_location).state == "On device";'
  558. then:
  559. - lambda: "id(va).set_use_wake_word(false);"
  560. - micro_wake_word.start
  561. - component.update: s3_box_lcd
  562. - platform: template
  563. id: media_mute
  564. optimistic: true
  565. on_turn_on:
  566. media_player.volume_set:
  567. id: speaker_media_player
  568. volume: 0
  569. on_turn_off:
  570. media_player.volume_set:
  571. id: speaker_media_player
  572. volume: 1.0
  573. - platform: template
  574. id: s_saver
  575. name: Scr/save enable
  576. icon: mdi:sleep
  577. optimistic: true
  578. restore_mode: RESTORE_DEFAULT_OFF
  579. entity_category: config
  580. - platform: template
  581. id: s_saver_mode
  582. name: Scr/off enable
  583. icon: "mdi:monitor-off"
  584. optimistic: true
  585. restore_mode: RESTORE_DEFAULT_OFF
  586. entity_category: config
  587. - platform: template # remove for no sensor version
  588. id: s_saver_presc
  589. name: Screen wake on motion
  590. icon: "mdi:motion-sensor"
  591. entity_category: config
  592. optimistic: true
  593. restore_mode: RESTORE_DEFAULT_OFF
  594. - platform: template
  595. id: timer_ringing
  596. optimistic: true
  597. internal: true
  598. restore_mode: ALWAYS_OFF
  599. on_turn_off:
  600. # Turn off the repeat mode and disable the pause between playlist items
  601. - lambda: |-
  602. id(speaker_media_player)
  603. ->make_call()
  604. .set_command(media_player::MediaPlayerCommand::MEDIA_PLAYER_COMMAND_REPEAT_OFF)
  605. .set_announcement(true)
  606. .perform();
  607. id(speaker_media_player)->set_playlist_delay_ms(speaker::AudioPipelineType::ANNOUNCEMENT, 0);
  608. # Stop playing the alarm
  609. - media_player.stop:
  610. announcement: true
  611. - if:
  612. condition:
  613. lambda: 'return id(wake_word_engine_location).state == "On device";'
  614. then:
  615. - lambda: "id(va).set_use_wake_word(false);"
  616. - micro_wake_word.start
  617. else:
  618. - lambda: "id(va).set_use_wake_word(true);"
  619. - voice_assistant.start
  620. on_turn_on:
  621. - lambda: id(va).set_use_wake_word(false);
  622. - voice_assistant.stop:
  623. - micro_wake_word.stop:
  624. - delay: 150ms
  625. # Turn on the repeat mode and pause for 1000 ms between playlist items/repeats
  626. - lambda: id(led).turn_on().set_brightness(1.0).perform();
  627. - lambda: |-
  628. id(speaker_media_player)
  629. ->make_call()
  630. .set_command(media_player::MediaPlayerCommand::MEDIA_PLAYER_COMMAND_REPEAT_ONE)
  631. .set_announcement(true)
  632. .perform();
  633. id(speaker_media_player)->set_playlist_delay_ms(speaker::AudioPipelineType::ANNOUNCEMENT, 1000);
  634. - media_player.speaker.play_on_device_media_file:
  635. media_file: timer_finished_sound
  636. announcement: true
  637. - delay: 15min
  638. - switch.turn_off: timer_ringing
  639. - platform: template
  640. id: wake_sound
  641. name: Play wake sound
  642. icon: mdi:music
  643. entity_category: config
  644. optimistic: true
  645. restore_mode: RESTORE_DEFAULT_OFF
  646. - platform: template
  647. id: mute_response_switch
  648. name: Mute Responses
  649. icon: mdi:chat-sleep
  650. entity_category: config
  651. optimistic: true
  652. restore_mode: RESTORE_DEFAULT_OFF
  653. - platform: template
  654. id: ext_media_mute
  655. icon: "mdi:volume-off"
  656. optimistic: true
  657. restore_mode: RESTORE_DEFAULT_OFF
  658. entity_category: config
  659. on_turn_on:
  660. then:
  661. - homeassistant.service:
  662. service: media_player.volume_mute
  663. data:
  664. entity_id: media_player.${external_media_player}
  665. on_turn_off:
  666. - homeassistant.service:
  667. service: media_player.volume_mute
  668. data:
  669. entity_id: media_player.${external_media_player}
  670. output:
  671. - platform: ledc
  672. pin: GPIO47
  673. id: backlight_output
  674. light:
  675. - platform: monochromatic
  676. id: led
  677. name: LCD Backlight
  678. entity_category: config
  679. output: backlight_output
  680. restore_mode: ALWAYS_ON
  681. default_transition_length: 50ms
  682. sensor:
  683. - platform: aht10 # remove for no sensor version
  684. i2c_id: bus_b
  685. variant: AHT20
  686. temperature:
  687. name: "S3 Temperature"
  688. id: s3temp
  689. humidity:
  690. name: "S3 Humidity"
  691. update_interval: 60s
  692. - platform: adc # remove for no sensor version
  693. pin: GPIO10
  694. id: battery_voltage
  695. unit_of_measurement: "V"
  696. accuracy_decimals: 1
  697. device_class: "voltage"
  698. entity_category: "diagnostic"
  699. disabled_by_default: true
  700. update_interval: 30s
  701. attenuation: auto
  702. filters:
  703. - multiply: 4.11
  704. - platform: copy # remove for no sensor version
  705. id: battery_percent
  706. source_id: battery_voltage
  707. name: "Battery level"
  708. unit_of_measurement: "%"
  709. accuracy_decimals: 0
  710. device_class: "battery"
  711. entity_category: "diagnostic"
  712. filters:
  713. - lambda: "return (x - 2.7) / (4.2 - 2.7) * 100;"
  714. - clamp:
  715. min_value: 0
  716. max_value: 100
  717. - platform: uptime
  718. id: up_sens
  719. on_value:
  720. - lambda: |-
  721. int seconds = id(up_sens).state;
  722. int days = seconds / 86400;
  723. int hours = seconds / 3600;
  724. int minutes = (seconds % 3600) / 60;
  725. seconds %= 60;
  726. id(up_sens_text).publish_state(str_sprintf("%03d:%02d:%02d:%02d", days, hours, minutes, seconds));
  727. update_interval: 30s
  728. - platform: wifi_signal
  729. name: "WiFi db"
  730. id: wifi_signal_db
  731. update_interval: 30s
  732. - platform: copy
  733. source_id: wifi_signal_db
  734. name: "WiFi Signal"
  735. id: wifi_percent
  736. filters:
  737. - lambda: "return min(max(2 * (x + 100.0), 0.0), 100.0);"
  738. unit_of_measurement: "%"
  739. entity_category: "diagnostic"
  740. device_class: ""
  741. text_sensor:
  742. - id: text_request
  743. platform: template
  744. on_value:
  745. lambda: |-
  746. if(id(text_request).state.length()>32) {
  747. std::string name = id(text_request).state.c_str();
  748. std::string truncated = esphome::str_truncate(name.c_str(),31);
  749. id(text_request).state = (truncated+"...").c_str();
  750. }
  751. - id: text_response
  752. platform: template
  753. on_value:
  754. lambda: |-
  755. if(id(text_response).state.length()>32) {
  756. std::string name = id(text_response).state.c_str();
  757. std::string truncated = esphome::str_truncate(name.c_str(),31);
  758. id(text_response).state = (truncated+"...").c_str();
  759. }
  760. - platform: wifi_info
  761. ip_address:
  762. name: IP Address
  763. id: ip_addr
  764. entity_category: "diagnostic"
  765. ssid:
  766. id: connected_ssid
  767. name: SSID
  768. entity_category: "diagnostic"
  769. bssid:
  770. id: connected_bssid
  771. name: BSSID
  772. entity_category: "diagnostic"
  773. mac_address:
  774. id: device_mac
  775. - platform: template
  776. id: up_sens_text
  777. name: Device uptime
  778. entity_category: "diagnostic"
  779. icon: mdi:clock
  780. - platform: template
  781. id: wakeword_location
  782. - platform: template
  783. id: time_remaining_0
  784. name: Timer
  785. icon: mdi:clock
  786. - platform: template
  787. id: time_remaining_1
  788. - platform: template
  789. id: time_display_format
  790. update_interval: never
  791. - platform: homeassistant
  792. entity_id: media_player.${external_media_player}
  793. id: ha_media_status
  794. on_value:
  795. component.update: s3_box_lcd
  796. - platform: homeassistant
  797. entity_id: media_player.${external_media_player}
  798. id: ha_media_title
  799. attribute: media_content_id
  800. on_value:
  801. component.update: s3_box_lcd
  802. - platform: homeassistant
  803. name: "Alarm Status"
  804. entity_id: alarm_control_panel.alarmo
  805. id: alarm_status
  806. on_value:
  807. - component.update: s3_box_lcd
  808. text:
  809. - platform: template
  810. name: "Notification Text"
  811. id: notification_text
  812. mode: text
  813. optimistic: true
  814. on_value:
  815. then:
  816. - lambda: |-
  817. if (!id(notification_text).state.empty() &&
  818. (id(previous_notification_text).empty() || id(notification_text).state != id(previous_notification_text))) {
  819. id(previous_notification_text) = id(notification_text).state;
  820. id(show_notification).execute();
  821. }
  822. i2s_audio:
  823. - id: i2s_audio_bus
  824. i2s_lrclk_pin:
  825. number: GPIO45
  826. ignore_strapping_warning: true
  827. i2s_bclk_pin: GPIO17
  828. i2s_mclk_pin: GPIO2
  829. audio_adc:
  830. - platform: es7210
  831. id: es7210_adc
  832. i2c_id: bus_a
  833. bits_per_sample: 16bit
  834. sample_rate: 16000
  835. audio_dac:
  836. - platform: es8311
  837. id: es8311_dac
  838. i2c_id: bus_a
  839. bits_per_sample: 16bit
  840. sample_rate: 48000
  841. microphone:
  842. - platform: i2s_audio
  843. id: box_mic
  844. sample_rate: 16000
  845. i2s_din_pin: GPIO16
  846. bits_per_sample: 16bit
  847. adc_type: external
  848. speaker:
  849. - platform: i2s_audio
  850. id: i2s_audio_speaker
  851. i2s_audio_id: i2s_audio_bus
  852. i2s_dout_pin: GPIO15
  853. dac_type: external
  854. sample_rate: 48000
  855. bits_per_sample: 16bit
  856. channel: left
  857. audio_dac: es8311_dac
  858. buffer_duration: 500ms # Increased for stability without timeout @youkorr
  859. # Virtual speakers to combine the announcement and media streams together into one output
  860. - platform: mixer
  861. id: mixing_speaker
  862. output_speaker: i2s_audio_speaker
  863. source_speakers:
  864. - id: announcement_mixing_input
  865. - id: media_mixing_input
  866. # Vritual speakers to resample each pipelines' audio, if necessary, as the mixer speaker requires the same sample rate
  867. - platform: resampler
  868. id: announcement_resampling_speaker
  869. output_speaker: announcement_mixing_input
  870. sample_rate: 48000 # Added explicit sample rate
  871. - platform: resampler
  872. id: media_resampling_speaker
  873. output_speaker: media_mixing_input
  874. sample_rate: 48000 # Added explicit sample rate
  875. media_player:
  876. - platform: speaker
  877. name: Media Player
  878. id: speaker_media_player
  879. volume_increment: 0.05
  880. volume_min: 0.5
  881. volume_max: 0.8
  882. task_stack_in_psram: true
  883. announcement_pipeline:
  884. speaker: announcement_resampling_speaker
  885. format: FLAC
  886. sample_rate: 48000
  887. num_channels: 1 # S3 Box only has one output channel
  888. media_pipeline:
  889. speaker: media_resampling_speaker
  890. format: FLAC # FLAC is the least processor intensive codec
  891. num_channels: 2
  892. sample_rate: 48000
  893. files:
  894. - id: timer_finished_sound
  895. file: https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/refs/heads/main/sounds/awake.flac
  896. - id: wake_sound_file
  897. file: https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/sounds/awake.flac
  898. on_state:
  899. then:
  900. - if:
  901. condition:
  902. media_player.is_playing:
  903. then:
  904. - micro_wake_word.stop
  905. - voice_assistant.stop
  906. - if:
  907. condition:
  908. and:
  909. - lambda: return id(global_is_assisting) == false;
  910. - or:
  911. - media_player.is_idle
  912. - media_player.is_paused
  913. then:
  914. - if:
  915. condition:
  916. and:
  917. - switch.is_off: mute_switch
  918. - lambda: return id(wake_word_engine_location).state == "On device";
  919. then:
  920. - micro_wake_word.start
  921. else:
  922. - if:
  923. condition:
  924. - switch.is_off: mute_switch
  925. then:
  926. - voice_assistant.start
  927. - if:
  928. condition:
  929. and:
  930. - switch.is_off: timer_ringing
  931. - not:
  932. voice_assistant.is_running:
  933. - not:
  934. media_player.is_announcing:
  935. then:
  936. - mixer_speaker.apply_ducking:
  937. id: media_mixing_input
  938. decibel_reduction: 0
  939. duration: 1.0s
  940. on_play:
  941. - wait_until:
  942. - lambda: return id(global_is_assisting) == false;
  943. on_announcement:
  944. - mixer_speaker.apply_ducking:
  945. id: media_mixing_input
  946. decibel_reduction: 20
  947. duration: 0.0s
  948. micro_wake_word:
  949. vad:
  950. models:
  951. # - model: ${micro_wake_word_model_1}
  952. # - model: ${micro_wake_word_model_2}
  953. - model: ${micro_wake_word_model_3}
  954. # - model: ${micro_wake_word_model_4}
  955. on_wake_word_detected:
  956. - lambda: "id(global_is_assisting) = true;"
  957. - delay: 50ms
  958. - if:
  959. condition:
  960. and:
  961. - switch.is_off: output_audio
  962. - switch.is_on: wake_sound
  963. then:
  964. - media_player.speaker.play_on_device_media_file:
  965. media_file: wake_sound_file
  966. announcement: true
  967. - wait_until:
  968. not:
  969. - media_player.is_announcing:
  970. - delay: 150ms
  971. else:
  972. if:
  973. condition:
  974. and:
  975. - switch.is_on: output_audio
  976. - switch.is_on: wake_sound
  977. then:
  978. - homeassistant.service:
  979. service: media_player.play_media
  980. data:
  981. entity_id: media_player.${external_media_player}
  982. media_content_id: '${home_assistant_host}/local/sounds/awake.mp3'
  983. media_content_type: music
  984. - display.page.show: listening_page
  985. - component.update: s3_box_lcd
  986. - delay: 100ms
  987. - voice_assistant.start:
  988. wake_word: !lambda "return wake_word;"
  989. voice_assistant:
  990. id: va
  991. microphone: box_mic
  992. media_player: speaker_media_player
  993. use_wake_word: true
  994. noise_suppression_level: 2
  995. auto_gain: 31dBFS
  996. volume_multiplier: 4.0
  997. on_wake_word_detected:
  998. - lambda: "id(global_is_assisting) = true;"
  999. - voice_assistant.stop:
  1000. - lambda: "id(va).set_use_wake_word(false);"
  1001. - if:
  1002. condition:
  1003. and:
  1004. - switch.is_off: output_audio
  1005. - switch.is_on: wake_sound
  1006. then:
  1007. # - voice_assistant.stop:
  1008. # - delay: 150ms
  1009. # - if:
  1010. # condition:
  1011. # not:
  1012. # microphone.is_capturing:
  1013. # then:
  1014. - media_player.speaker.play_on_device_media_file:
  1015. media_file: wake_sound_file
  1016. announcement: true
  1017. - wait_until:
  1018. not:
  1019. - media_player.is_announcing:
  1020. - delay: 150ms
  1021. - lambda: "id(va).set_use_wake_word(false);"
  1022. - display.page.show: listening_page
  1023. - component.update: s3_box_lcd
  1024. else:
  1025. if:
  1026. condition:
  1027. and:
  1028. - switch.is_on: wake_sound
  1029. - switch.is_on: output_audio
  1030. then:
  1031. - homeassistant.service:
  1032. service: media_player.play_media
  1033. data:
  1034. entity_id: media_player.${external_media_player}
  1035. media_content_id: "${home_assistant_host}/local/sounds/awake.mp3"
  1036. media_content_type: music
  1037. - voice_assistant.start
  1038. on_start:
  1039. if:
  1040. condition:
  1041. - display.is_displaying_page: listening_page
  1042. - display.is_displaying_page: thinking_page
  1043. then:
  1044. - display.page.show: idle_page
  1045. - component.update: s3_box_lcd
  1046. on_listening:
  1047. - text_sensor.template.publish:
  1048. id: text_request
  1049. state: "..."
  1050. - text_sensor.template.publish:
  1051. id: text_response
  1052. state: "..."
  1053. - script.execute: saver_enabled
  1054. - display.page.show: listening_page
  1055. - component.update: s3_box_lcd
  1056. on_stt_end:
  1057. - text_sensor.template.publish:
  1058. id: text_request
  1059. state: !lambda "return x;"
  1060. on_stt_vad_end:
  1061. - display.page.show: thinking_page
  1062. - component.update: s3_box_lcd
  1063. on_tts_start:
  1064. - text_sensor.template.publish:
  1065. id: text_response
  1066. state: !lambda "return x;"
  1067. on_tts_end:
  1068. - if:
  1069. condition:
  1070. and:
  1071. - switch.is_on: mute_response_switch
  1072. - switch.is_off: media_mute
  1073. - switch.is_off: ext_media_mute
  1074. then:
  1075. - switch.turn_on: media_mute
  1076. - switch.turn_on: ext_media_mute
  1077. - display.page.show: replying_page
  1078. - component.update: s3_box_lcd
  1079. - if:
  1080. condition:
  1081. - switch.is_on: output_audio
  1082. then:
  1083. - homeassistant.service:
  1084. service: media_player.play_media
  1085. data:
  1086. entity_id: media_player.${external_media_player}
  1087. media_content_id: !lambda "return x;"
  1088. media_content_type: music
  1089. announce: "false"
  1090. - delay: 5s
  1091. - display.page.show: idle_page
  1092. - component.update: s3_box_lcd
  1093. on_error:
  1094. - if:
  1095. condition:
  1096. not:
  1097. - voice_assistant.is_running
  1098. then:
  1099. - display.page.show: error_page
  1100. - component.update: s3_box_lcd
  1101. - delay: 4s
  1102. - if:
  1103. condition:
  1104. - display.is_displaying_page: error_page
  1105. then:
  1106. - display.page.show: idle_page
  1107. - component.update: s3_box_lcd
  1108. - lambda: "id(global_is_assisting) = false;"
  1109. on_idle:
  1110. - display.page.show: idle_page
  1111. - component.update: s3_box_lcd
  1112. on_end:
  1113. - wait_until:
  1114. not:
  1115. voice_assistant.is_running:
  1116. - mixer_speaker.apply_ducking:
  1117. id: media_mixing_input
  1118. decibel_reduction: 0
  1119. duration: 1.0s
  1120. - lambda: "id(global_is_assisting) = false;"
  1121. - if:
  1122. condition:
  1123. and:
  1124. - switch.is_off: mute_switch
  1125. - lambda: 'return id(wake_word_engine_location).state == "On device";'
  1126. then:
  1127. - voice_assistant.stop
  1128. - micro_wake_word.start
  1129. else:
  1130. if:
  1131. condition:
  1132. - switch.is_off: mute_switch
  1133. then:
  1134. - lambda: id(va).set_use_wake_word(false);
  1135. - voice_assistant.stop:
  1136. - delay: 100ms
  1137. - lambda: "id(va).set_use_wake_word(true);"
  1138. - delay: 100ms
  1139. - voice_assistant.start
  1140. - if:
  1141. condition:
  1142. and:
  1143. - switch.is_on: mute_response_switch
  1144. - switch.is_on: media_mute
  1145. - switch.is_on: ext_media_mute
  1146. then:
  1147. - switch.turn_off: media_mute
  1148. - switch.turn_off: ext_media_mute
  1149. on_client_connected:
  1150. - if:
  1151. condition:
  1152. and:
  1153. - switch.is_off: mute_switch
  1154. - lambda: 'return id(wake_word_engine_location).state == "On device";'
  1155. then:
  1156. - micro_wake_word.start
  1157. else:
  1158. - if:
  1159. condition:
  1160. - switch.is_off: mute_switch
  1161. then:
  1162. - lambda: "id(va).set_use_wake_word(true);"
  1163. - voice_assistant.start
  1164. on_timer_started:
  1165. - script.execute: timer_ending
  1166. - component.update: s3_box_lcd
  1167. on_timer_cancelled:
  1168. - lambda: 'id(time_remaining_0).publish_state ("0:00:00");'
  1169. - component.update: s3_box_lcd
  1170. on_timer_updated:
  1171. - component.update: s3_box_lcd
  1172. on_timer_tick:
  1173. - lambda: |-
  1174. int seconds = timers[0].seconds_left;
  1175. int hours = seconds / 3600;
  1176. int minutes = (seconds % 3600) / 60;
  1177. seconds %= 60;
  1178. id(time_remaining_0).publish_state(str_sprintf("%d:%02d:%02d", hours, minutes, seconds));
  1179. - component.update: s3_box_lcd
  1180. on_timer_finished:
  1181. if:
  1182. condition:
  1183. - switch.is_on: output_audio
  1184. then:
  1185. - switch.turn_on: timer_ringing
  1186. - script.execute: timer_started_external
  1187. - display.page.show: timer_finished_page
  1188. - component.update: s3_box_lcd
  1189. else:
  1190. - if:
  1191. condition:
  1192. - switch.is_off: output_audio
  1193. then:
  1194. - switch.turn_on: timer_ringing
  1195. # - script.execute: timer_started
  1196. - display.page.show: timer_finished_page
  1197. - component.update: s3_box_lcd
  1198. image:
  1199. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/images/error.png"
  1200. id: error_img
  1201. resize: 320x240
  1202. type: RGB
  1203. transparency: alpha_channel
  1204. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/images/idle.png"
  1205. id: idle_img
  1206. resize: 320x240
  1207. type: RGB
  1208. transparency: alpha_channel
  1209. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/images/listening.png"
  1210. id: listening_img
  1211. resize: 320x240
  1212. type: RGB
  1213. transparency: alpha_channel
  1214. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/images/thinking.png"
  1215. id: thinking_img
  1216. resize: 320x240
  1217. type: RGB
  1218. transparency: alpha_channel
  1219. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/images/replying.png"
  1220. id: replying_img
  1221. resize: 320x240
  1222. type: RGB
  1223. transparency: alpha_channel
  1224. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/images/loading.png"
  1225. id: loading_img
  1226. resize: 320x240
  1227. type: RGB
  1228. transparency: alpha_channel
  1229. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/images/logo.png"
  1230. id: logo_img
  1231. resize: 80x75
  1232. type: RGB
  1233. transparency: alpha_channel
  1234. font:
  1235. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/consola.ttf"
  1236. id: my_font
  1237. size: 14
  1238. glyphs: "${font_glyphs}"
  1239. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/consola.ttf"
  1240. id: my_font16
  1241. size: 16
  1242. glyphs: "${font_glyphs}"
  1243. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/consola.ttf"
  1244. id: my_font2
  1245. size: 72
  1246. glyphs: "${font_glyphs}"
  1247. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/consola.ttf"
  1248. id: my_font3
  1249. size: 28
  1250. glyphs: "${font_glyphs}"
  1251. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/consola.ttf"
  1252. id: my_font4
  1253. size: 40
  1254. glyphs: "${font_glyphs}"
  1255. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/consola.ttf"
  1256. id: my_font18
  1257. size: 18
  1258. glyphs: "${font_glyphs}"
  1259. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/consola.ttf"
  1260. id: my_font5
  1261. size: 22
  1262. glyphs: "${font_glyphs}"
  1263. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/consola.ttf"
  1264. id: my_font6
  1265. size: 50
  1266. glyphs: "${font_glyphs}"
  1267. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/consola.ttf"
  1268. id: my_font82
  1269. size: 82
  1270. glyphs: "${font_glyphs}"
  1271. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/materialdesignicons-webfont.ttf"
  1272. id: icon_font_55
  1273. size: 45
  1274. glyphs: &icon_glyphs
  1275. - "\U000F0079" #battery 100%
  1276. - "\U000F007A" #battery 10%
  1277. - "\U000F007B" #battery 20%
  1278. - "\U000F007C" #battery 30%
  1279. - "\U000F007D" #battery 40%
  1280. - "\U000F007E" #battery 50%
  1281. - "\U000F007F" #battery 60%
  1282. - "\U000F0080" #battery 70%
  1283. - "\U000F0081" #battery 80%
  1284. - "\U000F0082" #battery 90%
  1285. - "\U000F009E" #bell
  1286. - "\U000F0150" #clock
  1287. - "\U000F01AE" #gbp pound symbol
  1288. - "\U000F0210" #fan
  1289. - "\U000F0238" #heating
  1290. - "\U000F024A" #garden/flower
  1291. - "\U000F0335" #light bulb off
  1292. - "\U000F036C" #microphone on
  1293. - "\U000F036D" #microphone off
  1294. - "\U000F036F" #voice settings
  1295. - "\U000F03E4" #pause
  1296. - "\U000F040A" #play
  1297. - "\U000F040E" #play/pause
  1298. - "\U000F0493" #settings cog
  1299. - "\U000F04AD" #next track
  1300. - "\U000F04AE" #previous track
  1301. - "\U000F04B9" #living room
  1302. - "\U000F04C8" #spots
  1303. - "\U000F04DB" #stop
  1304. - "\U000F0502" #screen settings
  1305. - "\U000F050F" #temp sensor
  1306. - "\U000F0521" #toggle on
  1307. - "\U000F0565" #arming
  1308. - "\U000F057E" #speaker on
  1309. - "\U000F0581" #speaker off
  1310. - "\U000F05CB" #voice
  1311. - "\U000F068A" #alarm home
  1312. - "\U000F06E8" #light bulb illuminated
  1313. - "\U000F075A" #music
  1314. - "\U000F075D" #vol plus
  1315. - "\U000F075E" #vol minus
  1316. - "\U000F0769" #ceiling
  1317. - "\U000F07D0" #api connected
  1318. - "\U000F07F4" #tv
  1319. - "\U000F0873" #car miles non
  1320. - "\U000F0874" #car miles full
  1321. - "\U000F0875" #car miles low
  1322. - "\U000F087B" #api disconnected
  1323. - "\U000F08D6" #settings
  1324. - "\U000F099D" #alarm away
  1325. - "\U000F099E" #disarmed
  1326. - "\U000F0A19" #toggle off
  1327. - "\U000F0B26" #down
  1328. - "\U000F0B28" #left
  1329. - "\U000F0B2A" #right
  1330. - "\U000F0B2C" #up
  1331. - "\U000F0B6C" #car battery
  1332. - "\U000F0D90" #screen off
  1333. - "\U000F0EBA" #stats
  1334. - "\U000F0ED4" #voice off
  1335. - "\U000F0FCE" #scene
  1336. - "\U000F1061" #dining
  1337. - "\U000F10CD" #battery warning
  1338. - "\U000F1160" #kitchen
  1339. - "\U000F12A8" #touch button
  1340. - "\U000F12D3" #garage closed
  1341. - "\U000F12D4" #garage open
  1342. - "\U000F1322" #tools
  1343. - "\U000F16BC" #wifidisconnected
  1344. - "\U000F16BD" #wifi connected
  1345. - "\U000F1722" #fire off
  1346. - "\U000F1747" #tall lamp
  1347. - "\U000F1828" #armed night
  1348. - "\U000F192D" #electricity
  1349. - "\U000F1987" #floods
  1350. - "\U000F1A12" #home button
  1351. - "\U000F1A1B" #gas
  1352. - "\U000F1C3B" #battery charging/usb powered
  1353. - "\U000F1C6F" #info
  1354. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/materialdesignicons-webfont.ttf"
  1355. id: icon_font_180
  1356. size: 180
  1357. glyphs: *icon_glyphs
  1358. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/materialdesignicons-webfont.ttf"
  1359. id: icon_font_80
  1360. size: 75
  1361. glyphs: *icon_glyphs
  1362. - file: "https://github.com/BigBobbas/ESP32-S3-Box3-Custom-ESPHome/raw/main/fonts/materialdesignicons-webfont.ttf"
  1363. id: icon_font_60
  1364. size: 60
  1365. glyphs: *icon_glyphs
  1366. color:
  1367. - id: green
  1368. hex: "75D15F"
  1369. - id: red
  1370. hex: "FF3131"
  1371. - id: blue
  1372. hex: "47B7E9"
  1373. - id: blue_drk
  1374. hex: "085296"
  1375. - id: amber
  1376. hex: "FBAB35"
  1377. - id: lime
  1378. hex: "20FC30"
  1379. - id: pink
  1380. hex: "D92BBC"
  1381. - id: yellow
  1382. hex: "FFC000"
  1383. - id: black
  1384. hex: "000000"
  1385. - id: white
  1386. hex: "ffffff"
  1387. - id: purple
  1388. hex: "73264D"
  1389. - id: light_blue
  1390. hex: "CFE2F3"
  1391. - id: bg_blue
  1392. hex: "032341"
  1393. - id: bg_purple
  1394. hex: "301020"
  1395. - id: bg_green
  1396. hex: "05350B"
  1397. - id: bg_red
  1398. hex: "3C0000"
  1399. - id: bg_pink
  1400. hex: "61034D"
  1401. - id: bg_charcoal
  1402. hex: "323232"
  1403. - id: bg_brown
  1404. hex: "41220D"
  1405. - id: bg_grey
  1406. hex: "4F4F4F"
  1407. spi:
  1408. clk_pin: 7
  1409. mosi_pin: 6
  1410. display:
  1411. - platform: ili9xxx
  1412. id: s3_box_lcd
  1413. model: S3BOX
  1414. data_rate: 40MHz
  1415. cs_pin: 5
  1416. dc_pin: 4
  1417. reset_pin:
  1418. number: 48
  1419. inverted: true
  1420. update_interval: never
  1421. invert_colors: false
  1422. ##################################################################################################
  1423. ################ The below section defines, what is displayed on the screen, ##############
  1424. ################ the colours and mdi icons are defined above under font: and Color: ##############
  1425. ################ they are then referenced in the config below. ##############
  1426. ##################################################################################################
  1427. pages:
  1428. - id: idle_page ##### home page ######
  1429. lambda: |-
  1430. it.fill(id(black));
  1431. if(id(api_connection) == true) {
  1432. it.printf(15, 5, id(icon_font_55), blue, "\U000F07D0");
  1433. } else {
  1434. it.printf(15, 5, id(icon_font_55), red, "\U000F087B");
  1435. }
  1436. if(id(wifi_connection) == true) {
  1437. it.printf(80, 5, id(icon_font_55), lime, "\U000F16BD");
  1438. } else {
  1439. it.printf(80, 5, id(icon_font_55), red, "\U000F16BC");
  1440. }
  1441. if(id(time_remaining_0).state == "0:00:00"){
  1442. it.printf(135, 5, id(icon_font_55), red, "\U000F0150");
  1443. } else {
  1444. it.printf(135, 5, id(icon_font_55), lime, "\U000F0150");
  1445. }
  1446. if(id(mute_switch).state) {
  1447. it.printf(190, 5, id(icon_font_55), red, "\U000F036D");
  1448. } else {
  1449. it.printf(190, 5, id(icon_font_55), lime, "\U000F036C");
  1450. }
  1451. if(id(alarm_status).state == "disarmed") {
  1452. it.printf(250, 5, id(icon_font_55), red, "\U000F099E");
  1453. } else if(id(alarm_status).state == "arming") {
  1454. it.printf(250, 5, id(icon_font_55), amber, "\U000F0565");
  1455. } else if(id(alarm_status).state == "armed_home") {
  1456. it.printf(250, 5, id(icon_font_55), green, "\U000F068A");
  1457. } else if(id(alarm_status).state == "armed_away") {
  1458. it.printf(250, 5, id(icon_font_55), green, "\U000F099D");
  1459. } else if(id(alarm_status).state == "armed_night") {
  1460. it.printf(250, 5, id(icon_font_55), green, "\U000F1828");
  1461. }
  1462. it.printf(20, 75, id(icon_font_80), blue,"\U000F050F");
  1463. it.printf(40, 120, id(my_font3), white, "%.f", id(s3temp).state); // remove for no sensor version
  1464. it.printf(120, 75, id(icon_font_80), yellow,"\U000F06E8" );
  1465. it.printf(220, 75, id(icon_font_80), purple,"\U000F0210");
  1466. it.printf(20, 155, id(icon_font_80), red,"\U000F075A");
  1467. it.printf(120, 155, id(icon_font_80), blue,"\U000F0FCE");
  1468. it.printf(220, 155, id(icon_font_80), lime,"\U000F08D6");
  1469. - id: template_page ##### template page ####
  1470. lambda: |-
  1471. it.fill(id(black));
  1472. if(id(api_connection) == true) {
  1473. it.printf(15, 5, id(icon_font_55), blue, "\U000F07D0");
  1474. } else {
  1475. it.printf(15, 5, id(icon_font_55), red, "\U000F087B");
  1476. }
  1477. if(id(wifi_connection) == true) {
  1478. it.printf(80, 5, id(icon_font_55), lime, "\U000F16BD");
  1479. } else {
  1480. it.printf(80, 5, id(icon_font_55), red, "\U000F16BC");
  1481. }
  1482. if(id(time_remaining_0).state == "0:00:00"){
  1483. it.printf(135, 5, id(icon_font_55), red, "\U000F0150");
  1484. } else {
  1485. it.printf(135, 5, id(icon_font_55), lime, "\U000F0150");
  1486. }
  1487. if(id(mute_switch).state) {
  1488. it.printf(190, 5, id(icon_font_55), red, "\U000F036D");
  1489. } else {
  1490. it.printf(190, 5, id(icon_font_55), lime, "\U000F036C");
  1491. }
  1492. if(id(alarm_status).state == "disarmed") {
  1493. it.printf(250, 5, id(icon_font_55), red, "\U000F099E");
  1494. } else if(id(alarm_status).state == "arming") {
  1495. it.printf(250, 5, id(icon_font_55), amber, "\U000F0565");
  1496. } else if(id(alarm_status).state == "armed_home") {
  1497. it.printf(250, 5, id(icon_font_55), green, "\U000F068A");
  1498. } else if(id(alarm_status).state == "armed_away") {
  1499. it.printf(250, 5, id(icon_font_55), green, "\U000F099D");
  1500. } else if(id(alarm_status).state == "armed_night") {
  1501. it.printf(250, 5, id(icon_font_55), green, "\U000F1828");
  1502. }
  1503. it.printf(20, 75, id(icon_font_80), light_blue,"\U000F06E8");
  1504. it.printf(120, 75, id(icon_font_80), light_blue,"\U000F06E8");
  1505. it.printf(220, 75, id(icon_font_80), light_blue, "\U000F06E8");
  1506. it.printf(20, 155, id(icon_font_80), light_blue,"\U000F06E8");
  1507. it.printf(120, 155, id(icon_font_80), light_blue,"\U000F06E8");
  1508. it.printf(220, 155, id(icon_font_80), light_blue, "\U000F06E8");
  1509. - id: info_page ##### info page #####
  1510. lambda: |-
  1511. it.fill(id(black));
  1512. if(id(api_connection) == true) {
  1513. it.printf(15, 5, id(icon_font_55), blue, "\U000F07D0");
  1514. } else {
  1515. it.printf(15, 5, id(icon_font_55), red, "\U000F087B");
  1516. }
  1517. if(id(wifi_connection) == true) {
  1518. it.printf(80, 5, id(icon_font_55), lime, "\U000F16BD");
  1519. } else {
  1520. it.printf(80, 5, id(icon_font_55), red, "\U000F16BC");
  1521. }
  1522. if(id(time_remaining_0).state == "0:00:00"){
  1523. it.printf(135, 5, id(icon_font_55), red, "\U000F0150");
  1524. } else {
  1525. it.printf(135, 5, id(icon_font_55), lime, "\U000F0150");
  1526. }
  1527. if(id(mute_switch).state) {
  1528. it.printf(190, 5, id(icon_font_55), red, "\U000F036D");
  1529. } else {
  1530. it.printf(190, 5, id(icon_font_55), lime, "\U000F036C");
  1531. }
  1532. if(id(alarm_status).state == "disarmed") {
  1533. it.printf(250, 5, id(icon_font_55), red, "\U000F099E");
  1534. } else if(id(alarm_status).state == "arming") {
  1535. it.printf(250, 5, id(icon_font_55), amber, "\U000F0565");
  1536. } else if(id(alarm_status).state == "armed_home") {
  1537. it.printf(250, 5, id(icon_font_55), green, "\U000F068A");
  1538. } else if(id(alarm_status).state == "armed_away") {
  1539. it.printf(250, 5, id(icon_font_55), green, "\U000F099D");
  1540. } else if(id(alarm_status).state == "armed_night") {
  1541. it.printf(250, 5, id(icon_font_55), green, "\U000F1828");
  1542. }
  1543. it.printf(160, 75, id(my_font5), light_blue, TextAlign::CENTER, "IP Address");
  1544. it.printf(160, 95, id(my_font5), yellow, TextAlign::CENTER, "%s", id(ip_addr).state.c_str());
  1545. it.printf(160, 125, id(my_font5), light_blue, TextAlign::CENTER, "Host Name");
  1546. it.printf(160, 145, id(my_font5), yellow, TextAlign::CENTER, "${name}.local");
  1547. it.printf(160, 175, id(my_font5), light_blue, TextAlign::CENTER, "Device Uptime DDD:H:M:S");
  1548. it.printf(160, 195, id(my_font5), yellow, TextAlign::CENTER, "%s", id(up_sens_text).state.c_str());
  1549. it.printf(40, 210, id(my_font5), light_blue, TextAlign::LEFT, "Battery Level"); // remove for no sensor version
  1550. it.printf(265, 210, id(my_font5), yellow, TextAlign::RIGHT, "%.f%%", id(battery_percent).state); // remove for no sensor version
  1551. - id: ss_set_page ##### screen saver settings page #####
  1552. lambda: |-
  1553. it.fill(id(black));
  1554. it.printf(160, 70, id(icon_font_80), light_blue, TextAlign::CENTER, "\U000F08D6");
  1555. it.printf(160, 20, id(my_font5), light_blue, TextAlign::CENTER, "Screensaver Settings");
  1556. it.printf(250, 115, id(my_font5), light_blue, TextAlign::RIGHT, "Timeout Settings :");
  1557. it.printf(255, 95, id(icon_font_55), lime, "\U000F08D6");
  1558. it.printf(250, 145, id(my_font5), light_blue, TextAlign::RIGHT, "Enable screensaver :");
  1559. if(id(s_saver).state) {
  1560. it.printf(255, 135, id(icon_font_55), lime, "\U000F0521");
  1561. } else {
  1562. it.printf(255, 135, id(icon_font_55), blue_drk, "\U000F0A19");
  1563. }
  1564. it.printf(250, 175, id(my_font5), light_blue, TextAlign::RIGHT, "Wake on presence :"); // remove for no sensor version 6 lines
  1565. if(id(s_saver_presc).state) {
  1566. it.printf(255, 165, id(icon_font_55), lime, "\U000F0521");
  1567. } else {
  1568. it.printf(255, 165, id(icon_font_55), blue_drk, "\U000F0A19");
  1569. }
  1570. it.printf(250, 205, id(my_font5), light_blue, TextAlign::RIGHT, "Timeout to blank :");
  1571. if(id(s_saver_mode).state) {
  1572. it.printf(255, 195, id(icon_font_55), lime, "\U000F0521");
  1573. } else {
  1574. it.printf(255, 195, id(icon_font_55), blue_drk, "\U000F0A19");
  1575. }
  1576. - id: ww_set_page ##### voice settings page #####
  1577. lambda: |-
  1578. it.fill(id(black));
  1579. it.printf(160, 50, id(icon_font_55), light_blue, TextAlign::CENTER, "\U000F08D6");
  1580. it.printf(160, 20, id(my_font5), light_blue, TextAlign::CENTER, "Voice Settings");
  1581. it.printf(155, 85, id(my_font5), light_blue, TextAlign::CENTER, "tap to change");
  1582. it.printf(135, 115, id(my_font5), light_blue, TextAlign::RIGHT, "WakeWord :");
  1583. it.printf(310, 115, id(my_font5), lime, TextAlign::RIGHT, "%s", id(wakeword_location).state.c_str());
  1584. it.printf(250, 145, id(my_font5), light_blue, TextAlign::RIGHT, "Mute responses :");
  1585. if(id(mute_response_switch).state) {
  1586. it.printf(255, 135, id(icon_font_55), lime, "\U000F0521");
  1587. } else {
  1588. it.printf(255, 135, id(icon_font_55), blue_drk, "\U000F0A19");
  1589. }
  1590. it.printf(250, 175, id(my_font5), light_blue, TextAlign::RIGHT, "Wake up sound :");
  1591. if(id(wake_sound).state) {
  1592. it.printf(255, 165, id(icon_font_55), lime, "\U000F0521");
  1593. } else {
  1594. it.printf(255, 165, id(icon_font_55), blue_drk, "\U000F0A19");
  1595. }
  1596. it.printf(250, 205, id(my_font5), light_blue, TextAlign::RIGHT, "Show Conversation :");
  1597. if(id(display_conversation).state) {
  1598. it.printf(255, 195, id(icon_font_55), lime, "\U000F0521");
  1599. } else {
  1600. it.printf(255, 195, id(icon_font_55), blue_drk, "\U000F0A19");
  1601. }
  1602. - id: climate_page ##### climate page #####
  1603. lambda: |-
  1604. it.fill(id(black));
  1605. if(id(api_connection) == true) {
  1606. it.printf(15, 5, id(icon_font_55), blue, "\U000F07D0");
  1607. } else {
  1608. it.printf(15, 5, id(icon_font_55), red, "\U000F087B");
  1609. }
  1610. if(id(wifi_connection) == true) {
  1611. it.printf(80, 5, id(icon_font_55), lime, "\U000F16BD");
  1612. } else {
  1613. it.printf(80, 5, id(icon_font_55), red, "\U000F16BC");
  1614. }
  1615. if(id(time_remaining_0).state == "0:00:00"){
  1616. it.printf(135, 5, id(icon_font_55), red, "\U000F0150");
  1617. } else {
  1618. it.printf(135, 5, id(icon_font_55), lime, "\U000F0150");
  1619. }
  1620. if(id(mute_switch).state) {
  1621. it.printf(190, 5, id(icon_font_55), red, "\U000F036D");
  1622. } else {
  1623. it.printf(190, 5, id(icon_font_55), lime, "\U000F036C");
  1624. }
  1625. if(id(alarm_status).state == "disarmed") {
  1626. it.printf(250, 5, id(icon_font_55), red, "\U000F099E");
  1627. } else if(id(alarm_status).state == "arming") {
  1628. it.printf(250, 5, id(icon_font_55), amber, "\U000F0565");
  1629. } else if(id(alarm_status).state == "armed_home") {
  1630. it.printf(250, 5, id(icon_font_55), green, "\U000F068A");
  1631. } else if(id(alarm_status).state == "armed_away") {
  1632. it.printf(250, 5, id(icon_font_55), green, "\U000F099D");
  1633. } else if(id(alarm_status).state == "armed_night") {
  1634. it.printf(250, 5, id(icon_font_55), green, "\U000F1828");
  1635. }
  1636. it.printf(20, 75, id(icon_font_80), light_blue,"\U000F050F");
  1637. it.printf(120, 75, id(icon_font_80), light_blue,"\U000F050F");
  1638. it.printf(220, 75, id(icon_font_80), light_blue, "\U000F050F");
  1639. it.printf(20, 155, id(icon_font_80), light_blue,"\U000F050F");
  1640. it.printf(120, 155, id(icon_font_80), light_blue,"\U000F050F");
  1641. it.printf(220, 155, id(icon_font_80), light_blue, "\U000F050F");
  1642. - id: lights_page ##### lights page ####
  1643. lambda: |-
  1644. it.fill(id(black));
  1645. if(id(api_connection) == true) {
  1646. it.printf(15, 5, id(icon_font_55), blue, "\U000F07D0");
  1647. } else {
  1648. it.printf(15, 5, id(icon_font_55), red, "\U000F087B");
  1649. }
  1650. if(id(wifi_connection) == true) {
  1651. it.printf(80, 5, id(icon_font_55), lime, "\U000F16BD");
  1652. } else {
  1653. it.printf(80, 5, id(icon_font_55), red, "\U000F16BC");
  1654. }
  1655. if(id(time_remaining_0).state == "0:00:00"){
  1656. it.printf(135, 5, id(icon_font_55), red, "\U000F0150");
  1657. } else {
  1658. it.printf(135, 5, id(icon_font_55), lime, "\U000F0150");
  1659. }
  1660. if(id(mute_switch).state) {
  1661. it.printf(190, 5, id(icon_font_55), red, "\U000F036D");
  1662. } else {
  1663. it.printf(190, 5, id(icon_font_55), lime, "\U000F036C");
  1664. }
  1665. if(id(alarm_status).state == "disarmed") {
  1666. it.printf(250, 5, id(icon_font_55), red, "\U000F099E");
  1667. } else if(id(alarm_status).state == "arming") {
  1668. it.printf(250, 5, id(icon_font_55), amber, "\U000F0565");
  1669. } else if(id(alarm_status).state == "armed_home") {
  1670. it.printf(250, 5, id(icon_font_55), green, "\U000F068A");
  1671. } else if(id(alarm_status).state == "armed_away") {
  1672. it.printf(250, 5, id(icon_font_55), green, "\U000F099D");
  1673. } else if(id(alarm_status).state == "armed_night") {
  1674. it.printf(250, 5, id(icon_font_55), green, "\U000F1828");
  1675. }
  1676. it.printf(20, 75, id(icon_font_80), light_blue,"\U000F0335");
  1677. it.printf(120, 75, id(icon_font_80), light_blue,"\U000F0335");
  1678. it.printf(220, 75, id(icon_font_80), light_blue, "\U000F0335");
  1679. it.printf(20, 155, id(icon_font_80), light_blue,"\U000F0335");
  1680. it.printf(120, 155, id(icon_font_80), light_blue,"\U000F0335");
  1681. it.printf(220, 155, id(icon_font_80), light_blue, "\U000F0335");
  1682. - id: media_page ##### media player page #####
  1683. lambda: |-
  1684. it.fill(id(black));
  1685. if(id(api_connection) == true) {
  1686. it.printf(15, 5, id(icon_font_55), blue, "\U000F07D0");
  1687. } else {
  1688. it.printf(15, 5, id(icon_font_55), red, "\U000F087B");
  1689. }
  1690. if(id(wifi_connection) == true) {
  1691. it.printf(80, 5, id(icon_font_55), lime, "\U000F16BD");
  1692. } else {
  1693. it.printf(80, 5, id(icon_font_55), red, "\U000F16BC");
  1694. }
  1695. if(id(time_remaining_0).state == "0:00:00"){
  1696. it.printf(135, 5, id(icon_font_55), red, "\U000F0150");
  1697. } else {
  1698. it.printf(135, 5, id(icon_font_55), lime, "\U000F0150");
  1699. }
  1700. if(id(mute_switch).state) {
  1701. it.printf(190, 5, id(icon_font_55), red, "\U000F036D");
  1702. } else {
  1703. it.printf(190, 5, id(icon_font_55), lime, "\U000F036C");
  1704. }
  1705. if(id(alarm_status).state == "disarmed") {
  1706. it.printf(250, 5, id(icon_font_55), red, "\U000F099E");
  1707. } else if(id(alarm_status).state == "arming") {
  1708. it.printf(250, 5, id(icon_font_55), amber, "\U000F0565");
  1709. } else if(id(alarm_status).state == "armed_home") {
  1710. it.printf(250, 5, id(icon_font_55), green, "\U000F068A");
  1711. } else if(id(alarm_status).state == "armed_away") {
  1712. it.printf(250, 5, id(icon_font_55), green, "\U000F099D");
  1713. } else if(id(alarm_status).state == "armed_night") {
  1714. it.printf(250, 5, id(icon_font_55), green, "\U000F1828");
  1715. }
  1716. if(id(media_state) == true) {
  1717. it.printf(160, 80, id(my_font5), lime, TextAlign::CENTER, "Playing");
  1718. } else {
  1719. it.printf(160, 80, id(my_font5), light_blue, TextAlign::CENTER, "Nothing Playing");
  1720. }
  1721. it.printf(20, 100, id(icon_font_80), blue,"\U000F075E");
  1722. it.printf(120, 100, id(icon_font_80), blue,"\U000F040E");
  1723. it.printf(220, 100, id(icon_font_80), blue,"\U000F075D");
  1724. if(id(media_mute).state) {
  1725. it.printf(120, 165, id(icon_font_80), red,"\U000F0581");
  1726. } else {
  1727. it.printf(120, 165, id(icon_font_80), lime,"\U000F057E");
  1728. }
  1729. - id: ext_media_page ##### media player page #####
  1730. lambda: |-
  1731. it.fill(id(black));
  1732. if(id(api_connection) == true) {
  1733. it.printf(15, 5, id(icon_font_55), blue, "\U000F07D0");
  1734. } else {
  1735. it.printf(15, 5, id(icon_font_55), red, "\U000F087B");
  1736. }
  1737. if(id(wifi_connection) == true) {
  1738. it.printf(80, 5, id(icon_font_55), lime, "\U000F16BD");
  1739. } else {
  1740. it.printf(80, 5, id(icon_font_55), red, "\U000F16BC");
  1741. }
  1742. if(id(time_remaining_0).state == "0:00:00"){
  1743. it.printf(135, 5, id(icon_font_55), red, "\U000F0150");
  1744. } else {
  1745. it.printf(135, 5, id(icon_font_55), lime, "\U000F0150");
  1746. }
  1747. if(id(mute_switch).state) {
  1748. it.printf(190, 5, id(icon_font_55), red, "\U000F036D");
  1749. } else {
  1750. it.printf(190, 5, id(icon_font_55), lime, "\U000F036C");
  1751. }
  1752. if(id(alarm_status).state == "disarmed") {
  1753. it.printf(250, 5, id(icon_font_55), red, "\U000F099E");
  1754. } else if(id(alarm_status).state == "arming") {
  1755. it.printf(250, 5, id(icon_font_55), amber, "\U000F0565");
  1756. } else if(id(alarm_status).state == "armed_home") {
  1757. it.printf(250, 5, id(icon_font_55), green, "\U000F068A");
  1758. } else if(id(alarm_status).state == "armed_away") {
  1759. it.printf(250, 5, id(icon_font_55), green, "\U000F099D");
  1760. } else if(id(alarm_status).state == "armed_night") {
  1761. it.printf(250, 5, id(icon_font_55), green, "\U000F1828");
  1762. }
  1763. it.printf(160, 80, id(my_font5), lime, TextAlign::CENTER, id(ha_media_status).state.c_str());
  1764. it.printf(20, 100, id(icon_font_80), blue,"\U000F04AE");
  1765. it.printf(120, 100, id(icon_font_80), blue,"\U000F040E");
  1766. it.printf(220, 100, id(icon_font_80), blue,"\U000F04AD");
  1767. if(id(ext_media_mute).state) {
  1768. it.printf(120, 165, id(icon_font_80), red,"\U000F0581");
  1769. } else {
  1770. it.printf(120, 165, id(icon_font_80), lime,"\U000F057E");
  1771. }
  1772. it.printf(20, 165, id(icon_font_80), blue,"\U000F075E");
  1773. it.printf(220, 165, id(icon_font_80), blue,"\U000F075D");
  1774. - id: scenes_page ##### scenes page #####
  1775. lambda: |-
  1776. it.fill(id(black));
  1777. if(id(api_connection) == true) {
  1778. it.printf(15, 5, id(icon_font_55), blue, "\U000F07D0");
  1779. } else {
  1780. it.printf(15, 5, id(icon_font_55), red, "\U000F087B");
  1781. }
  1782. if(id(wifi_connection) == true) {
  1783. it.printf(80, 5, id(icon_font_55), lime, "\U000F16BD");
  1784. } else {
  1785. it.printf(80, 5, id(icon_font_55), red, "\U000F16BC");
  1786. }
  1787. if(id(time_remaining_0).state == "0:00:00"){
  1788. it.printf(135, 5, id(icon_font_55), red, "\U000F0150");
  1789. } else {
  1790. it.printf(135, 5, id(icon_font_55), lime, "\U000F0150");
  1791. }
  1792. if(id(mute_switch).state) {
  1793. it.printf(190, 5, id(icon_font_55), red, "\U000F036D");
  1794. } else {
  1795. it.printf(190, 5, id(icon_font_55), lime, "\U000F036C");
  1796. }
  1797. if(id(alarm_status).state == "disarmed") {
  1798. it.printf(250, 5, id(icon_font_55), red, "\U000F099E");
  1799. } else if(id(alarm_status).state == "arming") {
  1800. it.printf(250, 5, id(icon_font_55), amber, "\U000F0565");
  1801. } else if(id(alarm_status).state == "armed_home") {
  1802. it.printf(250, 5, id(icon_font_55), green, "\U000F068A");
  1803. } else if(id(alarm_status).state == "armed_away") {
  1804. it.printf(250, 5, id(icon_font_55), green, "\U000F099D");
  1805. } else if(id(alarm_status).state == "armed_night") {
  1806. it.printf(250, 5, id(icon_font_55), green, "\U000F1828");
  1807. }
  1808. it.printf(20, 75, id(icon_font_80), light_blue,"\U000F0FCE");
  1809. it.printf(120, 75, id(icon_font_80), light_blue,"\U000F0FCE");
  1810. it.printf(220, 75, id(icon_font_80), light_blue, "\U000F0FCE");
  1811. it.printf(20, 155, id(icon_font_80), light_blue,"\U000F0FCE");
  1812. it.printf(120, 155, id(icon_font_80), light_blue,"\U000F0FCE");
  1813. it.printf(220, 155, id(icon_font_80), light_blue, "\U000F0FCE");
  1814. - id: loading_page ### loading page #####
  1815. lambda: |-
  1816. it.fill(Color::BLACK);
  1817. it.image((it.get_width() / 2), (it.get_height() / 2), id(loading_img), ImageAlign::CENTER);
  1818. - id: listening_page
  1819. lambda: |-
  1820. it.fill(Color::BLACK);
  1821. it.image((it.get_width() / 2), (it.get_height() / 2), id(listening_img), ImageAlign::CENTER);
  1822. - id: thinking_page
  1823. lambda: |-
  1824. it.fill(Color::BLACK);
  1825. it.image((it.get_width() / 2), (it.get_height() / 2), id(thinking_img), ImageAlign::CENTER);
  1826. if (id(display_conversation).state) {
  1827. it.filled_rectangle(0 , 0 , 320 , 30 , Color::WHITE );
  1828. it.printf(10, 10, id(my_font16), Color::BLACK, "%s", id(text_request).state.c_str());
  1829. }
  1830. - id: replying_page
  1831. lambda: |-
  1832. it.fill(Color::BLACK);
  1833. it.image((it.get_width() / 2), (it.get_height() / 2), id(replying_img), ImageAlign::CENTER);
  1834. if (id(display_conversation).state) {
  1835. it.filled_rectangle(0 , 0 , 320 , 30 , Color::WHITE );
  1836. it.filled_rectangle(0 , 210 , 320 , 30 , Color::WHITE );
  1837. it.printf(10, 10, id(my_font16), Color::BLACK, "%s", id(text_request).state.c_str());
  1838. it.printf(10, 220, id(my_font16), Color::BLACK, "%s", id(text_response).state.c_str());
  1839. }
  1840. - id: error_page
  1841. lambda: |-
  1842. it.fill(Color::BLACK);
  1843. it.image((it.get_width() / 2), (it.get_height() / 2), id(error_img), ImageAlign::CENTER);
  1844. - id: timer_finished_page
  1845. lambda: |-
  1846. it.fill(id(black));
  1847. it.printf(160, 20, id(my_font5), light_blue, TextAlign::CENTER, "Timer Finished");
  1848. it.printf(160, 120, id(icon_font_180), light_blue, TextAlign::CENTER, "\U000F009E");
  1849. it.printf(160, 215, id(my_font5), light_blue, TextAlign::CENTER, "tap screen to dismiss");
  1850. - id: muted_page
  1851. lambda: |-
  1852. it.fill(Color::BLACK);
  1853. it.printf(160, 120, id(my_font4), yellow, TextAlign::CENTER, "Mic & Speaker - Muted");
  1854. - id: saver_page ##### screen saver display page #####
  1855. lambda: |-
  1856. it.fill(id(black));
  1857. const char *days[] {"${sunday}","${monday}","${tuesday}","${wednesday}","${thursday}","${friday}","${saturday}"};
  1858. const char *months[] {"${jan}","${feb}","${mar}","${apr}","${may}","${jun}","${jul}","${aug}","${sept}","${oct}","${nov}","${dec}"};
  1859. it.printf(160, 28, id(my_font5), light_blue, TextAlign::CENTER, "%s %d %s", days[id(ha_time).now().day_of_week - 1], id(ha_time).now().day_of_month, months[id(ha_time).now().month - 1]);
  1860. if(id(time_display_format).state == "24 Hr") {
  1861. it.strftime(160, 88, id(my_font82), TextAlign::CENTER, "%H:%M", id(ha_time).now());
  1862. } else {
  1863. it.strftime(160, 88, id(my_font2), TextAlign::CENTER, "%l:%M%p", id(ha_time).now());
  1864. }
  1865. it.printf(160, 181, id(my_font2), light_blue, TextAlign::CENTER, "%.f°C", id(s3temp).state); // remove for no sensor version
  1866. - id: ota_page ##### firmware uploading page #####
  1867. lambda: |-
  1868. it.fill(Color::BLACK);
  1869. it.printf(160, 60, id(icon_font_80), red, TextAlign::CENTER, "\U000F08D6");
  1870. it.printf((it.get_width() / 2), (it.get_height() / 2), id(my_font3), red, TextAlign::CENTER, "FIRMWARE UPDATING");
  1871. it.printf(160,155, id(my_font5), blue, TextAlign::CENTER, "Once restarted");
  1872. it.printf(160,190, id(my_font5), blue, TextAlign::CENTER, "press the reboot button");
  1873. it.printf(160,225, id(my_font5), blue, TextAlign::CENTER, "to enable touch");
  1874. - id: settings_page ##### settings parent page #####
  1875. lambda: |-
  1876. it.fill(id(black));
  1877. if(id(api_connection) == true) {
  1878. it.printf(15, 5, id(icon_font_55), blue, "\U000F07D0");
  1879. } else {
  1880. it.printf(15, 5, id(icon_font_55), red, "\U000F087B");
  1881. }
  1882. if(id(wifi_connection) == true) {
  1883. it.printf(80, 5, id(icon_font_55), lime, "\U000F16BD");
  1884. } else {
  1885. it.printf(80, 5, id(icon_font_55), red, "\U000F16BC");
  1886. }
  1887. if(id(time_remaining_0).state == "0:00:00"){
  1888. it.printf(135, 5, id(icon_font_55), red, "\U000F0150");
  1889. } else {
  1890. it.printf(135, 5, id(icon_font_55), lime, "\U000F0150");
  1891. }
  1892. if(id(mute_switch).state) {
  1893. it.printf(190, 5, id(icon_font_55), red, "\U000F036D");
  1894. } else {
  1895. it.printf(190, 5, id(icon_font_55), lime, "\U000F036C");
  1896. }
  1897. if(id(alarm_status).state == "disarmed") {
  1898. it.printf(250, 5, id(icon_font_55), red, "\U000F099E");
  1899. } else if(id(alarm_status).state == "arming") {
  1900. it.printf(250, 5, id(icon_font_55), amber, "\U000F0565");
  1901. } else if(id(alarm_status).state == "armed_home") {
  1902. it.printf(250, 5, id(icon_font_55), green, "\U000F068A");
  1903. } else if(id(alarm_status).state == "armed_away") {
  1904. it.printf(250, 5, id(icon_font_55), green, "\U000F099D");
  1905. } else if(id(alarm_status).state == "armed_night") {
  1906. it.printf(250, 5, id(icon_font_55), green, "\U000F1828");
  1907. }
  1908. it.printf(160, 65, id(my_font5), light_blue, TextAlign::CENTER, "settings");
  1909. it.printf(20, 80, id(icon_font_55), light_blue,"\U000F036F");
  1910. it.printf(140, 80, id(icon_font_55), light_blue,"\U000F0502");
  1911. it.printf(255, 80, id(icon_font_55), light_blue, "\U000F1C6F");
  1912. it.printf(15, 210, id(my_font5), light_blue,"Device");
  1913. it.printf(245, 130, id(my_font5), light_blue, "Info");
  1914. it.printf(20, 160, id(icon_font_55), light_blue,"\U000F08D6");
  1915. it.printf(255, 160, id(icon_font_55), light_blue, "\U000F05CB");
  1916. it.printf(15, 130, id(my_font5), light_blue,"Voice");
  1917. it.printf(135, 130, id(my_font5), light_blue,"Saver");
  1918. it.printf(245, 210, id(my_font5), light_blue, "Test");
  1919. it.image((it.get_width() / 2), 195, id(logo_img), ImageAlign::CENTER);
  1920. - id: device_set_page ##### Device settings page #####
  1921. lambda: |-
  1922. it.fill(id(black));
  1923. if(id(api_connection) == true) {
  1924. it.printf(15, 5, id(icon_font_55), blue, "\U000F07D0");
  1925. } else {
  1926. it.printf(15, 5, id(icon_font_55), red, "\U000F087B");
  1927. }
  1928. if(id(wifi_connection) == true) {
  1929. it.printf(80, 5, id(icon_font_55), lime, "\U000F16BD");
  1930. } else {
  1931. it.printf(80, 5, id(icon_font_55), red, "\U000F16BC");
  1932. }
  1933. if(id(time_remaining_0).state == "0:00:00"){
  1934. it.printf(135, 5, id(icon_font_55), red, "\U000F0150");
  1935. } else {
  1936. it.printf(135, 5, id(icon_font_55), lime, "\U000F0150");
  1937. }
  1938. if(id(mute_switch).state) {
  1939. it.printf(190, 5, id(icon_font_55), red, "\U000F036D");
  1940. } else {
  1941. it.printf(190, 5, id(icon_font_55), lime, "\U000F036C");
  1942. }
  1943. if(id(alarm_status).state == "disarmed") {
  1944. it.printf(250, 5, id(icon_font_55), red, "\U000F099E");
  1945. } else if(id(alarm_status).state == "arming") {
  1946. it.printf(250, 5, id(icon_font_55), amber, "\U000F0565");
  1947. } else if(id(alarm_status).state == "armed_home") {
  1948. it.printf(250, 5, id(icon_font_55), green, "\U000F068A");
  1949. } else if(id(alarm_status).state == "armed_away") {
  1950. it.printf(250, 5, id(icon_font_55), green, "\U000F099D");
  1951. } else if(id(alarm_status).state == "armed_night") {
  1952. it.printf(250, 5, id(icon_font_55), green, "\U000F1828");
  1953. }
  1954. it.printf(15, 75, id(my_font5), light_blue, "Ext media player");
  1955. if(id(output_audio).state) {
  1956. it.printf(255, 60, id(icon_font_60), lime, "\U000F0521");
  1957. } else {
  1958. it.printf(255, 60, id(icon_font_60), blue_drk, "\U000F0A19");
  1959. }
  1960. it.printf(5, 190, id(icon_font_55), light_blue, "\U000F0B28");
  1961. it.printf(15, 135, id(my_font5), light_blue, "Brightness");
  1962. it.printf(238, 148, id(my_font5), light_blue, TextAlign::CENTER, "%.f", id(s_default_brightness).state);
  1963. it.printf(160, 125, id(icon_font_55), lime, TextAlign::LEFT, "\U000F0B2C");
  1964. it.printf(315, 125, id(icon_font_55), lime, TextAlign::RIGHT, "\U000F0B26");
  1965. it.rectangle(215 , 125 , 46 , 40 , light_blue);
  1966. it.printf(65, 180, id(my_font5), light_blue, "Time Format:");
  1967. it.printf(210, 180, id(my_font5), lime, "%s", id(time_display_format).state.c_str());
  1968. - id: timeout_settings_page ##### Timeout Settings page #####
  1969. lambda: |-
  1970. it.fill(id(black));
  1971. //it.printf(160, 50, id(icon_font_55), light_blue, TextAlign::CENTER, "\U000F0150");
  1972. it.printf(160, 20, id(my_font5), light_blue, TextAlign::CENTER, "Screen Settings");
  1973. it.printf(160, 60, id(my_font5), light_blue, TextAlign::CENTER, "Screen Saver");
  1974. it.printf(50, 80, id(my_font), light_blue, "Delay secs");
  1975. it.printf(185, 80, id(my_font), light_blue, "Dim Brightness");
  1976. it.printf(105, 100, id(icon_font_55), lime, TextAlign::LEFT, "\U000F0B2C");
  1977. it.printf(65, 100, id(icon_font_55), lime, TextAlign::RIGHT, "\U000F0B26");
  1978. it.rectangle(65 , 105 , 40 , 40 , lime);
  1979. it.printf(85, 125, id(my_font5), light_blue, TextAlign::CENTER, "%.f", id(s_saver_delay).state);
  1980. it.printf(20, 160, id(my_font), light_blue, "Screen off delay");
  1981. it.printf(105, 180, id(icon_font_55), lime, TextAlign::LEFT, "\U000F0B2C");
  1982. it.printf(65, 180, id(icon_font_55), lime, TextAlign::RIGHT, "\U000F0B26");
  1983. it.rectangle(65 , 180 , 40 , 40 , lime);
  1984. it.printf(85, 200, id(my_font5), light_blue, TextAlign::CENTER, "%.f", id(s_saver_blank_delay).state);
  1985. it.printf(255, 100, id(icon_font_55), pink, TextAlign::LEFT, "\U000F0B2C");
  1986. it.printf(215, 100, id(icon_font_55), pink, TextAlign::RIGHT, "\U000F0B26");
  1987. it.rectangle(215 , 105 , 40 , 40 , pink);
  1988. it.printf(235, 125, id(my_font5), light_blue, TextAlign::CENTER, "%.f", id(s_saver_brightness).state);
  1989. - id: time_remaining_page ##### timer countdown page #####
  1990. lambda: |-
  1991. it.fill(id(black));
  1992. it.printf(160, 20, id(my_font5), light_blue, TextAlign::CENTER, "Active Timers");
  1993. it.printf(160, 70, id(icon_font_80), light_blue, TextAlign::CENTER, "\U000F0150");
  1994. it.printf(160, 155, id(my_font6), light_blue, TextAlign::CENTER, "%s", id(time_remaining_0).state.c_str());
  1995. - id: wifi_page ##### wifi info page #####
  1996. lambda: |-
  1997. it.fill(id(black));
  1998. if(id(api_connection) == true) {
  1999. it.printf(15, 5, id(icon_font_55), blue, "\U000F07D0");
  2000. } else {
  2001. it.printf(15, 5, id(icon_font_55), red, "\U000F087B");
  2002. }
  2003. if(id(wifi_connection) == true) {
  2004. it.printf(80, 5, id(icon_font_55), lime, "\U000F16BD");
  2005. } else {
  2006. it.printf(80, 5, id(icon_font_55), red, "\U000F16BC");
  2007. }
  2008. if(id(time_remaining_0).state == "0:00:00"){
  2009. it.printf(135, 5, id(icon_font_55), red, "\U000F0150");
  2010. } else {
  2011. it.printf(135, 5, id(icon_font_55), lime, "\U000F0150");
  2012. }
  2013. if(id(mute_switch).state) {
  2014. it.printf(190, 5, id(icon_font_55), red, "\U000F036D");
  2015. } else {
  2016. it.printf(190, 5, id(icon_font_55), lime, "\U000F036C");
  2017. }
  2018. if(id(alarm_status).state == "disarmed") {
  2019. it.printf(250, 5, id(icon_font_55), red, "\U000F099E");
  2020. } else if(id(alarm_status).state == "arming") {
  2021. it.printf(250, 5, id(icon_font_55), amber, "\U000F0565");
  2022. } else if(id(alarm_status).state == "armed_home") {
  2023. it.printf(250, 5, id(icon_font_55), green, "\U000F068A");
  2024. } else if(id(alarm_status).state == "armed_away") {
  2025. it.printf(250, 5, id(icon_font_55), green, "\U000F099D");
  2026. } else if(id(alarm_status).state == "armed_night") {
  2027. it.printf(250, 5, id(icon_font_55), green, "\U000F1828");
  2028. }
  2029. it.printf(160, 75, id(my_font5), light_blue, TextAlign::CENTER, "ssid");
  2030. it.printf(160, 95, id(my_font5), yellow, TextAlign::CENTER, "%s", id(connected_ssid).state.c_str());
  2031. it.printf(160, 125, id(my_font5), light_blue, TextAlign::CENTER, "bssid");
  2032. it.printf(160, 145, id(my_font5), yellow, TextAlign::CENTER, "%s", id(connected_bssid).state.c_str());
  2033. it.printf(160, 175, id(my_font5), light_blue, TextAlign::CENTER, "Device MAC");
  2034. it.printf(160, 195, id(my_font5), yellow, TextAlign::CENTER, "%s", id(device_mac).state.c_str());
  2035. it.printf(38, 210, id(my_font5), light_blue, TextAlign::LEFT, "Signal Strength");
  2036. it.printf(283, 210, id(my_font5), yellow, TextAlign::RIGHT, "%4.f%%", id(wifi_percent).state);
  2037. - id: alarm_page #### alarm page #####
  2038. lambda: |-
  2039. if(id(alarm_status).state == "disarmed") {
  2040. it.printf(10, 10, id(icon_font_180), red, "\U000F099E");
  2041. it.printf(40, 200, id(my_font3), red, "Disarmed");
  2042. } else if(id(alarm_status).state == "arming") {
  2043. it.printf(10, 10, id(icon_font_180), amber, "\U000F0565");
  2044. it.printf(40, 200, id(my_font3), amber, "Arming");
  2045. } else if(id(alarm_status).state == "armed_home") {
  2046. it.printf(10, 10, id(icon_font_180), green, "\U000F068A");
  2047. it.printf(60, 200, id(my_font3), green, "Armed");
  2048. } else if(id(alarm_status).state == "armed_away") {
  2049. it.printf(10, 10, id(icon_font_180), green, "\U000F099D");
  2050. it.printf(60, 200, id(my_font3), green, "Armed");
  2051. } else if(id(alarm_status).state == "armed_night") {
  2052. it.printf(10, 10, id(icon_font_180), green, "\U000F1828");
  2053. it.printf(60, 200, id(my_font3), green, "Armed");
  2054. }
  2055. if(id(alarm_status).state == "armed_home") {
  2056. it.printf(225, 5, id(icon_font_60), green, "\U000F068A");
  2057. it.printf(233, 60, id(my_font18), light_blue, "Home");
  2058. } else {
  2059. it.printf(225, 5, id(icon_font_60), blue_drk, "\U000F068A");
  2060. it.printf(233, 60, id(my_font18), light_blue, "Home");
  2061. }
  2062. if(id(alarm_status).state == "armed_away") {
  2063. it.printf(225, 80, id(icon_font_60), green, "\U000F099D");
  2064. it.printf(233, 135, id(my_font18), light_blue, "Away");
  2065. } else {
  2066. it.printf(225, 80, id(icon_font_60), blue_drk, "\U000F099D");
  2067. it.printf(233, 135, id(my_font18), light_blue, "Away");
  2068. }
  2069. if(id(alarm_status).state == "armed_night") {
  2070. it.printf(225, 155, id(icon_font_60), green, "\U000F1828");
  2071. it.printf(228, 215, id(my_font18), light_blue, "Night");
  2072. } else {
  2073. it.printf(225, 155, id(icon_font_60), blue_drk, "\U000F1828");
  2074. it.printf(228, 215, id(my_font18), light_blue, "Night");
  2075. }
  2076. - id: alarm_home_activate_page ##### alarm home activation page #####
  2077. lambda: |-
  2078. auto pin_state = id(current_pin).c_str();
  2079. it.print(310, 80, id(my_font3), TextAlign::RIGHT, pin_state);
  2080. // loop for numbers 1 - 9
  2081. for (int i = 0; i < 3; i++) {
  2082. for (int j = 0; j < 3; j++) {
  2083. int number = i * 3 + j + 1;
  2084. int x_position = 15 + j * 56; // Ajustement de la position en X
  2085. int y_position = 15 + i * 56; // Ajustement de la position en Y
  2086. it.rectangle(x_position, y_position, 48, 48, light_blue); // Taille du rectangle ajustée
  2087. char num_str[2];
  2088. snprintf(num_str, sizeof(num_str), "%d", number);
  2089. it.print(x_position + 24, y_position + 24, id(my_font3), TextAlign::CENTER, num_str); // Centrage du chiffre
  2090. }
  2091. }
  2092. it.rectangle(71, 183, 48, 48, light_blue); // Position et taille du rectangle ajustées
  2093. it.print(95, 207, id(my_font3), TextAlign::CENTER, "0"); // Centrage du chiffre "0"
  2094. //it.filled_rectangle(198, 110, 108, 50, green);
  2095. if(id(alarm_status).state == "disarmed"){
  2096. it.filled_rectangle(198, 110, 108, 50, red);
  2097. it.print(255, 135, id(my_font3), white, TextAlign::CENTER, "Arm");
  2098. } else if(id(alarm_status).state == "armed_home"){
  2099. it.filled_rectangle(198, 110, 108, 50, green);
  2100. it.print(255, 135, id(my_font3), white, TextAlign::CENTER, "Disarm");
  2101. }
  2102. it.filled_rectangle(198, 170, 108, 50, blue_drk);
  2103. it.print(255, 195, id(my_font3), white, TextAlign::CENTER, "Clear");
  2104. if(id(alarm_status).state == "disarmed") {
  2105. it.printf(255, 30, id(icon_font_55), red, TextAlign::CENTER, "\U000F068A");
  2106. it.printf(255, 70, id(my_font3), red, TextAlign::CENTER, "Disarmed");
  2107. } else if(id(alarm_status).state == "arming") {
  2108. it.printf(255, 30, id(icon_font_55), amber, TextAlign::CENTER, "\U000F0565");
  2109. it.printf(255, 70, id(my_font3), amber, TextAlign::CENTER, "Arming");
  2110. } else if(id(alarm_status).state == "armed_home") {
  2111. it.printf(255, 30, id(icon_font_55), green, TextAlign::CENTER, "\U000F068A");
  2112. it.printf(255, 70, id(my_font3), green, TextAlign::CENTER, "Armed");
  2113. }
  2114. - id: alarm_away_activate_page ##### alarm away activation page #####
  2115. lambda: |-
  2116. auto pin_state = id(current_pin).c_str();
  2117. it.print(310, 80, id(my_font3), TextAlign::RIGHT, pin_state);
  2118. // loop for numbers 1 - 9
  2119. for (int i = 0; i < 3; i++) {
  2120. for (int j = 0; j < 3; j++) {
  2121. int number = i * 3 + j + 1;
  2122. int x_position = 15 + j * 56; // Ajustement de la position en X
  2123. int y_position = 15 + i * 56; // Ajustement de la position en Y
  2124. it.rectangle(x_position, y_position, 48, 48, light_blue); // Taille du rectangle ajustée
  2125. char num_str[2];
  2126. snprintf(num_str, sizeof(num_str), "%d", number);
  2127. it.print(x_position + 24, y_position + 24, id(my_font3), TextAlign::CENTER, num_str); // Centrage du chiffre
  2128. }
  2129. }
  2130. it.rectangle(71, 183, 48, 48, light_blue); // Position et taille du rectangle ajustées
  2131. it.print(95, 207, id(my_font3), TextAlign::CENTER, "0"); // Centrage du chiffre "0"
  2132. if(id(alarm_status).state == "disarmed"){
  2133. it.filled_rectangle(198, 110, 108, 50, red);
  2134. it.print(255, 135, id(my_font3), white, TextAlign::CENTER, "Arm");
  2135. } else if(id(alarm_status).state == "armed_away"){
  2136. it.filled_rectangle(198, 110, 108, 50, green);
  2137. it.print(255, 135, id(my_font3), white, TextAlign::CENTER, "Disarm");
  2138. }
  2139. it.filled_rectangle(198, 170, 108, 50, blue_drk);
  2140. it.print(255, 195, id(my_font3), white, TextAlign::CENTER, "Clear");
  2141. if(id(alarm_status).state == "disarmed") {
  2142. it.printf(255, 30, id(icon_font_55), red, TextAlign::CENTER, "\U000F099D");
  2143. it.printf(255, 70, id(my_font3), red, TextAlign::CENTER, "Disarmed");
  2144. } else if(id(alarm_status).state == "arming") {
  2145. it.printf(255, 30, id(icon_font_55), amber, TextAlign::CENTER, "\U000F0565");
  2146. it.printf(255, 70, id(my_font3), amber, TextAlign::CENTER, "Arming");
  2147. } else if(id(alarm_status).state == "armed_away") {
  2148. it.printf(255, 30, id(icon_font_55), green, TextAlign::CENTER, "\U000F099D");
  2149. it.printf(255, 70, id(my_font3), green, TextAlign::CENTER, "Armed");
  2150. }
  2151. - id: alarm_night_activate_page ##### alarm night activation page #####
  2152. lambda: |-
  2153. auto pin_state = id(current_pin).c_str();
  2154. it.print(310, 80, id(my_font3), TextAlign::RIGHT, pin_state);
  2155. // loop for numbers 1 - 9
  2156. for (int i = 0; i < 3; i++) {
  2157. for (int j = 0; j < 3; j++) {
  2158. int number = i * 3 + j + 1;
  2159. int x_position = 15 + j * 56; // Ajustement de la position en X
  2160. int y_position = 15 + i * 56; // Ajustement de la position en Y
  2161. it.rectangle(x_position, y_position, 48, 48, light_blue); // Taille du rectangle ajustée
  2162. char num_str[2];
  2163. snprintf(num_str, sizeof(num_str), "%d", number);
  2164. it.print(x_position + 24, y_position + 24, id(my_font3), TextAlign::CENTER, num_str); // Centrage du chiffre
  2165. }
  2166. }
  2167. it.rectangle(71, 183, 48, 48, light_blue); // Position et taille du rectangle ajustées
  2168. it.print(95, 207, id(my_font3), TextAlign::CENTER, "0"); // Centrage du chiffre "0"
  2169. if(id(alarm_status).state == "disarmed"){
  2170. it.filled_rectangle(198, 110, 108, 50, red);
  2171. it.print(255, 135, id(my_font3), white, TextAlign::CENTER, "Arm");
  2172. } else if(id(alarm_status).state == "armed_night"){
  2173. it.filled_rectangle(198, 110, 108, 50, green);
  2174. it.print(255, 135, id(my_font3), white, TextAlign::CENTER, "Disarm");
  2175. }
  2176. it.filled_rectangle(198, 170, 108, 50, blue_drk);
  2177. it.print(255, 195, id(my_font3), white, TextAlign::CENTER, "Clear");
  2178. if(id(alarm_status).state == "disarmed") {
  2179. it.printf(255, 30, id(icon_font_55), red, TextAlign::CENTER, "\U000F1828");
  2180. it.printf(255, 70, id(my_font3), red, TextAlign::CENTER, "Disarmed");
  2181. } else if(id(alarm_status).state == "arming") {
  2182. it.printf(255, 30, id(icon_font_55), amber, TextAlign::CENTER, "\U000F0565");
  2183. it.printf(255, 70, id(my_font3), amber, TextAlign::CENTER, "Arming");
  2184. } else if(id(alarm_status).state == "armed_night") {
  2185. it.printf(255, 30, id(icon_font_55), green, TextAlign::CENTER, "\U000F1828");
  2186. it.printf(255, 70, id(my_font3), green, TextAlign::CENTER, "Armed");
  2187. }
  2188. - id: notification_page
  2189. lambda: |-
  2190. it.fill(Color::BLACK);
  2191. const char* text = id(notification_text).state.c_str();
  2192. int max_chars_per_line = 14; // Adjusted maximum characters per line
  2193. int line_height = 40; // Height of each line
  2194. int display_width = 320;
  2195. int display_height = 240;
  2196. int y = 60; // Starting Y position for text
  2197. std::vector<std::string> lines;
  2198. // Split text into lines of max_chars_per_line
  2199. std::string current_line;
  2200. for (const char* p = text; *p != '\0'; ++p) {
  2201. if (current_line.length() >= max_chars_per_line || *p == '\n') {
  2202. lines.push_back(current_line);
  2203. current_line.clear();
  2204. if (*p != '\n') {
  2205. current_line += *p;
  2206. }
  2207. } else {
  2208. current_line += *p;
  2209. }
  2210. }
  2211. if (!current_line.empty()) {
  2212. lines.push_back(current_line);
  2213. }
  2214. // Calculate the starting Y position to center the text vertically
  2215. int total_height = lines.size() * line_height;
  2216. y = (display_height - total_height) / 2;
  2217. // Print each line centered
  2218. for (const auto& line : lines) {
  2219. int line_width = line.length() * 21; // Approximate width of the line
  2220. int x = (display_width - line_width) / 2;
  2221. it.printf(x, y, id(my_font4), Color::WHITE, TextAlign::BASELINE_LEFT, "%s", line.c_str());
  2222. y += line_height;
  2223. }
  2224. i2c:
  2225. - id: bus_a
  2226. sda: GPIO08
  2227. scl: GPIO18
  2228. scan: true
  2229. sda_pullup_enabled: true
  2230. scl_pullup_enabled: true
  2231. frequency: 100kHz
  2232. - sda: GPIO41
  2233. scl: GPIO40
  2234. scan: true
  2235. sda_pullup_enabled: true
  2236. scl_pullup_enabled: true
  2237. frequency: 50kHz
  2238. id: bus_b
  2239. touchscreen:
  2240. - platform: gt911
  2241. i2c_id: bus_a
  2242. address: 0x5D
  2243. id: gt911_touchscreen
  2244. interrupt_pin:
  2245. number: GPIO3
  2246. ignore_strapping_warning: true
  2247. on_touch:
  2248. - lambda: "id(led).turn_on().set_brightness(id(s_default_brightness).state /100).perform();"
  2249. on_release:
  2250. - script.execute: saver_enabled
  2251. binary_sensor:
  2252. ###### top left hand physical button #######
  2253. - platform: gpio
  2254. id: top_left_button
  2255. pin:
  2256. number: GPIO0
  2257. mode: INPUT_PULLUP
  2258. inverted: true
  2259. ignore_strapping_warning: true
  2260. on_press:
  2261. - if:
  2262. condition:
  2263. - display.is_displaying_page: saver_page
  2264. then:
  2265. - lambda: "id(led).turn_on().set_brightness(id(s_default_brightness).state /100).perform();"
  2266. - display.page.show: idle_page
  2267. - script.execute: saver_enabled
  2268. - component.update: s3_box_lcd
  2269. else:
  2270. if:
  2271. condition:
  2272. - display.is_displaying_page: idle_page
  2273. then:
  2274. - script.execute: saver_enabled
  2275. - display.page.show: saver_page
  2276. - component.update: s3_box_lcd
  2277. ######## red circle home button #####################
  2278. - platform: gt911
  2279. id: home_button
  2280. index: 0
  2281. on_press:
  2282. if:
  2283. condition:
  2284. - display.is_displaying_page: idle_page
  2285. then:
  2286. - script.execute: saver_enabled
  2287. else:
  2288. - lambda: "id(led).turn_on().set_brightness(id(s_default_brightness).state /100).perform();"
  2289. - display.page.show: idle_page
  2290. - component.update: s3_box_lcd
  2291. ###### radar sensor ######## # remove for no sensor version
  2292. - platform: gpio
  2293. pin:
  2294. number: GPIO21
  2295. name: "Presence detect"
  2296. disabled_by_default: false
  2297. device_class: "occupancy"
  2298. on_state:
  2299. if:
  2300. condition:
  2301. and:
  2302. - switch.is_on: s_saver
  2303. - switch.is_on: s_saver_presc
  2304. - display.is_displaying_page: saver_page
  2305. then:
  2306. - display.page.show: idle_page
  2307. - component.update: s3_box_lcd
  2308. - script.execute: saver_enabled
  2309. ##### satus bar buttons #####
  2310. - platform: touchscreen
  2311. pages:
  2312. - idle_page
  2313. - info_page
  2314. - lights_page
  2315. - template_page
  2316. - media_page
  2317. - ext_media_page
  2318. - scenes_page
  2319. - settings_page
  2320. id: status_bar_1
  2321. x_min: 5
  2322. x_max: 60
  2323. y_min: 0
  2324. y_max: 55
  2325. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2326. # on_click:
  2327. # min_length: 10ms
  2328. # max_length: 500ms
  2329. # then:
  2330. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2331. # - component.update: s3_box_lcd
  2332. - platform: touchscreen
  2333. pages:
  2334. - idle_page
  2335. - info_page
  2336. - lights_page
  2337. - template_page
  2338. - media_page
  2339. - ext_media_page
  2340. - scenes_page
  2341. - settings_page
  2342. id: status_bar_2
  2343. internal: true
  2344. x_min: 65
  2345. x_max: 125
  2346. y_min: 0
  2347. y_max: 55
  2348. on_click:
  2349. min_length: 10ms
  2350. max_length: 500ms
  2351. then:
  2352. - display.page.show: wifi_page
  2353. - component.update: s3_box_lcd
  2354. - platform: touchscreen
  2355. pages:
  2356. - idle_page
  2357. - info_page
  2358. - lights_page
  2359. - template_page
  2360. - media_page
  2361. - ext_media_page
  2362. - scenes_page
  2363. - settings_page
  2364. id: status_bar_3
  2365. internal: true
  2366. x_min: 130
  2367. x_max: 185
  2368. y_min: 0
  2369. y_max: 55
  2370. on_click:
  2371. min_length: 10ms
  2372. max_length: 500ms
  2373. then:
  2374. if:
  2375. condition:
  2376. - switch.is_on: timer_ringing
  2377. then:
  2378. - display.page.show: timer_finished_page
  2379. - component.update: s3_box_lcd
  2380. else:
  2381. - display.page.show: time_remaining_page
  2382. - component.update: s3_box_lcd
  2383. - platform: touchscreen
  2384. pages:
  2385. - idle_page
  2386. - info_page
  2387. - lights_page
  2388. - template_page
  2389. - media_page
  2390. - ext_media_page
  2391. - scenes_page
  2392. - settings_page
  2393. id: status_bar_4
  2394. internal: true
  2395. x_min: 190
  2396. x_max: 245
  2397. y_min: 0
  2398. y_max: 55
  2399. on_click:
  2400. min_length: 10ms
  2401. max_length: 500ms
  2402. then:
  2403. - switch.toggle: mute_switch
  2404. - component.update: s3_box_lcd
  2405. - platform: touchscreen
  2406. pages:
  2407. - idle_page
  2408. - info_page
  2409. - lights_page
  2410. - template_page
  2411. - media_page
  2412. - ext_media_page
  2413. - scenes_page
  2414. - settings_page
  2415. name: status_bar_5
  2416. internal: true
  2417. x_min: 250
  2418. x_max: 305
  2419. y_min: 0
  2420. y_max: 55
  2421. on_click:
  2422. min_length: 10ms
  2423. max_length: 500ms
  2424. then:
  2425. - display.page.show: alarm_page
  2426. - component.update: s3_box_lcd
  2427. ##### settings page ####
  2428. - platform: touchscreen
  2429. page_id: settings_page
  2430. id: voice_set
  2431. internal: true
  2432. x_min: 5
  2433. x_max: 105
  2434. y_min: 100
  2435. y_max: 165
  2436. on_click:
  2437. min_length: 10ms
  2438. max_length: 500ms
  2439. then:
  2440. - display.page.show: ww_set_page
  2441. - component.update: s3_box_lcd
  2442. - platform: touchscreen
  2443. page_id: settings_page
  2444. id: ss_set
  2445. internal: true
  2446. x_min: 110
  2447. x_max: 210
  2448. y_min: 100
  2449. y_max: 165
  2450. on_click:
  2451. min_length: 10ms
  2452. max_length: 500ms
  2453. then:
  2454. - display.page.show: ss_set_page
  2455. - component.update: s3_box_lcd
  2456. - platform: touchscreen
  2457. page_id: settings_page
  2458. id: info_set
  2459. internal: true
  2460. x_min: 215
  2461. x_max: 315
  2462. y_min: 100
  2463. y_max: 165
  2464. on_click:
  2465. min_length: 10ms
  2466. max_length: 500ms
  2467. then:
  2468. - display.page.show: info_page
  2469. - component.update: s3_box_lcd
  2470. - platform: touchscreen
  2471. page_id: settings_page
  2472. id: device_set
  2473. internal: true
  2474. x_min: 5
  2475. x_max: 105
  2476. y_min: 175
  2477. y_max: 240
  2478. on_click:
  2479. min_length: 10ms
  2480. max_length: 500ms
  2481. then:
  2482. - display.page.show: device_set_page
  2483. - component.update: s3_box_lcd
  2484. - platform: touchscreen
  2485. page_id: settings_page
  2486. id: voice_test
  2487. internal: true
  2488. x_min: 215
  2489. x_max: 315
  2490. y_min: 175
  2491. y_max: 240
  2492. on_press:
  2493. then:
  2494. - switch.turn_on: mute_switch
  2495. - lambda: "id(va).set_use_wake_word(false);"
  2496. - delay: 100ms
  2497. - voice_assistant.start
  2498. - wait_until:
  2499. not:
  2500. - voice_assistant.is_running
  2501. - voice_assistant.stop
  2502. on_release:
  2503. then:
  2504. - switch.turn_off: mute_switch
  2505. - component.update: s3_box_lcd
  2506. - platform: touchscreen
  2507. pages:
  2508. - device_set_page
  2509. id: back_button
  2510. internal: true
  2511. x_min: 5
  2512. x_max: 105
  2513. y_min: 175
  2514. y_max: 240
  2515. on_click:
  2516. min_length: 10ms
  2517. max_length: 500ms
  2518. then:
  2519. - display.page.show: settings_page
  2520. - component.update: s3_box_lcd
  2521. ##### idle / home page ####
  2522. - platform: touchscreen
  2523. page_id: idle_page
  2524. id: control_1
  2525. internal: true
  2526. x_min: 5
  2527. x_max: 105
  2528. y_min: 90
  2529. y_max: 170
  2530. on_click:
  2531. min_length: 10ms
  2532. max_length: 500ms
  2533. then:
  2534. - display.page.show: climate_page
  2535. - component.update: s3_box_lcd
  2536. - platform: touchscreen
  2537. page_id: idle_page
  2538. id: control_2
  2539. internal: true
  2540. x_min: 110
  2541. x_max: 210
  2542. y_min: 90
  2543. y_max: 170
  2544. on_click:
  2545. min_length: 10ms
  2546. max_length: 500ms
  2547. then:
  2548. - display.page.show: lights_page
  2549. - component.update: s3_box_lcd
  2550. - platform: touchscreen
  2551. page_id: idle_page
  2552. id: control_3
  2553. internal: true
  2554. x_min: 215
  2555. x_max: 315
  2556. y_min: 90
  2557. y_max: 170
  2558. on_click:
  2559. min_length: 10ms
  2560. max_length: 500ms
  2561. then:
  2562. - display.page.show: template_page
  2563. - component.update: s3_box_lcd
  2564. - platform: touchscreen
  2565. page_id: idle_page
  2566. id: control_4
  2567. internal: true
  2568. x_min: 5
  2569. x_max: 105
  2570. y_min: 175
  2571. y_max: 240
  2572. on_click:
  2573. min_length: 10ms
  2574. max_length: 500ms
  2575. then:
  2576. if:
  2577. condition:
  2578. switch.is_off: output_audio
  2579. then:
  2580. - display.page.show: media_page
  2581. - component.update: s3_box_lcd
  2582. else:
  2583. - display.page.show: ext_media_page
  2584. - component.update: s3_box_lcd
  2585. - platform: touchscreen
  2586. page_id: idle_page
  2587. id: control_5
  2588. internal: true
  2589. x_min: 110
  2590. x_max: 210
  2591. y_min: 175
  2592. y_max: 240
  2593. on_click:
  2594. min_length: 10ms
  2595. max_length: 500ms
  2596. then:
  2597. - display.page.show: scenes_page
  2598. - component.update: s3_box_lcd
  2599. - platform: touchscreen
  2600. page_id: idle_page
  2601. id: control_6
  2602. internal: true
  2603. x_min: 215
  2604. x_max: 315
  2605. y_min: 175
  2606. y_max: 240
  2607. on_click:
  2608. min_length: 10ms
  2609. max_length: 500ms
  2610. then:
  2611. - display.page.show: settings_page
  2612. - component.update: s3_box_lcd
  2613. #### climate page #####
  2614. - platform: touchscreen
  2615. page_id: climate_page
  2616. id: climate1
  2617. internal: true
  2618. x_min: 5
  2619. x_max: 105
  2620. y_min: 90
  2621. y_max: 170
  2622. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2623. # on_click:
  2624. # min_length: 10ms
  2625. # max_length: 500ms
  2626. # then:
  2627. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2628. # - component.update: s3_box_lcd
  2629. - platform: touchscreen
  2630. page_id: climate_page
  2631. id: climate2
  2632. internal: true
  2633. x_min: 110
  2634. x_max: 210
  2635. y_min: 90
  2636. y_max: 170
  2637. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2638. # on_click:
  2639. # min_length: 10ms
  2640. # max_length: 500ms
  2641. # then:
  2642. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2643. # - component.update: s3_box_lcd
  2644. - platform: touchscreen
  2645. page_id: climate_page
  2646. id: climate3
  2647. internal: true
  2648. x_min: 215
  2649. x_max: 315
  2650. y_min: 90
  2651. y_max: 170
  2652. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2653. # on_click:
  2654. # min_length: 10ms
  2655. # max_length: 500ms
  2656. # then:
  2657. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2658. # - component.update: s3_box_lcd
  2659. - platform: touchscreen
  2660. page_id: climate_page
  2661. id: climate4
  2662. internal: true
  2663. x_min: 5
  2664. x_max: 105
  2665. y_min: 175
  2666. y_max: 240
  2667. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2668. # on_click:
  2669. # min_length: 10ms
  2670. # max_length: 500ms
  2671. # then:
  2672. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2673. # - component.update: s3_box_lcd
  2674. - platform: touchscreen
  2675. page_id: climate_page
  2676. id: climate5
  2677. internal: true
  2678. x_min: 110
  2679. x_max: 210
  2680. y_min: 175
  2681. y_max: 240
  2682. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2683. # on_click:
  2684. # min_length: 10ms
  2685. # max_length: 500ms
  2686. # then:
  2687. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2688. # - component.update: s3_box_lcd
  2689. - platform: touchscreen
  2690. page_id: climate_page
  2691. id: climate6
  2692. internal: true
  2693. x_min: 215
  2694. x_max: 315
  2695. y_min: 175
  2696. y_max: 240
  2697. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2698. # on_click:
  2699. # min_length: 10ms
  2700. # max_length: 500ms
  2701. # then:
  2702. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2703. # - component.update: s3_box_lcd
  2704. ##### lights page #####
  2705. - platform: touchscreen
  2706. page_id: lights_page
  2707. id: lights1
  2708. internal: true
  2709. x_min: 5
  2710. x_max: 105
  2711. y_min: 90
  2712. y_max: 170
  2713. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2714. # on_click:
  2715. # min_length: 10ms
  2716. # max_length: 500ms
  2717. # then:
  2718. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2719. # - component.update: s3_box_lcd
  2720. - platform: touchscreen
  2721. page_id: lights_page
  2722. id: lights2
  2723. internal: true
  2724. x_min: 110
  2725. x_max: 210
  2726. y_min: 90
  2727. y_max: 170
  2728. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2729. # on_click:
  2730. # min_length: 10ms
  2731. # max_length: 500ms
  2732. # then:
  2733. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2734. # - component.update: s3_box_lcd
  2735. - platform: touchscreen
  2736. page_id: lights_page
  2737. id: lights3
  2738. internal: true
  2739. x_min: 215
  2740. x_max: 315
  2741. y_min: 90
  2742. y_max: 170
  2743. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2744. # on_click:
  2745. # min_length: 10ms
  2746. # max_length: 500ms
  2747. # then:
  2748. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2749. # - component.update: s3_box_lcd
  2750. - platform: touchscreen
  2751. page_id: lights_page
  2752. id: lights4
  2753. internal: true
  2754. x_min: 5
  2755. x_max: 105
  2756. y_min: 175
  2757. y_max: 240
  2758. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2759. # on_click:
  2760. # min_length: 10ms
  2761. # max_length: 500ms
  2762. # then:
  2763. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2764. # - component.update: s3_box_lcd
  2765. - platform: touchscreen
  2766. page_id: lights_page
  2767. id: lights5
  2768. internal: true
  2769. x_min: 110
  2770. x_max: 210
  2771. y_min: 175
  2772. y_max: 240
  2773. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2774. # on_click:
  2775. # min_length: 10ms
  2776. # max_length: 500ms
  2777. # then:
  2778. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2779. # - component.update: s3_box_lcd
  2780. - platform: touchscreen
  2781. page_id: lights_page
  2782. id: lights6
  2783. internal: true
  2784. x_min: 215
  2785. x_max: 315
  2786. y_min: 175
  2787. y_max: 240
  2788. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2789. # on_click:
  2790. # min_length: 10ms
  2791. # max_length: 500ms
  2792. # then:
  2793. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2794. # - component.update: s3_box_lcd
  2795. ##### media player #####
  2796. - platform: touchscreen
  2797. page_id: media_page
  2798. name: Volume Minus
  2799. internal: true
  2800. x_min: 5
  2801. x_max: 105
  2802. y_min: 90
  2803. y_max: 170
  2804. on_click:
  2805. min_length: 0ms
  2806. max_length: 500ms
  2807. then:
  2808. - logger.log: "Volume Minus pressed"
  2809. - lambda: |-
  2810. if (id(speaker_volume) > 0) {
  2811. id(speaker_volume) -= 1;
  2812. }
  2813. - component.update: s3_box_lcd
  2814. - script.execute: set_volume
  2815. - platform: touchscreen
  2816. page_id: media_page
  2817. name: Volume Plus
  2818. internal: true
  2819. x_min: 215
  2820. x_max: 315
  2821. y_min: 90
  2822. y_max: 170
  2823. on_click:
  2824. min_length: 0ms
  2825. max_length: 500ms
  2826. then:
  2827. - logger.log: "Volume Plus pressed"
  2828. - lambda: |-
  2829. if (id(speaker_volume) < 10) {
  2830. id(speaker_volume) += 1;
  2831. }
  2832. - component.update: s3_box_lcd
  2833. - script.execute: set_volume
  2834. - platform: touchscreen
  2835. page_id: media_page
  2836. name: Play Pause
  2837. internal: true
  2838. x_min: 110
  2839. x_max: 210
  2840. y_min: 90
  2841. y_max: 170
  2842. on_click:
  2843. min_length: 0ms
  2844. max_length: 500ms
  2845. then:
  2846. - if:
  2847. condition:
  2848. media_player.is_idle:
  2849. then:
  2850. - media_player.play
  2851. else:
  2852. - media_player.stop
  2853. - logger.log: "Play Paused pressed"
  2854. - platform: touchscreen
  2855. page_id: media_page
  2856. name: Mute Media
  2857. internal: true
  2858. x_min: 110
  2859. x_max: 210
  2860. y_min: 180
  2861. y_max: 260
  2862. on_click:
  2863. min_length: 0ms
  2864. max_length: 500ms
  2865. then:
  2866. - switch.toggle: media_mute
  2867. - component.update: s3_box_lcd
  2868. #### external media ####
  2869. - platform: touchscreen
  2870. page_id: ext_media_page
  2871. id: ext_prev_track
  2872. internal: true
  2873. x_min: 5
  2874. x_max: 105
  2875. y_min: 90
  2876. y_max: 170
  2877. on_click:
  2878. min_length: 0ms
  2879. max_length: 500ms
  2880. then:
  2881. - homeassistant.service:
  2882. service: media_player.media_previous_track
  2883. data:
  2884. entity_id: media_player.${external_media_player}
  2885. - component.update: s3_box_lcd
  2886. - platform: touchscreen
  2887. page_id: ext_media_page
  2888. id: ext_next_track
  2889. internal: true
  2890. x_min: 215
  2891. x_max: 315
  2892. y_min: 90
  2893. y_max: 170
  2894. on_click:
  2895. min_length: 0ms
  2896. max_length: 500ms
  2897. then:
  2898. - homeassistant.service:
  2899. service: media_player.media_next_track
  2900. data:
  2901. entity_id: media_player.${external_media_player}
  2902. - component.update: s3_box_lcd
  2903. - platform: touchscreen
  2904. page_id: ext_media_page
  2905. name: Play Pause
  2906. internal: true
  2907. x_min: 110
  2908. x_max: 210
  2909. y_min: 90
  2910. y_max: 170
  2911. on_click:
  2912. min_length: 0ms
  2913. max_length: 500ms
  2914. then:
  2915. - homeassistant.service:
  2916. service: media_player.media_pause
  2917. data:
  2918. entity_id: media_player.${external_media_player}
  2919. - component.update: s3_box_lcd
  2920. - platform: touchscreen
  2921. page_id: ext_media_page
  2922. name: Mute Media
  2923. internal: true
  2924. x_min: 110
  2925. x_max: 210
  2926. y_min: 180
  2927. y_max: 260
  2928. on_click:
  2929. min_length: 0ms
  2930. max_length: 500ms
  2931. then:
  2932. - switch.toggle: ext_media_mute
  2933. - component.update: s3_box_lcd
  2934. - platform: touchscreen
  2935. page_id: ext_media_page
  2936. id: vol_minus
  2937. internal: true
  2938. x_min: 5
  2939. x_max: 105
  2940. y_min: 180
  2941. y_max: 260
  2942. on_click:
  2943. min_length: 0ms
  2944. max_length: 500ms
  2945. then:
  2946. - homeassistant.service:
  2947. service: media_player.volume_down
  2948. data:
  2949. entity_id: media_player.${external_media_player}
  2950. - component.update: s3_box_lcd
  2951. - script.execute: set_volume
  2952. - platform: touchscreen
  2953. page_id: ext_media_page
  2954. id: vol_plus
  2955. internal: true
  2956. x_min: 215
  2957. x_max: 315
  2958. y_min: 180
  2959. y_max: 260
  2960. on_click:
  2961. min_length: 0ms
  2962. max_length: 500ms
  2963. then:
  2964. - homeassistant.service:
  2965. service: media_player.volume_up
  2966. data:
  2967. entity_id: media_player.${external_media_player}
  2968. - component.update: s3_box_lcd
  2969. - script.execute: set_volume
  2970. ##### scenes page ####
  2971. - platform: touchscreen
  2972. page_id: scenes_page
  2973. id: scenes1
  2974. internal: true
  2975. x_min: 5
  2976. x_max: 105
  2977. y_min: 90
  2978. y_max: 170
  2979. #### make sure that the following 4 lines are uncommented by removing the prefixed '#' ###
  2980. # on_click:
  2981. # min_length: 10ms
  2982. # max_length: 500ms
  2983. # then:
  2984. #### add your action here - make sure to uncomment the following line by removing the prefixed '#' and keep these below your action #####
  2985. # - component.update: s3_box_lcd
  2986. - platform: touchscreen
  2987. page_id: scenes_page
  2988. id: scenes2
  2989. internal: true
  2990. x_min: 110
  2991. x_max: 210
  2992. y_min: 90
  2993. y_max: 170
  2994. # on_click:
  2995. # min_length: 10ms
  2996. # max_length: 500ms
  2997. #### make sure that the following line are uncommented and sit at the bottom of this block after your action ###
  2998. # - component.update: s3_box_lcd
  2999. - platform: touchscreen
  3000. page_id: scenes_page
  3001. id: scenes3
  3002. internal: true
  3003. x_min: 215
  3004. x_max: 315
  3005. y_min: 90
  3006. y_max: 170
  3007. # on_click:
  3008. # min_length: 10ms
  3009. # max_length: 500ms
  3010. #### make sure that the following line are uncommented and sit at the bottom of this block after your action ###
  3011. # - component.update: s3_box_lcd
  3012. - platform: touchscreen
  3013. page_id: scenes_page
  3014. id: scenes4
  3015. internal: true
  3016. x_min: 5
  3017. x_max: 105
  3018. y_min: 175
  3019. y_max: 240
  3020. # on_click:
  3021. # min_length: 10ms
  3022. # max_length: 500ms
  3023. #### make sure that the following line are uncommented and sit at the bottom of this block after your action ###
  3024. # - component.update: s3_box_lcd
  3025. - platform: touchscreen
  3026. page_id: scenes_page
  3027. id: scenes5
  3028. internal: true
  3029. x_min: 110
  3030. x_max: 210
  3031. y_min: 175
  3032. y_max: 240
  3033. # on_click:
  3034. # min_length: 10ms
  3035. # max_length: 500ms
  3036. #### make sure that the following line are uncommented and sit at the bottom of this block after your action ###
  3037. # - component.update: s3_box_lcd
  3038. - platform: touchscreen
  3039. page_id: scenes_page
  3040. id: scenes6
  3041. internal: true
  3042. x_min: 215
  3043. x_max: 315
  3044. y_min: 175
  3045. y_max: 240
  3046. # on_click:
  3047. # min_length: 10ms
  3048. # max_length: 500ms
  3049. #### make sure that the following line are uncommented and sit at the bottom of this block after your action ###
  3050. # - component.update: s3_box_lcd
  3051. ##### Screensaver Settings #####
  3052. - platform: touchscreen
  3053. page_id: ss_set_page
  3054. id: ss_timeout
  3055. internal: true
  3056. x_min: 250
  3057. x_max: 315
  3058. y_min: 115
  3059. y_max: 145
  3060. on_click:
  3061. min_length: 10ms
  3062. max_length: 500ms
  3063. then:
  3064. - display.page.show: timeout_settings_page
  3065. - component.update: s3_box_lcd
  3066. - platform: touchscreen
  3067. page_id: ss_set_page
  3068. id: ss_toggle
  3069. internal: true
  3070. x_min: 250
  3071. x_max: 315
  3072. y_min: 150
  3073. y_max: 175
  3074. on_click:
  3075. min_length: 10ms
  3076. max_length: 500ms
  3077. then:
  3078. - switch.toggle: s_saver
  3079. - component.update: s3_box_lcd
  3080. - platform: touchscreen # remove for no sensor version
  3081. page_id: ss_set_page
  3082. id: ss_wake_presc
  3083. internal: true
  3084. x_min: 250
  3085. x_max: 315
  3086. y_min: 180
  3087. y_max: 205
  3088. on_click:
  3089. min_length: 10ms
  3090. max_length: 500ms
  3091. then:
  3092. - switch.toggle: s_saver_presc
  3093. - component.update: s3_box_lcd
  3094. - platform: touchscreen
  3095. page_id: ss_set_page
  3096. id: ss_toggle_blank
  3097. internal: true
  3098. x_min: 250
  3099. x_max: 315
  3100. y_min: 210
  3101. y_max: 235
  3102. on_click:
  3103. min_length: 10ms
  3104. max_length: 500ms
  3105. then:
  3106. - switch.toggle: s_saver_mode
  3107. - component.update: s3_box_lcd
  3108. ##### voice settings page #####
  3109. - platform: touchscreen
  3110. page_id: ww_set_page
  3111. id: ww_chang_hass
  3112. internal: true
  3113. x_min: 10
  3114. x_max: 315
  3115. y_min: 100
  3116. y_max: 135
  3117. on_click:
  3118. min_length: 10ms
  3119. max_length: 500ms
  3120. then:
  3121. - select.operation:
  3122. id: wake_word_engine_location
  3123. operation: Next
  3124. cycle: true
  3125. - component.update: s3_box_lcd
  3126. - platform: touchscreen
  3127. page_id: ww_set_page
  3128. id: mute_response
  3129. internal: true
  3130. x_min: 250
  3131. x_max: 315
  3132. y_min: 145
  3133. y_max: 170
  3134. on_click:
  3135. min_length: 10ms
  3136. max_length: 500ms
  3137. then:
  3138. - switch.toggle: mute_response_switch
  3139. - component.update: s3_box_lcd
  3140. - platform: touchscreen
  3141. page_id: ww_set_page
  3142. id: ww_wake_sound
  3143. internal: true
  3144. x_min: 250
  3145. x_max: 315
  3146. y_min: 180
  3147. y_max: 205
  3148. on_click:
  3149. min_length: 10ms
  3150. max_length: 500ms
  3151. then:
  3152. - switch.toggle: wake_sound
  3153. - component.update: s3_box_lcd
  3154. - platform: touchscreen
  3155. page_id: ww_set_page
  3156. id: ww_toggle_conv
  3157. internal: true
  3158. x_min: 250
  3159. x_max: 315
  3160. y_min: 210
  3161. y_max: 235
  3162. on_click:
  3163. - switch.toggle: display_conversation
  3164. - component.update: s3_box_lcd
  3165. ##### touch to wake screen #####
  3166. - platform: touchscreen
  3167. page_id: saver_page
  3168. id: ss_wake
  3169. internal: true
  3170. x_min: 0
  3171. x_max: 320
  3172. y_min: 0
  3173. y_max: 240
  3174. on_click:
  3175. min_length: 10ms
  3176. max_length: 500ms
  3177. then:
  3178. - display.page.show: idle_page
  3179. - component.update: s3_box_lcd
  3180. ##### Timer finished page #####
  3181. - platform: touchscreen
  3182. page_id: timer_finished_page
  3183. id: timer_dismiss
  3184. internal: true
  3185. x_min: 0
  3186. x_max: 320
  3187. y_min: 0
  3188. y_max: 240
  3189. on_click:
  3190. min_length: 10ms
  3191. max_length: 500ms
  3192. then:
  3193. - switch.turn_off: timer_ringing
  3194. - display.page.show: idle_page
  3195. - component.update: s3_box_lcd
  3196. ##### Timeout settings buttons #####
  3197. - id: ss_sleep_down
  3198. page_id: timeout_settings_page
  3199. platform: touchscreen
  3200. internal: true
  3201. x_min: 25
  3202. x_max: 60
  3203. y_min: 105
  3204. y_max: 140
  3205. on_press:
  3206. then:
  3207. - lambda: |-
  3208. int sleep = id(s_saver_delay).state - 5;
  3209. if (sleep < 1) {
  3210. sleep = 1;
  3211. }
  3212. auto call = id(s_saver_delay).make_call();
  3213. call.set_value(sleep);
  3214. call.perform();
  3215. - component.update: s3_box_lcd
  3216. - id: ss_sleep_up
  3217. page_id: timeout_settings_page
  3218. platform: touchscreen
  3219. internal: true
  3220. x_min: 110
  3221. x_max: 145
  3222. y_min: 105
  3223. y_max: 140
  3224. on_press:
  3225. then:
  3226. - lambda: |-
  3227. int sleep = id(s_saver_delay).state + 5;
  3228. auto call = id(s_saver_delay).make_call();
  3229. call.set_value(sleep);
  3230. call.perform();
  3231. - component.update: s3_box_lcd
  3232. - id: ss_blank_down
  3233. page_id: timeout_settings_page
  3234. platform: touchscreen
  3235. internal: true
  3236. x_min: 25
  3237. x_max: 60
  3238. y_min: 180
  3239. y_max: 220
  3240. on_press:
  3241. then:
  3242. - lambda: |-
  3243. int sleep = id(s_saver_blank_delay).state - 5;
  3244. if (sleep < 1) {
  3245. sleep = 1;
  3246. }
  3247. auto call = id(s_saver_blank_delay).make_call();
  3248. call.set_value(sleep);
  3249. call.perform();
  3250. - component.update: s3_box_lcd
  3251. - id: ss_blank_up
  3252. page_id: timeout_settings_page
  3253. platform: touchscreen
  3254. internal: true
  3255. x_min: 110
  3256. x_max: 145
  3257. y_min: 180
  3258. y_max: 220
  3259. on_press:
  3260. then:
  3261. - lambda: |-
  3262. int sleep = id(s_saver_blank_delay).state + 5;
  3263. auto call = id(s_saver_blank_delay).make_call();
  3264. call.set_value(sleep);
  3265. call.perform();
  3266. - component.update: s3_box_lcd
  3267. - id: ss_bright_down
  3268. page_id: timeout_settings_page
  3269. platform: touchscreen
  3270. internal: true
  3271. x_min: 165
  3272. x_max: 195
  3273. y_min: 105
  3274. y_max: 140
  3275. on_press:
  3276. then:
  3277. - lambda: |-
  3278. int bright = id(s_saver_brightness).state - 5;
  3279. if (bright < 1) {
  3280. bright = 1;
  3281. }
  3282. auto call = id(s_saver_brightness).make_call();
  3283. call.set_value(bright);
  3284. call.perform();
  3285. - component.update: s3_box_lcd
  3286. - id: ss_bright_up
  3287. page_id: timeout_settings_page
  3288. platform: touchscreen
  3289. internal: true
  3290. x_min: 260
  3291. x_max: 295
  3292. y_min: 105
  3293. y_max: 140
  3294. on_press:
  3295. then:
  3296. - lambda: |-
  3297. int bright = id(s_saver_brightness).state + 5;
  3298. auto call = id(s_saver_brightness).make_call();
  3299. call.set_value(bright);
  3300. call.perform();
  3301. - component.update: s3_box_lcd
  3302. ##### device settings page #####
  3303. - id: s_default_bright_down
  3304. page_id: device_set_page
  3305. platform: touchscreen
  3306. internal: true
  3307. x_min: 280
  3308. x_max: 320
  3309. y_min: 125
  3310. y_max: 165
  3311. on_press:
  3312. then:
  3313. - lambda: |-
  3314. int default_bright = id(s_default_brightness).state - 5;
  3315. if (default_bright < 1) {
  3316. default_bright = 1;
  3317. }
  3318. auto call = id(s_default_brightness).make_call();
  3319. call.set_value(default_bright);
  3320. call.perform();
  3321. - component.update: s3_box_lcd
  3322. - id: s_default_bright_up
  3323. page_id: device_set_page
  3324. platform: touchscreen
  3325. internal: true
  3326. x_min: 155
  3327. x_max: 195
  3328. y_min: 125
  3329. y_max: 165
  3330. on_press:
  3331. then:
  3332. - lambda: |-
  3333. int default_bright = id(s_default_brightness).state + 5;
  3334. auto call = id(s_default_brightness).make_call();
  3335. call.set_value(default_bright);
  3336. call.perform();
  3337. - component.update: s3_box_lcd
  3338. - id: ext_media_toggle
  3339. page_id: device_set_page
  3340. platform: touchscreen
  3341. internal: true
  3342. x_min: 280
  3343. x_max: 320
  3344. y_min: 80
  3345. y_max: 120
  3346. on_press:
  3347. then:
  3348. - switch.toggle: output_audio
  3349. - component.update: s3_box_lcd
  3350. - platform: touchscreen
  3351. page_id: device_set_page
  3352. id: chang_display_format
  3353. x_min: 200
  3354. x_max: 260
  3355. y_min: 175
  3356. y_max: 210
  3357. on_click:
  3358. min_length: 10ms
  3359. max_length: 500ms
  3360. then:
  3361. - select.operation:
  3362. id: time_format
  3363. operation: Next
  3364. cycle: true
  3365. - component.update: s3_box_lcd
  3366. ##### alarm panel buttons #####
  3367. - platform: touchscreen
  3368. pages:
  3369. - alarm_away_activate_page
  3370. - alarm_home_activate_page
  3371. - alarm_night_activate_page
  3372. id: alarm_key_1
  3373. internal: true
  3374. x_min: 15
  3375. x_max: 63
  3376. y_min: 15
  3377. y_max: 63
  3378. on_press:
  3379. - script.execute: increment_digit_1
  3380. - component.update: s3_box_lcd
  3381. - platform: touchscreen
  3382. pages:
  3383. - alarm_away_activate_page
  3384. - alarm_home_activate_page
  3385. - alarm_night_activate_page
  3386. id: alarm_key_2
  3387. internal: true
  3388. x_min: 71
  3389. x_max: 119
  3390. y_min: 15
  3391. y_max: 63
  3392. on_press:
  3393. - script.execute: increment_digit_2
  3394. - component.update: s3_box_lcd
  3395. - platform: touchscreen
  3396. pages:
  3397. - alarm_away_activate_page
  3398. - alarm_home_activate_page
  3399. - alarm_night_activate_page
  3400. id: alarm_key_3
  3401. internal: true
  3402. x_min: 127
  3403. x_max: 175
  3404. y_min: 15
  3405. y_max: 63
  3406. on_press:
  3407. - script.execute: increment_digit_3
  3408. - component.update: s3_box_lcd
  3409. - platform: touchscreen
  3410. pages:
  3411. - alarm_away_activate_page
  3412. - alarm_home_activate_page
  3413. - alarm_night_activate_page
  3414. id: alarm_key_4
  3415. internal: true
  3416. x_min: 15
  3417. x_max: 63
  3418. y_min: 71
  3419. y_max: 119
  3420. on_press:
  3421. - script.execute: increment_digit_4
  3422. - component.update: s3_box_lcd
  3423. - platform: touchscreen
  3424. pages:
  3425. - alarm_away_activate_page
  3426. - alarm_home_activate_page
  3427. - alarm_night_activate_page
  3428. id: alarm_key_5
  3429. internal: true
  3430. x_min: 71
  3431. x_max: 119
  3432. y_min: 71
  3433. y_max: 119
  3434. on_press:
  3435. - script.execute: increment_digit_5
  3436. - component.update: s3_box_lcd
  3437. - platform: touchscreen
  3438. pages:
  3439. - alarm_away_activate_page
  3440. - alarm_home_activate_page
  3441. - alarm_night_activate_page
  3442. id: alarm_key_6
  3443. internal: true
  3444. x_min: 127
  3445. x_max: 175
  3446. y_min: 71
  3447. y_max: 119
  3448. on_press:
  3449. - script.execute: increment_digit_6
  3450. - component.update: s3_box_lcd
  3451. - platform: touchscreen
  3452. pages:
  3453. - alarm_away_activate_page
  3454. - alarm_home_activate_page
  3455. - alarm_night_activate_page
  3456. id: alarm_key_7
  3457. internal: true
  3458. x_min: 15
  3459. x_max: 63
  3460. y_min: 127
  3461. y_max: 175
  3462. on_press:
  3463. - script.execute: increment_digit_7
  3464. - component.update: s3_box_lcd
  3465. - platform: touchscreen
  3466. pages:
  3467. - alarm_away_activate_page
  3468. - alarm_home_activate_page
  3469. - alarm_night_activate_page
  3470. id: alarm_key_8
  3471. internal: true
  3472. x_min: 71
  3473. x_max: 119
  3474. y_min: 127
  3475. y_max: 175
  3476. on_press:
  3477. - script.execute: increment_digit_8
  3478. - component.update: s3_box_lcd
  3479. - platform: touchscreen
  3480. pages:
  3481. - alarm_away_activate_page
  3482. - alarm_home_activate_page
  3483. - alarm_night_activate_page
  3484. id: alarm_key_9
  3485. internal: true
  3486. x_min: 127
  3487. x_max: 175
  3488. y_min: 127
  3489. y_max: 175
  3490. on_press:
  3491. - script.execute: increment_digit_9
  3492. - component.update: s3_box_lcd
  3493. - platform: touchscreen
  3494. pages:
  3495. - alarm_away_activate_page
  3496. - alarm_home_activate_page
  3497. - alarm_night_activate_page
  3498. id: alarm_key_0
  3499. internal: true
  3500. x_min: 71
  3501. x_max: 119
  3502. y_min: 183
  3503. y_max: 231
  3504. on_press:
  3505. - media_player.play_media:
  3506. media_url: "${home_assistant_host}/local/sounds/key.mp3"
  3507. - script.execute: increment_digit_0
  3508. - component.update: s3_box_lcd
  3509. - platform: touchscreen
  3510. pages:
  3511. - alarm_away_activate_page
  3512. - alarm_home_activate_page
  3513. - alarm_night_activate_page
  3514. id: clear_pin
  3515. x_min: 198
  3516. x_max: 306
  3517. y_min: 170
  3518. y_max: 220
  3519. on_press:
  3520. then:
  3521. - lambda: |-
  3522. id(current_pin) = "";
  3523. - component.update: s3_box_lcd
  3524. - platform: touchscreen
  3525. pages:
  3526. - alarm_away_activate_page
  3527. - alarm_home_activate_page
  3528. - alarm_night_activate_page
  3529. id: alarm_ok
  3530. x_min: 198
  3531. x_max: 306
  3532. y_min: 110
  3533. y_max: 160
  3534. on_click:
  3535. min_length: 0ms
  3536. max_length: 500ms
  3537. then:
  3538. - if:
  3539. condition:
  3540. - lambda: |-
  3541. return (id(alarm_status).state == "arming" || id(alarm_status).state == "armed_away" || id(alarm_status).state == "armed_home" || id(alarm_status).state == "armed_night");
  3542. then:
  3543. - homeassistant.service:
  3544. service: alarm_control_panel.alarm_disarm
  3545. data:
  3546. entity_id: alarm_control_panel.alarmo
  3547. code: !lambda "return id(current_pin).c_str();"
  3548. - lambda: |-
  3549. id(current_pin) = "";
  3550. else:
  3551. - if:
  3552. condition:
  3553. and:
  3554. - lambda: |-
  3555. return (id(alarm_status).state == "disarmed");
  3556. - display.is_displaying_page: alarm_home_activate_page
  3557. then:
  3558. - homeassistant.service:
  3559. service: alarm_control_panel.alarm_arm_home
  3560. data:
  3561. entity_id: alarm_control_panel.alarmo
  3562. code: !lambda "return id(current_pin).c_str();"
  3563. - lambda: |-
  3564. id(current_pin) = "";
  3565. else:
  3566. - if:
  3567. condition:
  3568. and:
  3569. - lambda: |-
  3570. return (id(alarm_status).state == "disarmed");
  3571. - display.is_displaying_page: alarm_away_activate_page
  3572. then:
  3573. - homeassistant.service:
  3574. service: alarm_control_panel.alarm_arm_away
  3575. data:
  3576. entity_id: alarm_control_panel.alarmo
  3577. code: !lambda "return id(current_pin).c_str();"
  3578. - lambda: |-
  3579. id(current_pin) = "";
  3580. else:
  3581. - if:
  3582. condition:
  3583. and:
  3584. - lambda: |-
  3585. return (id(alarm_status).state == "disarmed");
  3586. - display.is_displaying_page: alarm_night_activate_page
  3587. then:
  3588. - homeassistant.service:
  3589. service: alarm_control_panel.alarm_arm_night
  3590. data:
  3591. entity_id: alarm_control_panel.alarmo
  3592. code: !lambda "return id(current_pin).c_str();"
  3593. - lambda: |-
  3594. id(current_pin) = "";
  3595. - component.update: s3_box_lcd
  3596. - platform: touchscreen
  3597. page_id: alarm_page
  3598. id: arm_disarm_home
  3599. x_min: 215
  3600. x_max: 320
  3601. y_min: 5
  3602. y_max: 75
  3603. on_click:
  3604. min_length: 0ms
  3605. max_length: 500ms
  3606. then:
  3607. - display.page.show: alarm_home_activate_page
  3608. - component.update: s3_box_lcd
  3609. - platform: touchscreen
  3610. page_id: alarm_page
  3611. id: arm_disarm_away
  3612. x_min: 215
  3613. x_max: 320
  3614. y_min: 80
  3615. y_max: 150
  3616. on_click:
  3617. min_length: 0ms
  3618. max_length: 500ms
  3619. then:
  3620. - display.page.show: alarm_away_activate_page
  3621. - component.update: s3_box_lcd
  3622. - platform: touchscreen
  3623. page_id: alarm_page
  3624. id: arm_disarm_night
  3625. x_min: 215
  3626. x_max: 320
  3627. y_min: 155
  3628. y_max: 240
  3629. on_click:
  3630. min_length: 0ms
  3631. max_length: 500ms
  3632. then:
  3633. - display.page.show: alarm_night_activate_page
  3634. - component.update: s3_box_lcd
  3635. ################## config end ############################