# MQTT combined with HomeyScript

**URL:** <https://community.homey.app/t/mqtt-combined-with-homeyscript/4004>\
**Category:** Apps\
**Created:** [November 13, 2018, 11:19am UTC](https://community.homey.app/t/mqtt-combined-with-homeyscript/4004 "2018-11-13T11:19:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![HerrieMan](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/herrieman/32/3613_2.png) [@HerrieMan](https://community.homey.app/u/HerrieMan)\
**Post date:** [November 13, 2018, 11:19am UTC](https://community.homey.app/t/mqtt-combined-with-homeyscript/4004/1 "2018-11-13T11:19:40Z")

</div>

Hi,  
Is there any way to trigger and parse MQTT messages directly from HomeyScript ?  
In my house I have several sonoff modules and generic esp8266 modules running with tasmota firmware, which used to be connected to my domoticz server via MQTT. Now I want to connect these to my Homey and I find that to be very clumsy.  
I use the [Sonoff](https://apps.athom.com/app/name.klep.sonoff) app to connect to the sonoff devices, that works okay-ish. But for the generic esp8266 modules with several different sensors connected I use a very clumsy setup based on the [MQTT Client](https://apps.athom.com/app/nl.scanno.mqtt) app triggering a flow and then as action in these flow’s run a Homeyscript to parse the MQTT message.  
Is there any way I can directly subscribe to an MQTT topic from a HomeyScipt and trigger that script directly when an MQTT message arrives to parse it ?  
Another somewhat related question is to have Homeyscript directly create devices to hold e.g. sensor data. Now I manually create variables via the better-logic app, create devices from these variables and have the Homeyscript update these devices based on received MQTT messages. I would very much like to have a simpler setup for this, e.g. directly create variables/devices from the Homeyscript to store and display the received sensor data, can that be done ?

---

<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:** [November 13, 2018, 1:42pm UTC](https://community.homey.app/t/mqtt-combined-with-homeyscript/4004/2 "2018-11-13T13:42:54Z")

</div>

I’m working on generic Tasmota module support for the Sonoff app, so at some point in the future you would be able to use that app to connect your devices to Homey. Expect a (beta) release hopefully somewhere in the next week or two.

---

<div class="post-metadata">

**Author:** ![HerrieMan](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/herrieman/32/3613_2.png) [@HerrieMan](https://community.homey.app/u/HerrieMan)\
**Post date:** [November 13, 2018, 6:30pm UTC](https://community.homey.app/t/mqtt-combined-with-homeyscript/4004/3 "2018-11-13T18:30:40Z")

</div>

Hi Robert,  
that would be great, is there any way I can help you with this app ?  
I don’t have a software background, so helping in coding wouldn’t be a good idea, but testing and helping with use-case would be possible.  
For example what I often use are these [Wemos](https://www.banggood.com/nl/WeMos-Elecrow-NodeMCU-32S-Lua-WiFi-ESP32S-Development-Board-WiFi-Bluetooth-p-1175907.html?gmcCountry=NL&currency=EUR&createTmp=1&utm_source=googleshopping&utm_medium=cpc_elc&utm_content=zouzou&utm_campaign=pla-nl-elc2-pc-nl&gclid=CjwKCAiAiarfBRASEiwAw1tYvxgMxHCp47eXgTTJOxv8_Di6oQ0QpQtF1e44h54n5bDX7VEIiNOlphoCCucQAvD_BwE&cur_warehouse=CN) devices, with tasmota firmware and then with e.g. temperature/humidity/pressure/luminance sensors connected. It would be great if these sensor values could be sent to Homey and put in some variable that can be used for other flows, or can be logged via insights.

---

<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:** [November 14, 2018, 8:49am UTC](https://community.homey.app/t/mqtt-combined-with-homeyscript/4004/4 "2018-11-14T08:49:59Z")

</div>

That’s exactly my goal 😄

---

<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:** [November 15, 2018, 4:56am UTC](https://community.homey.app/t/mqtt-combined-with-homeyscript/4004/5 "2018-11-15T04:56:50Z")

</div>

This is exactly what I’m looking for 👍

---

<div class="post-metadata">

**Author:** ![SilverApe](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/silverape/32/12745_2.png) [@SilverApe](https://community.homey.app/u/SilverApe)\
**Post date:** [November 15, 2018, 7:48am UTC](https://community.homey.app/t/mqtt-combined-with-homeyscript/4004/6 "2018-11-15T07:48:54Z")

</div>

Nice @robertklep !

---

<div class="post-metadata">

**Author:** ![HerrieMan](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/herrieman/32/3613_2.png) [@HerrieMan](https://community.homey.app/u/HerrieMan)\
**Post date:** [December 9, 2018, 9:20am UTC](https://community.homey.app/t/mqtt-combined-with-homeyscript/4004/7 "2018-12-09T09:20:52Z")

</div>

Hi Robert,  
few weeks ago you mentioned an app-update in the works, any news on that yet ?  
in the meantime i’ve built myself a few more sensors using tasmota (e.g. energy monitor, humidity, temp, pressure, luminance etc.) and would very much like to connect these to my Homey,  
Also i’ve updated Homey to V2rc2, not yet sure whether or not that was wise to do, but don’t feel like reverting back and losing all my devices.

---

<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:** [December 9, 2018, 11:41am UTC](https://community.homey.app/t/mqtt-combined-with-homeyscript/4004/8 "2018-12-09T11:41:33Z")

</div>

Sorry, no news yet. The code I have to implement to make sensor-support work may not work anymore when moving to V2, so I’m reluctant to spend a lot of time on it for the time being.

---

<div class="post-metadata">

**Author:** ![HerrieMan](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/herrieman/32/3613_2.png) [@HerrieMan](https://community.homey.app/u/HerrieMan)\
**Post date:** [December 9, 2018, 1:49pm UTC](https://community.homey.app/t/mqtt-combined-with-homeyscript/4004/9 "2018-12-09T13:49:28Z")

</div>

Hmm, that’s a pity, I noticed indeed that the sonoff app stopped working when I switched to V2.  
The mqtt client luckily still does work, so I’m currently trying to combine that with homeyscript to still be able to parse the sensor values, but since I don’t have a software background that’s a little difficult road ☹

---

<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:** [December 9, 2018, 2:22pm UTC](https://community.homey.app/t/mqtt-combined-with-homeyscript/4004/10 "2018-12-09T14:22:10Z")

</div>

> [@HerrieMan](#):
>
> I noticed indeed that the sonoff app stopped working when I switched to V2

I’m holding off from installing V2 until (at least) it’s considered to be stable.
