{"id":3710,"date":"2021-11-21T08:00:00","date_gmt":"2021-11-21T11:00:00","guid":{"rendered":"https:\/\/felipemateus.com\/?p=3710"},"modified":"2025-10-19T10:43:32","modified_gmt":"2025-10-19T13:43:32","slug":"sonoff-keyboard-key-reuse","status":"publish","type":"post","link":"https:\/\/felipemateus.com\/en\/blog\/2021\/11\/sonoff-keyboard-key-reuse","title":{"rendered":"sonoff: Keyboard key reuse"},"content":{"rendered":"<p class=\"has-text-align-justify wp-block-paragraph\">Today I decided to make a sonoff project to fix a silly problem I was having on my positive notebook. It uses 3 extra keys to open netflix, youtube or create a custom command.<\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">However I had never found a function for the custom command until today when I decided to create a function for it. So I decided to turn the sonoff switch on this key so that every time I press it, it turns the room light on or off.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This will come in handy when entering a meeting and having to turn the light off or on to help the camera. Soon I won&#039;t need to get up and I don&#039;t even need to have a cell phone in hand, just press the key and it turns on or off.<\/p>\n\n\n\n<h2 class=\"has-text-align-center wp-block-heading\">Starting the Sonoff Button Project<\/h2>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Before anything else to start the project I started looking for classes or libraries that connect with the sonoff platform I found some classes in python that didn&#039;t work as it should. In this sense I found this class in a project that was a sonoff ui on linux and best of all it worked.<\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Seeing the code of the class I noticed that the base of the system is websocket this makes me wonder if in the future I can receive notifications about status changes on the computer. It would be interesting since the program also put a notification to let me know what action was sent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In summary, the project is very simple, in addition to the sonofff class, there is the main file that turns the light on and off.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"490\" height=\"380\" src=\"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/notificacao_light.png\" alt=\"Image shows the project notification;\" class=\"wp-image-3712\" srcset=\"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/notificacao_light.png 490w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/notificacao_light-300x233.png 300w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/notificacao_light-15x12.png 15w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/notificacao_light-150x116.png 150w\" sizes=\"auto, (max-width: 490px) 100vw, 490px\" \/><figcaption>project notification<\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"has-text-align-center wp-block-heading\">Configuring sonoff project on key<\/h2>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">To configure I created a folder with the executable file, and the project icon which is a light bulb, executable that I use to trigger the command to sonoff when I press the target key. Remembering that this file will be executed every time the target button is pressed <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"762\" height=\"372\" src=\"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_19-39-27.png\" alt=\"Image shows the project folder with the executable file and icon.\" class=\"wp-image-3715\" srcset=\"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_19-39-27.png 762w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_19-39-27-300x146.png 300w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_19-39-27-18x9.png 18w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_19-39-27-150x73.png 150w\" sizes=\"auto, (max-width: 762px) 100vw, 762px\" \/><figcaption>Image of the folder containing the executable file<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">For Windows to recognize the executable as a program, I added a folder to the system PATH environment variable. However, this step is important because the path of all Windows programs needs to be in this variable.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"513\" height=\"495\" src=\"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_22-35-20.png\" alt=\"Image shows the paths of the PATH variable folders.\" class=\"wp-image-3716\" srcset=\"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_22-35-20.png 513w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_22-35-20-300x289.png 300w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_22-35-20-12x12.png 12w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_22-35-20-150x145.png 150w\" sizes=\"auto, (max-width: 513px) 100vw, 513px\" \/><figcaption>Environment variable with project path<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Then I created an executable shortcut in the programs folder of the start menu so you can create the keyboard shortcut.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs<div class=\"open_grepper_editor\" title=\"Edit &amp; Save To Grepper\"><\/div><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"415\" height=\"526\" src=\"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_22-55-26.png\" alt=\"Image shows the properties of the sonoff button project executable.\" class=\"wp-image-3718\" srcset=\"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_22-55-26.png 415w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_22-55-26-237x300.png 237w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_22-55-26-9x12.png 9w, https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/image_2021-11-14_22-55-26-150x190.png 150w\" sizes=\"auto, (max-width: 415px) 100vw, 415px\" \/><figcaption>Project and key shortcut properties<\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">The image above doesn&#039;t show but in the shortcut key this is the target key which is a key that does not appear because it is a special key.<\/p>\n\n\n\n<h2 class=\"has-text-align-center wp-block-heading\">Creation Challenges<\/h2>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Amazingly, I didn&#039;t have many challenges in creating the executable, it was very simple to find the libraries and create the project. The hard part was working with Windows because I had some difficulties that I overcame with a lot of patience and research. <\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">The first one was with the positive program I removed the program that was running when I pressed the target key. However, removing this program was not all because the program kept being called giving an error since it had removed the program.<\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">It was then after some time searching the internet I found the process of the program that was listening to the target key, it was then that I stopped that program and removed it from the computer. After I solved this problem I researched how to create a keyboard shortcut, a process that I mentioned earlier. <\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">However the code is very simple, the level of difficulty to make this project was low, it took me longer to publish this text than to do the project.<\/p>\n\n\n\n<h2 class=\"has-text-align-center wp-block-heading\">Upcoming Challenge<\/h2>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">Now I&#039;m creating a new version of the project that works as a service like the positive program that was installed. Then this service will be running in the background listening for the target key, to execute the function.<\/p>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">I&#039;m currently having a problem with the service it&#039;s not running and when it runs it doesn&#039;t hear this is the problem I&#039;m having.<\/p>\n\n\n\n<h2 class=\"has-text-align-center wp-block-heading\">Technologies Used<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.python.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">python<\/a><\/li><li><a href=\"https:\/\/www.pyinstaller.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">pyinstaller<\/a><\/li><li><a href=\"https:\/\/pypi.org\/project\/win10toast\/\" target=\"_blank\" rel=\"noreferrer noopener\">win10toast<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"has-text-align-center wp-block-heading\">Video Explanation<\/h2>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/AIuHmT3vQ7A?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span>\n<\/div><figcaption>Video shows the execution of the project<\/figcaption><\/figure>\n\n\n\n<h2 class=\"has-text-align-center wp-block-heading\">Test the Sonoff Project<\/h2>\n\n\n\n<p class=\"has-text-align-justify wp-block-paragraph\">The project is available on github, feel free to download, test and contribute, follow the links below.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:50%\">\n<p class=\"has-text-align-right has-text-color wp-block-paragraph\" style=\"color:#a30003\"><a href=\"https:\/\/github.com\/eufelipemateus\/sonoff-botao\/archive\/refs\/heads\/master.zip\" target=\"_blank\" rel=\"noreferrer noopener\">to go down<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:50%\">\n<p class=\"has-theme-palette-1-color has-text-color wp-block-paragraph\"><a href=\"https:\/\/github.com\/eufelipemateus\/sonoff-botao\" target=\"_blank\" rel=\"noreferrer noopener\">project<\/a><\/p>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>In this text I show a homemade project that I created that allows activating the sonoff through the computer keyboard.<\/p>","protected":false},"author":2,"featured_media":3727,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"googlesitekit_rrm_CAowhPjFCw:productID":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"federated","footnotes":"","jetpack_publicize_message":"Ol\u00e1, Tudo bem? Hoje publiquei um novo texto falando sobre o projeto caseiro que fiz h\u00e1 uma semana atr\u00e1s  confira o post a seguir. #python #iot #sonoff #programacao","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[2],"tags":[1094,1053,1093,1095],"class_list":["post-3710","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-projetos","tag-iot","tag-programacao","tag-python","tag-windows"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>sonoff: Reutiliza\u00e7\u00e3o de tecla do teclado - Felipe Mateus @felipemateus<\/title>\n<meta name=\"description\" content=\"Neste projeto eu crio um programa que da uma fun\u00e7\u00e3o pra tecla do teclado acendendo e apagando a luz do sonoff.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/felipemateus.com\/en\/blog\/2021\/11\/sonoff-keyboard-key-reuse\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"sonoff: Reutiliza\u00e7\u00e3o de tecla do teclado - Felipe Mateus @felipemateus\" \/>\n<meta property=\"og:description\" content=\"Neste projeto eu crio um programa que da uma fun\u00e7\u00e3o pra tecla do teclado acendendo e apagando a luz do sonoff.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mundoazul.blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado\" \/>\n<meta property=\"og:site_name\" content=\"Felipe Mateus\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/eufelipemateus\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/eufelipemateus\" \/>\n<meta property=\"article:published_time\" content=\"2021-11-21T11:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-19T13:43:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1280\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Felipe Mateus\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@eufelipemateus\" \/>\n<meta name=\"twitter:site\" content=\"@eufelipemateus\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Felipe Mateus\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado\"},\"author\":{\"name\":\"Felipe Mateus\",\"@id\":\"https:\\\/\\\/felipemateus.com\\\/#\\\/schema\\\/person\\\/5ca2279426b9f93497fbf68a6e2577b6\"},\"headline\":\"sonoff: Reutiliza\u00e7\u00e3o de tecla do teclado\",\"datePublished\":\"2021-11-21T11:00:00+00:00\",\"dateModified\":\"2025-10-19T13:43:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado\"},\"wordCount\":734,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/felipemateus.com\\\/#\\\/schema\\\/person\\\/5ca2279426b9f93497fbf68a6e2577b6\"},\"image\":{\"@id\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/felipemateus.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/iot-gb3efe58db_1920.jpg\",\"keywords\":[\"iot\",\"Programa\u00e7\u00e3o\",\"python\",\"windows\"],\"articleSection\":[\"Projetos\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado\",\"url\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado\",\"name\":\"sonoff: Reutiliza\u00e7\u00e3o de tecla do teclado - Felipe Mateus @felipemateus\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/felipemateus.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/felipemateus.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/iot-gb3efe58db_1920.jpg\",\"datePublished\":\"2021-11-21T11:00:00+00:00\",\"dateModified\":\"2025-10-19T13:43:32+00:00\",\"description\":\"Neste projeto eu crio um programa que da uma fun\u00e7\u00e3o pra tecla do teclado acendendo e apagando a luz do sonoff.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado#primaryimage\",\"url\":\"https:\\\/\\\/felipemateus.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/iot-gb3efe58db_1920.jpg\",\"contentUrl\":\"https:\\\/\\\/felipemateus.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/iot-gb3efe58db_1920.jpg\",\"width\":1920,\"height\":1280,\"caption\":\"Imagem de Pixabay\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/2021\\\/11\\\/sonoff-reutilizacao-de-tecla-do-teclado#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\\\/\\\/felipemateus.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Projetos\",\"item\":\"https:\\\/\\\/felipemateus.com\\\/blog\\\/topicos\\\/projetos\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"sonoff: Reutiliza\u00e7\u00e3o de tecla do teclado\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/felipemateus.com\\\/#website\",\"url\":\"https:\\\/\\\/felipemateus.com\\\/\",\"name\":\"Felipe Mateus @felipemateus\",\"description\":\"Seja Bem-Vindo ao meu mundo azul.\",\"publisher\":{\"@id\":\"https:\\\/\\\/felipemateus.com\\\/#\\\/schema\\\/person\\\/5ca2279426b9f93497fbf68a6e2577b6\"},\"alternateName\":\"eufelipemateus\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/felipemateus.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/felipemateus.com\\\/#\\\/schema\\\/person\\\/5ca2279426b9f93497fbf68a6e2577b6\",\"name\":\"Felipe Mateus Rocha Martins\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/felipemateus.com\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/FELIPE-2-1024x1024.png\",\"url\":\"https:\\\/\\\/felipemateus.com\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/FELIPE-2-1024x1024.png\",\"contentUrl\":\"https:\\\/\\\/felipemateus.com\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/FELIPE-2-1024x1024.png\",\"width\":1024,\"height\":1024,\"caption\":\"Felipe Mateus\"},\"sameAs\":[\"https:\\\/\\\/felipemateus.com\",\"https:\\\/\\\/www.facebook.com\\\/eufelipemateus\",\"https:\\\/\\\/www.instagram.com\\\/eufelipemateus\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/eufelipemateus\\\/\",\"https:\\\/\\\/x.com\\\/eufelipemateus\",\"https:\\\/\\\/github.com\\\/eufelipemateus\",\"https:\\\/\\\/soundcloud.com\\\/eufelipemateus\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Sonoff: Keyboard Key Reuse - Felipe Mateus @felipemateus","description":"In this project I create a program that gives a function to the keyboard key turning the sonoff light on and off.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/felipemateus.com\/en\/blog\/2021\/11\/sonoff-keyboard-key-reuse","og_locale":"en_US","og_type":"article","og_title":"sonoff: Reutiliza\u00e7\u00e3o de tecla do teclado - Felipe Mateus @felipemateus","og_description":"Neste projeto eu crio um programa que da uma fun\u00e7\u00e3o pra tecla do teclado acendendo e apagando a luz do sonoff.","og_url":"https:\/\/mundoazul.blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado","og_site_name":"Felipe Mateus","article_publisher":"https:\/\/www.facebook.com\/eufelipemateus","article_author":"https:\/\/www.facebook.com\/eufelipemateus","article_published_time":"2021-11-21T11:00:00+00:00","article_modified_time":"2025-10-19T13:43:32+00:00","og_image":[{"width":1920,"height":1280,"url":"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg","type":"image\/jpeg"}],"author":"Felipe Mateus","twitter_card":"summary_large_image","twitter_creator":"@eufelipemateus","twitter_site":"@eufelipemateus","twitter_misc":{"Written by":"Felipe Mateus","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado#article","isPartOf":{"@id":"https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado"},"author":{"name":"Felipe Mateus","@id":"https:\/\/felipemateus.com\/#\/schema\/person\/5ca2279426b9f93497fbf68a6e2577b6"},"headline":"sonoff: Reutiliza\u00e7\u00e3o de tecla do teclado","datePublished":"2021-11-21T11:00:00+00:00","dateModified":"2025-10-19T13:43:32+00:00","mainEntityOfPage":{"@id":"https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado"},"wordCount":734,"commentCount":0,"publisher":{"@id":"https:\/\/felipemateus.com\/#\/schema\/person\/5ca2279426b9f93497fbf68a6e2577b6"},"image":{"@id":"https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado#primaryimage"},"thumbnailUrl":"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg","keywords":["iot","Programa\u00e7\u00e3o","python","windows"],"articleSection":["Projetos"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado#respond"]}]},{"@type":"WebPage","@id":"https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado","url":"https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado","name":"Sonoff: Keyboard Key Reuse - Felipe Mateus @felipemateus","isPartOf":{"@id":"https:\/\/felipemateus.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado#primaryimage"},"image":{"@id":"https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado#primaryimage"},"thumbnailUrl":"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg","datePublished":"2021-11-21T11:00:00+00:00","dateModified":"2025-10-19T13:43:32+00:00","description":"In this project I create a program that gives a function to the keyboard key turning the sonoff light on and off.","breadcrumb":{"@id":"https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado#primaryimage","url":"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg","contentUrl":"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg","width":1920,"height":1280,"caption":"Imagem de Pixabay"},{"@type":"BreadcrumbList","@id":"https:\/\/felipemateus.com\/blog\/2021\/11\/sonoff-reutilizacao-de-tecla-do-teclado#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/felipemateus.com\/"},{"@type":"ListItem","position":2,"name":"Projetos","item":"https:\/\/felipemateus.com\/blog\/topicos\/projetos"},{"@type":"ListItem","position":3,"name":"sonoff: Reutiliza\u00e7\u00e3o de tecla do teclado"}]},{"@type":"WebSite","@id":"https:\/\/felipemateus.com\/#website","url":"https:\/\/felipemateus.com\/","name":"Felipe Mateus @felipemateus","description":"Welcome to my blue world.","publisher":{"@id":"https:\/\/felipemateus.com\/#\/schema\/person\/5ca2279426b9f93497fbf68a6e2577b6"},"alternateName":"eufelipemateus","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/felipemateus.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/felipemateus.com\/#\/schema\/person\/5ca2279426b9f93497fbf68a6e2577b6","name":"Felipe Mateus Rocha Martins","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2023\/04\/FELIPE-2-1024x1024.png","url":"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2023\/04\/FELIPE-2-1024x1024.png","contentUrl":"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2023\/04\/FELIPE-2-1024x1024.png","width":1024,"height":1024,"caption":"Felipe Mateus"},"sameAs":["https:\/\/felipemateus.com","https:\/\/www.facebook.com\/eufelipemateus","https:\/\/www.instagram.com\/eufelipemateus","https:\/\/www.linkedin.com\/in\/eufelipemateus\/","https:\/\/x.com\/eufelipemateus","https:\/\/github.com\/eufelipemateus","https:\/\/soundcloud.com\/eufelipemateus"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/felipemateus.b-cdn.net\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pb1Prx-XQ","jetpack-related-posts":[{"id":9060,"url":"https:\/\/felipemateus.com\/en\/blog\/2023\/09\/sonoff-keyboard-key-reuse-background","url_meta":{"origin":3710,"position":0},"title":"sonoff: Keyboard key reuse \u2013 Part 2","author":"Felipe Mateus","date":"03\/09\/2023","format":false,"excerpt":"This project is part of the second part of the &#039;Keyboard Key Reuse&#039; project. In it, I develop a program that allows you to turn the light on and off using a keyboard shortcut. In this new version, the program runs as a service in the background.","rel":"","context":"In &quot;Projetos&quot;","block_context":{"text":"Projetos","link":"https:\/\/felipemateus.com\/en\/blog\/topics\/projects"},"img":{"alt_text":"imagem capa para temas iot.","src":"https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2021\/11\/iot-gb3efe58db_1920.jpg?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":4097,"url":"https:\/\/felipemateus.com\/en\/blog\/2022\/03\/how-to-create-commands-in-laravel","url_meta":{"origin":3710,"position":1},"title":"How to create commands in Laravel?","author":"Felipe Mateus","date":"06\/03\/2022","format":false,"excerpt":"Create commands in Laravel with it you can create crons and run laravel function directly in the terminal.","rel":"","context":"In &quot;Desenvolvimento Web e Programa\u00e7\u00e3o&quot;","block_context":{"text":"Desenvolvimento Web e Programa\u00e7\u00e3o","link":"https:\/\/felipemateus.com\/en\/blog\/topics\/web-development-and-programming"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2022\/03\/laravel-logo.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2022\/03\/laravel-logo.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2022\/03\/laravel-logo.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2022\/03\/laravel-logo.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2022\/03\/laravel-logo.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":2740,"url":"https:\/\/felipemateus.com\/en\/blog\/2021\/05\/bingo","url_meta":{"origin":3710,"position":2},"title":"Bingo Game Multiplayer Socket.io and Javascript","author":"Felipe Mateus","date":"08\/05\/2021","format":false,"excerpt":"This is a multiplayer game made as a way to test knowledge and serve as an example for other programmers.","rel":"","context":"In &quot;Projetos&quot;","block_context":{"text":"Projetos","link":"https:\/\/felipemateus.com\/en\/blog\/topics\/projects"},"img":{"alt_text":"imagem de bingo","src":"https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2019\/09\/2019-09-18.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2019\/09\/2019-09-18.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2019\/09\/2019-09-18.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2019\/09\/2019-09-18.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2019\/09\/2019-09-18.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":54,"url":"https:\/\/felipemateus.com\/en\/blog\/2017\/06\/domino","url_meta":{"origin":3710,"position":3},"title":"\ud83c\udfb2 Domino Game Meet the Online Multiplayer game","author":"Felipe Mateus","date":"16\/06\/2017","format":false,"excerpt":"Today I started making an online multiplayer domino game in HTML5. I&#039;m using the Dice font to create the dots that represent the domino numbers.","rel":"","context":"In &quot;Projetos&quot;","block_context":{"text":"Projetos","link":"https:\/\/felipemateus.com\/en\/blog\/topics\/projects"},"img":{"alt_text":"imagem do jogo","src":"https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2017\/06\/2019-06-24-e1561431327464.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2017\/06\/2019-06-24-e1561431327464.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2017\/06\/2019-06-24-e1561431327464.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2017\/06\/2019-06-24-e1561431327464.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2017\/06\/2019-06-24-e1561431327464.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":45243,"url":"https:\/\/felipemateus.com\/en\/blog\/2026\/02\/home-office-equipment","url_meta":{"origin":3710,"position":4},"title":"Home office: essential equipment for setting up a home office","author":"Guest Post","date":"02\/02\/2026","format":false,"excerpt":"Creating a practical and comfortable workspace at home has become an essential need, especially with the growing adoption of home offices as a professional work model for countless individuals. Setting up a home office can be easier and more accessible than it seems, especially when looking for opportunities\u2026","rel":"","context":"In &quot;Tecnologia, Carreira e Mercado&quot;","block_context":{"text":"Tecnologia, Carreira e Mercado","link":"https:\/\/felipemateus.com\/en\/blog\/topics\/technology"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2026\/02\/pexels-photo-192383521.jpeg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":34192,"url":"https:\/\/felipemateus.com\/en\/blog\/2025\/12\/retrospective","url_meta":{"origin":3710,"position":5},"title":"Dev Retrospective: A journey of creation, PoCs, and real limitations.","author":"Felipe Mateus","date":"31\/12\/2025","format":false,"excerpt":"An immersion into the Fediverse, Web3, and distributed systems from behind the scenes of more than 20 projects from 2025. Between published tools and discarded PoCs, the text reflects on technical experimentation, regulatory barriers, and the understanding that real progress arises from the accumulated learning in each attempt.","rel":"","context":"In &quot;Projetos&quot;","block_context":{"text":"Projetos","link":"https:\/\/felipemateus.com\/en\/blog\/topics\/projects"},"img":{"alt_text":"Capa retrospectiva","src":"https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2025\/12\/capa-retrospectiva.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2025\/12\/capa-retrospectiva.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2025\/12\/capa-retrospectiva.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2025\/12\/capa-retrospectiva.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2025\/12\/capa-retrospectiva.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/felipemateus.com\/wp-content\/uploads\/2025\/12\/capa-retrospectiva.png?resize=1400%2C800&ssl=1 4x"},"classes":[]}],"jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/felipemateus.com\/en\/wp-json\/wp\/v2\/posts\/3710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/felipemateus.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/felipemateus.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/felipemateus.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/felipemateus.com\/en\/wp-json\/wp\/v2\/comments?post=3710"}],"version-history":[{"count":18,"href":"https:\/\/felipemateus.com\/en\/wp-json\/wp\/v2\/posts\/3710\/revisions"}],"predecessor-version":[{"id":17688,"href":"https:\/\/felipemateus.com\/en\/wp-json\/wp\/v2\/posts\/3710\/revisions\/17688"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/felipemateus.com\/en\/wp-json\/wp\/v2\/media\/3727"}],"wp:attachment":[{"href":"https:\/\/felipemateus.com\/en\/wp-json\/wp\/v2\/media?parent=3710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/felipemateus.com\/en\/wp-json\/wp\/v2\/categories?post=3710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/felipemateus.com\/en\/wp-json\/wp\/v2\/tags?post=3710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}