# Homeyduino @ V2.0

**URL:** <https://community.homey.app/t/homeyduino-v2-0/6407>\
**Category:** Apps\
**Created:** [January 6, 2019, 6:08pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407 "2019-01-06T18:08:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [January 6, 2019, 6:08pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/1 "2019-01-06T18:08:53Z")

</div>

As i heared that homeyduino is no longer supported at version 2.0 what is the best other choise tot communicate with a ESP8266.  
Because my House is full with them and I am happy with how it is now working.  
I want to keep al traffic local so if the internet is down it still can work.

---

<div class="post-metadata">

**Author:** ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)\
**Post date:** [January 6, 2019, 6:57pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/2 "2019-01-06T18:57:00Z")

</div>

That’s too bad. I’m also running a couple of ESP8266 devices with homeyduino. Have you taken a look at the [MQTT Broker app](https://apps.athom.com/app/nl.scanno.mqttbroker)?

---

<div class="post-metadata">

**Author:** ![Rocodamelshekima](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rocodamelshekima/32/8209_2.png) [@Rocodamelshekima](https://community.homey.app/u/Rocodamelshekima)\
**Post date:** [January 6, 2019, 7:22pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/3 "2019-01-06T19:22:09Z")

</div>

Maybe check [this post](https://community.homey.app/t/arduino-homeduino-met-esp8266-aansturen-pinnen-op-arduino/6265)?

---

<div class="post-metadata">

**Author:** ![bvdbos](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bvdbos/32/2352_2.png) [@bvdbos](https://community.homey.app/u/bvdbos)\
**Post date:** [January 6, 2019, 7:33pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/4 "2019-01-06T19:33:49Z")

</div>

Did you file a request at [https://support.athom.com/hc/nl/requests/new](https://support.athom.com/hc/nl/requests/new) so Athom knows more people want this?

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [January 6, 2019, 7:40pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/5 "2019-01-06T19:40:09Z")

</div>

Yes it is! Buy isn’t mqtt working on a external server so you always need internet?

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [January 6, 2019, 7:41pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/6 "2019-01-06T19:41:03Z")

</div>

Good one but needs al lot more programming I see

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [January 6, 2019, 7:41pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/7 "2019-01-06T19:41:52Z")

</div>

Smart will do that 👍🏻

---

<div class="post-metadata">

**Author:** ![bvdbos](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bvdbos/32/2352_2.png) [@bvdbos](https://community.homey.app/u/bvdbos)\
**Post date:** [January 6, 2019, 7:43pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/8 "2019-01-06T19:43:15Z")

</div>

Don’t know 100% sure (@scanno can tell probably) but I think everything needed for mqtt is running on Homey:  
[https://apps.athom.com/search?query=mqtt](https://apps.athom.com/search?query=mqtt)

---

<div class="post-metadata">

**Author:** ![scanno](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/scanno/32/8358_2.png) [@scanno](https://community.homey.app/u/scanno)\
**Post date:** [January 6, 2019, 8:00pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/9 "2019-01-06T20:00:02Z")

</div>

The MQTT Broker app is running on Homey and is a MQTT 3.1.1 compliant server. Are there any specific questions? Wiith the MQTT client app you can create triggerCards that trigger when a message is received on a topic that is given in that triggerCard. You can also send a message on a specific topic.

When using the broker and client, all can operate on locathost.

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [January 7, 2019, 7:28am UTC](https://community.homey.app/t/homeyduino-v2-0/6407/10 "2019-01-07T07:28:10Z")

</div>

Oke have been looking in to the MQTT and it looks good, need more programming but not much.  
Is there some example of sending a value from the ESP or to?

---

<div class="post-metadata">

**Author:** ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)\
**Post date:** [January 7, 2019, 4:28pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/11 "2019-01-07T16:28:33Z")

</div>

I recently converted a Homeyduino project to MQTT and a VirtualDevice. It was rather easy!

For you arduino project you can take a look at [PubSubClient](https://github.com/knolleary/pubsubclient)

Below you can take a excerpt of my code:

```
const char *mqttServer = "192.168.1.61";
const int mqttPort = 8883;
const char *mqttUser = "test";
const char *mqttPassword = "uno";

WiFiClientSecure espClient;
PubSubClient client(espClient);    
const char *motion_topic = "home/hallway/pir/motion";
const char *luminance_topic = "home/hallway/pir/luminance";

```

// after connecting to your wifi don’t forget to connect to the MQTT Server

```
if (!client.connected()) {
    client.setServer(mqttServer, mqttPort);
    client.setCallback(callback);
    Serial.print("Connecting to MQTT server "); Serial.print(mqttServer);
    while (!client.connected()) {
      if (client.connect(clientId.c_str(), mqttUser, mqttPassword ))
      {
        Serial.println("\tconnected");
      } else {
        delay(500);
        Serial.print(".");
      }
    }
  }

```

// After reading some sensor values publish the values

```
float lux = lightMeter.readLightLevel();
client.publish(luminance_topic, String(lux).c_str(), true);
client.publish(motion_topic, motionDetected ? "1": "0", true);

```

Then subscribe to topic and set Virtual Device capability

 ![PNG](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/d/dec37136d6d4d2fbda292efd96e6990abfc057eb.jpeg)  
 ![PNG](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/4/45c2dc8fcd085e4deab3d1e88315e91166060f4a.jpeg)

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [January 7, 2019, 5:08pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/12 "2019-01-07T17:08:56Z")

</div>

Nice, will check it to night

---

<div class="post-metadata">

**Author:** ![dewenni](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dewenni/32/7912_2.png) [@dewenni](https://community.homey.app/u/dewenni)\
**Post date:** [January 7, 2019, 6:25pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/13 "2019-01-07T18:25:25Z")

</div>

I wrote already in an other topic, that I got the answer from Atom Support, that they will not support Homeyduino in the future:

> The developers respond me that they do not support the Homeyduino app. I am sorry for the inconvenience, we will adjust the website so that this is clear in the future.

I answered that this is a bit confusing, because the Homeyduino app was developed by Athom. Afterwards I got a new answer:

> What is meant with this is that we cannot give support on user-made projects with this app. If these do not work, it is often not because of the app or Homey, but because of the user’s code. I hope that you understand this decision.  
> In this case however, there appears to be a problem with our software and developers are looking into the issue, in order to solve it with a future update.

So they will support the app also in the future. That they can not support the applications that run on Arduino is clear. But the basic API should work and should also be supported.

---

<div class="post-metadata">

**Author:** ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)\
**Post date:** [January 7, 2019, 6:37pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/14 "2019-01-07T18:37:31Z")

</div>

I did a small alteration to the flows after having some issues with two topics. It is even simpler now.

 ![PNG](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/a/a3d169a9b3a29d5c988f9e8c1cee95f9eda606b2.jpeg) ![PNG](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/3/35215de9ab13583bd5c7d671d7e18bb223ef59c8.jpeg)

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [January 7, 2019, 8:04pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/15 "2019-01-07T20:04:44Z")

</div>

So it looks like they will be giving support to the app, happy me😁  
But just te be sure and to have some fun will try to make a version with MQTT

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [January 7, 2019, 8:05pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/16 "2019-01-07T20:05:54Z")

</div>

And what about sending data to the Arduino?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 7, 2019, 8:14pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/17 "2019-01-07T20:14:09Z")

</div>

> [@dewenni](#):
>
> If these do not work, it is often not because of the app or Homey, but because of the user’s code.

So it’s the fault of _your_ code that the iOS app crashed 😂

---

<div class="post-metadata">

**Author:** ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)\
**Post date:** [January 7, 2019, 8:56pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/18 "2019-01-07T20:56:39Z")

</div>

You need to define a callback function before connecting to your broker using the setCallback(callback) method. After connecting to the broker subscribe to a topic using the subscribe method. For an example take a look [here](https://techtutorialsx.com/2017/04/24/esp32-subscribing-to-mqtt-topic/)

---

<div class="post-metadata">

**Author:** ![Slof](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/slof/32/1318_2.png) [@Slof](https://community.homey.app/u/Slof)\
**Post date:** [January 7, 2019, 10:50pm UTC](https://community.homey.app/t/homeyduino-v2-0/6407/19 "2019-01-07T22:50:17Z")

</div>

@Marlon Oke I did some testing, but I don’t think I have set the settings of the app correct.  
Can you also post some screenshot’s of you’re settings?

Thanks

---

<div class="post-metadata">

**Author:** ![Marlon](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marlon/32/3794_2.png) [@Marlon](https://community.homey.app/u/Marlon)\
**Post date:** [January 8, 2019, 4:56am UTC](https://community.homey.app/t/homeyduino-v2-0/6407/20 "2019-01-08T04:56:38Z")

</div>

Configure your MQTT Broker

 ![MQTT%20Broker%20settings](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/4/445bdd7d3c4dd952e9ddaeac27bd95ff718b3aaf.png)

Configure the MQTT Client

 ![MQTT%20Client%20settings](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/1/1127c841cc707e3850c561aab1a0e304bffa8029.png)

For testing I used MQTTBox since I’m running on windows. This is optional of course.

Configure the client

 ![MQTTBox%20Subscribe](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/0/046d675d026da371c26bdb85e5f98c7c8bbe35a6.png)

Subscribe to the topic

 ![MQTTBox%20Subscribe%20to%20topic](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/a/af9616d7f97520813999960aa787e772797cb08f.png)  
Afterwards you should see your sensor events

 ![MQTTBox%20Subscribe%20to%20topic%20events](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/9/95c04d5d333eb22691f3266cf3ffa08a60242cbe.png)

Good luck! 🍻

[Next page](https://community.homey.app/t/homeyduino-v2-0/6407.md?page=2)
