# \[APP\]\[Pro\] ESPhome - Control your ESP8266/ESP32 by simple configuration files

**URL:** <https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271>\
**Category:** Apps\
**Created:** [August 16, 2023, 7:17pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271 "2023-08-16T19:17:36Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Baldhor](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/baldhor/32/27028_2.png) [@Baldhor](https://community.homey.app/u/Baldhor)\
**Post date:** [October 3, 2023, 8:49am UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/21 "2023-10-03T08:49:25Z")

</div>

> [@Peter\_Kawa](#):
>
> Homey

@Peter_Kawa The new Wizard is live, enjoy!

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 3, 2023, 3:19pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/22 "2023-10-03T15:19:57Z")

</div>

Thanks!! Playing with it, filed some issues @ Git 😉  
The wiki is awesome, hats off!

Concerning retrieving the bearer token, I [found a neat scrip here](https://community.homey.app/t/homeyscript-for-bearer-token/47819).  
Adjusted it a little bit, for when one uses 2FA authentication.

> **View Script**
>
> ```auto
> // Retrieve my Bearer token (access token) -> gets available in Homeyscript tag 'bearertoken'
> //
> // 2FA specific info: 
> // When using 2FA with your account: Enter your 2FA code by means of a (flow card) argument, otherwise ignore it
> const twofaKey = args[0] ?? ''; 
> //
> // -------- o - Configure these parameters -------- o -------- o 
> //
> // About configuring:
> // A client_id and client_secret can be found at https://tools.developer.homey.app/api/projects
> // Your cloudid can be found right after this URL part https://my.homey.app/homeys/
> // or here https://tools.developer.homey.app/tools/system 
> // or here https://my.homey.app -> cogwheel -> System -> General
> // 
> let email = 'Your_Homey_emailaddress'
> // password: With 2FA enabled, just append the 6-figure number to your pw
> // use args[0] to be able to enter it as flow argument
> let password = 'your_Homey_password' + twofaKey ////Don't touch the "+ twofaKey" part pls!
> let client_id = 'client_id'
> let client_secret = 'client_secret'
> // redirect_url: With 2FA enabled, use 'http://localhost/oauth2/callback', otherwise use 'http://localhost/'
> let redirect_url = 'http://localhost/oauth2/callback'
> let cloudid = 'your_cloud_id'
> // -------- o -------- o -------- o -------- o -------- o 
> 
> const between = function(str, strf, strt) {
> return str.split(strf).pop().split(strt)[0].trim();
> }
> 
> const authurl = 'https://accounts.athom.com/login'
> console.log("POST authentication " + authurl)
> const response2 = await fetch(authurl, {
> "headers": {
> "accept": "application/json, text/javascript, */*; q=0.01",
> "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
> },
> "referrerPolicy": "no-referrer-when-downgrade",
> "body": 'email=' +encodeURIComponent(email) + '&password=' + encodeURIComponent(password) + '&otptoken=',
> "method": "POST",
> "mode": "cors",
> "credentials": "omit"
> })
> const body2 = await response2.text()
> const token = JSON.parse(body2)
> 
> const authorizeurl = 'https://accounts.athom.com/oauth2/authorise?client_id=' + client_id + 
> '&redirect_uri=' + encodeURIComponent(redirect_url) + '&response_type=code&user_token=' + token.token
> 
> console.log(" Response from accounts.athom.com/login ", body2)
> console.log("GET Authorization " + authorizeurl)
> 
> const response3 = await fetch(authorizeurl, {
> "headers": {
> },
> "method": "GET",
> "mode": "cors",
> "credentials": "include"
> })
> const body3 = await response3.text()
> let csrf = between(body3, 'name="_csrf" value="', '">')
> let cookiecsrf = null;
> let raw = response3.headers.raw()['set-cookie'];
> for (let cookie of raw) {
> if (cookie.startsWith('_csrf=')) {
> cookiecsrf = cookie.match(/=(.+?);/)[1];
> break;
> }
> }
> 
> let cookie4 = '_csrf=' + cookiecsrf
> // console.log("Cookie4", cookie4)
> console.log(" CSRF input parameter", csrf)
> console.log(" CSRF cookie", cookiecsrf)
> 
> let authorizeurl2 = 'https://accounts.athom.com/authorise?client_id=' + client_id + '&redirect_uri=' + encodeURIComponent(redirect_url) + '&response_type=code&user_token=' + token.token
> console.log("GET Authorization", authorizeurl2)
> const response4 = await fetch(authorizeurl2, {
> "headers": {
> "content-type": "application/x-www-form-urlencoded",
> "cookie": cookie4
> },
> "redirect": "manual",
> "body": "resource=resource.homey." + cloudid + "&_csrf=" + csrf + "&allow=Allow",
> "method": "POST",
> "mode": "cors",
> "credentials": "include"
> });
> 
> const body4 = await response4.text()
> 
> let code = response4.headers.get('location').split('=')[1]
> 
> console.log(" Response from authorization. Redirect to ", response4.headers.get('location'))
> console.log(" Response content ", body4)
> console.log(" Parsed the following code ", code)
> 
> let tokenendpoint = 'https://api.athom.com/oauth2/token'
> console.log("POST token (resolve code to token) " + tokenendpoint)
> const response5 = await fetch(tokenendpoint, {
> "headers": {
> "content-type": "application/x-www-form-urlencoded",
> },
> "body": 'client_id=' + encodeURIComponent(client_id) + '&client_secret=' + encodeURIComponent(client_secret) + 
> '&grant_type=authorization_code&code=' + encodeURIComponent(code),
> "method": "POST",
> "mode": "cors",
> "credentials": "include"
> });
> 
> //console.log("Response5", response5)
> const body5 = await response5.text()
> let accesstoken = JSON.parse(body5)
> 
> let delegationEndpoint = 'https://api.athom.com/delegation/token?audience=homey'
> const response6 = await fetch(delegationEndpoint, {
> "headers": {
> "content-type": "application/x-www-form-urlencoded",
> "authorization": "Bearer " + accesstoken.access_token
> },
> "referrerPolicy": "no-referrer-when-downgrade",
> "body": "client_id=" + client_id + " &client_secret=" + client_secret + "&grant_type=refresh_token&refresh_token=" + accesstoken.refresh_token,
> "method": "POST",
> "mode": "cors",
> "credentials": "include"
> });
> 
> const body6 = await response6.json()
> console.log(" JWT token is " + body6)
> 
> let endpoint7 = 'https://' + cloudid + '.connect.athom.com/api/manager/users/login'
> console.log("POST login endpoint " + endpoint7)
> const response7 = await fetch(endpoint7, {
> "headers": {
> "content-type": "application/json",
> //"authorization": "Bearer " + accesstoken.access_token
> },
> "body": JSON.stringify({"token": body6}),
> "method": "POST"
> });
> 
> const body7 = await response7.json()
> console.log(" Response status " + response7.status)
> console.log(" Response: " + body7)
> 
> await tag("bearertoken", body7)
> return true
> 
> ```

---

<div class="post-metadata">

**Author:** ![Baldhor](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/baldhor/32/27028_2.png) [@Baldhor](https://community.homey.app/u/Baldhor)\
**Post date:** [October 3, 2023, 9:02pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/23 "2023-10-03T21:02:56Z")

</div>

> [@Peter\_Kawa](#):
>
> Concerning retrieving the bearer token, I [found a neat scrip here](https://community.homey.app/t/homeyscript-for-bearer-token/47819).  
> Adjusted it a little bit, for when one uses 2FA authentication.

Well, this script require using homey script.. I’m not convinced it’s easier than using F12 …  
At least for most users, it will not make it easier 🙂

Let’s fovus on the issues you met first, improvements will come later …

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 3, 2023, 10:07pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/24 "2023-10-03T22:07:29Z")

</div>

Thanks, it was just a thought, and I’m not saying it’s a priority 😉  
Nevermind, I just had some ideas of how it can be integrated (in the future) into the app.  
But there’s [this app](https://github.com/cactusss/nl.onzewifi.timelinemanager2) which has it integrated already, just to show it’s possible, and just as an idea. Not wanting to push anything.

 ![Screenshot from 2023-10-03 23-50-12](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/a/eacdd248d2ad98036545e5e2a0351981dd5e5fd2.png)

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 4, 2023, 3:47pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/25 "2023-10-04T15:47:28Z")

</div>

Thanks for the fix. It seems to work pretty well now. Changing the zone using the bearer token works as well. It feels natural working with it. You improved the wizard big time. Also your wiki is stunning 😉

---

<div class="post-metadata">

**Author:** ![Baldhor](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/baldhor/32/27028_2.png) [@Baldhor](https://community.homey.app/u/Baldhor)\
**Post date:** [October 4, 2023, 7:37pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/26 "2023-10-04T19:37:47Z")

</div>

> [@Peter\_Kawa](#):
>
> it integrated already, just to show it’s possible, and just as an idea. Not wanting to push anything.

No problem, it’s just as I release a big update, I need focus on issues first 🙂  
Happy yours is fixed!

Do not hesitate to open an enhancement request in the github about this bearer token subject.  
To be honest, I’m unsure how easier it will make it for the users 🙂

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 4, 2023, 11:06pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/27 "2023-10-04T23:06:08Z")

</div>

Thanks, Baldhor. Oh, I couldn’t find info yet what’s possible with the bearer token added, besides zone edit? Or is it on the road map? Just curious 🤭

---

<div class="post-metadata">

**Author:** ![Robin\_van\_Kekem](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robin_van_kekem/32/8187_2.png) [@Robin\_van\_Kekem](https://community.homey.app/u/Robin_van_Kekem)\
**Post date:** [October 5, 2023, 5:07am UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/28 "2023-10-05T05:07:13Z")

</div>

Yes, move the device, rename device and delete device

---

<div class="post-metadata">

**Author:** ![Baldhor](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/baldhor/32/27028_2.png) [@Baldhor](https://community.homey.app/u/Baldhor)\
**Post date:** [October 15, 2023, 7:38pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/29 "2023-10-15T19:38:36Z")

</div>

I just upgraded all my heater devices from tasmota to ESPhome, so handy to create so many device from the Wizard in one step 🙂

> Just input the bearer token, and you can choose the zone of each device so easily …

Yes I know, I’m the dev of this app but I never had time to do it lol  
I removed tasmota app, MQTT app, and about 40 flows! 😂  
Just in time for winter!

---

<div class="post-metadata">

**Author:** ![Woetski](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/woetski/32/79291_2.png) [@Woetski](https://community.homey.app/u/Woetski)\
**Post date:** [November 27, 2023, 1:54pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/30 "2023-11-27T13:54:46Z")

</div>

Hi @Baldhor, Thanks for the ESPHome app.

I’ve just connected with your updated guide a physical and then virtual ESPhome device.  
All 6 expected sensor values are found. But i’m missing a “light” entity for this specific device. How can i manually add this?

I connected this to homey: [https://www.tindie.com/products/hjhickinson/orconwificontroller-for-orcon-mvs-15/](https://www.tindie.com/products/hjhickinson/orconwificontroller-for-orcon-mvs-15/)

Thank you for you response

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [November 27, 2023, 3:21pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/31 "2023-11-27T15:21:18Z")

</div>

Hi Woetski,

What if you set the device class to “Light”?  
Can’t test it, but it seems logical to me:

> ![Screenshot_20231127-161954_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/a/cab76add59d8a1b0b713f57b173c66e2b9126f84.jpeg)

---

<div class="post-metadata">

**Author:** ![Woetski](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/woetski/32/79291_2.png) [@Woetski](https://community.homey.app/u/Woetski)\
**Post date:** [November 27, 2023, 3:50pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/32 "2023-11-27T15:50:13Z")

</div>

Hi Peter, thanks for response.

I already tried that, unfortunately doesn’t change or add entities. Still gives 6 instead of expected 7.  
Funny part is, when reading the log from the physical device in the ESPhome app in homey. I can see the 7th missing entity, I just can’t find / select this in the “manage virtual capabilities”

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [November 27, 2023, 6:58pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/33 "2023-11-27T18:58:37Z")

</div>

I digged a little through the [product pages](https://www.tindie.com/products/smartlightme/smlight-slzb-06m-zigbee-ethernet-poe-usb-wifi-adap/), imho the RPM / Speed entity is not a light, but a slider.

 ![Screenshot_20231127-191519_GitHub](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/b/7b46253a7c106d55ba309adf3fa20b78e78594ce.jpeg)

Maybe the lightbulb icon on this example confuses.

I can adjust several settings from Homey with either ‘target\_temperature’ or ‘dim’.  
Shouldn’t that also be possible with the RPM slash Speed setting?

 ![Screenshot_20231127-195547_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/5/45fc579dea3a0d4cd33e273e4673f836547287c6.jpeg)

![20231127_195031](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/7/e75e88641148b8fd7d33b28700a8bb6d90711dfa.gif)

---

<div class="post-metadata">

**Author:** ![Baldhor](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/baldhor/32/27028_2.png) [@Baldhor](https://community.homey.app/u/Baldhor)\
**Post date:** [November 28, 2023, 11:46am UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/34 "2023-11-28T11:46:59Z")

</div>

I will try to take a look tonight, but please open github tickets if possible, it will make it much more easier 😉

---

<div class="post-metadata">

**Author:** ![Baldhor](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/baldhor/32/27028_2.png) [@Baldhor](https://community.homey.app/u/Baldhor)\
**Post date:** [November 28, 2023, 6:04pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/35 "2023-11-28T18:04:51Z")

</div>

Thans for opening an isuee in the github: [[Add entity to fan class] OrconWifiController · Issue #75 · Baldhor/Homey-ESPhome-Enhanced · GitHub](https://github.com/Baldhor/Homey-ESPhome-Enhanced/issues/75)

Yes I need to implement it, should be easy once you sent me all the logs 🙂

Just for info, the “ **esphome components** ” implemented in the app right now are:

- BinarySensor
- Button
- Climate
- Cover
- Number
- Select
- Sensor
- Switch
- TextSensor

To implement the others, I need logs or money to buy devices 🙂

edit: updated list of supported components to include the sensors.  
I also added the list to the first post.

---

<div class="post-metadata">

**Author:** ![Baldhor](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/baldhor/32/27028_2.png) [@Baldhor](https://community.homey.app/u/Baldhor)\
**Post date:** [December 6, 2023, 6:51pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/36 "2023-12-06T18:51:22Z")

</div>

Support for Light onoff and brightness has been implemented.

---

<div class="post-metadata">

**Author:** ![Patrick\_85](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/patrick_85/32/138056_2.png) [@Patrick\_85](https://community.homey.app/u/Patrick_85)\
**Post date:** [January 3, 2024, 6:22pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/37 "2024-01-03T18:22:45Z")

</div>

Can someone explain to me why the insight part is not visible on every device.  
I did set up two usb dongle in a carrier airco one I have the insight part to log the current temp and desire temp on the other usb there is nothing visible.  
I don’t know if it’s a setting or something else.

Maybe it’s possible the insert the option climate/airconditioning?

For a new user I stil find new stuff to set up to homey 😇.

---

<div class="post-metadata">

**Author:** ![Baldhor](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/baldhor/32/27028_2.png) [@Baldhor](https://community.homey.app/u/Baldhor)\
**Post date:** [January 3, 2024, 7:39pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/38 "2024-01-03T19:39:46Z")

</div>

insight can be enabled / disabled from the wizard, maybe you disabled it by “accident”?  
You can just go edit the virtual device to check it out and modify it.

If it doesn’t come from that, then to be honest, I have no idea 🙂

---

<div class="post-metadata">

**Author:** ![Patrick\_85](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/patrick_85/32/138056_2.png) [@Patrick\_85](https://community.homey.app/u/Patrick_85)\
**Post date:** [January 4, 2024, 9:15am UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/39 "2024-01-04T09:15:19Z")

</div>

Thanks baldhor, dont know why but i can see it again. dint change anything or anything else but happy again 😛

---

<div class="post-metadata">

**Author:** ![Michiel\_M](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/michiel_m/32/67732_2.png) [@Michiel\_M](https://community.homey.app/u/Michiel_M)\
**Post date:** [January 17, 2024, 8:11pm UTC](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271/40 "2024-01-17T20:11:47Z")

</div>

@Baldhor first off kudo’s for starting this ESP app and efforts you put in! 👏 Great extension which opens homey up to a lot more capabilities.

I used ESP on SmartThings and want to migrate this to Homey (pro 2019). I would like to connect some air quality sensors and control a servo with PWM.

Please don’t take mind me asking; what is the advantage or difference with ESP Easy app? I see this one has not been updated since 2022 and not yet been ported to the new homey pro, but it does have support for a lot of devices. [ESP Easy App voor Homey | Homey](https://homey.app/nl-nl/app/nl.joolee.homey.espeasy/ESP-Easy/)

[Previous page](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271.md?page=1)

[Next page](https://community.homey.app/t/app-pro-esphome-control-your-esp8266-esp32-by-simple-configuration-files/87271.md?page=3)
