# \[APP\]\[PRO\] MySQL-Client

**URL:** <https://community.homey.app/t/app-pro-mysql-client/62459>\
**Category:** Apps\
**Tags:** app, tools, homey-pro\
**Created:** [April 7, 2022, 7:18pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459 "2022-04-07T19:18:16Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [May 15, 2022, 10:59am UTC](https://community.homey.app/t/app-pro-mysql-client/62459/41 "2022-05-15T10:59:05Z")

</div>

That’s right. For insights exports, influx or mqtt with liva data would be a good choice.  
But that’s not the use case for this app. It’s a generic client to read/write your MySQL database.

I use it for hourly/daily logging of my energy consumption. There I want fixed times to log. Anf you can insert it in your flows in an easy way - including reading values in conditions.  
So it depends on the kind of data and what you would like to achieve.

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [July 3, 2022, 7:36pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/42 "2022-07-03T19:36:48Z")

</div>

With test version 0.0.11, flow tokens for **Advanced Flows** are added for the **flow action “Execute SQL query”**.  
Using these tokens, you can directly use the SQL result in your flow. With the new logic cards you canparse the reault JSON string and extract more than only the first field.

Example:

 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/2/721ca60dfc8962a3f5d889b6ff44ba97fa7ea340.png)

This flow is:

- executing the SELECT statement, reading one line from the table
- printing the result JSON string to the timeline
- extracting line1, field “gas\_meter” from the JSON
- printing this value to the timeline

 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/a/6a9285f54f585cbed1b5423ff39f3148100f8ea3.png)

Current test version:

> **[MySQL](https://homey.app/en-us/app/de.ronnywinkler.mysql/MySQL/)**
>
> Access your MySQL database from Homey

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [July 3, 2022, 8:28pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/43 "2022-07-03T20:28:46Z")

</div>

A small addition in test version 0.0.12: Exception handling for Advanced FLows.  
The error is printed into the timeline as before.  
In addition you can directly react on SQL error in the flow now, perhaps send a push message to react in time.

 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/5/e5d0dfbf57958a627b3992ec5de91b97fcf0b3d9.png)

---

<div class="post-metadata">

**Author:** ![Henkhi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henkhi/32/8486_2.png) [@Henkhi](https://community.homey.app/u/Henkhi)\
**Post date:** [August 7, 2022, 3:09pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/44 "2022-08-07T15:09:55Z")

</div>

Although not a complete newby, I keep struggling to use the THAN card.  
After loading the App, configuring a device (connection tested succesfull) the If and AND cards are popping up but the THEN card won’t show:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/0/1003a372b5661b414e9ae38352b4e453d1515d77.png)

I already deleted the app and reinstalled it. I did a PTP but no changes.  
Funny thing is that IF en AND cards are fine, it is only the THEN card is reluctant.  
Any suggestion is highly appreciated

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 7, 2022, 3:26pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/45 "2022-08-07T15:26:38Z")

</div>

You are right. The card doesn’t appear in standard flows anymore. I just extended it with the result token for advanced flowsnto get the result directly.  
I have to ask Athom if that’s the wished behavior. In the meantime you can use the card in an advanced flow - I hope you ordered it.

---

<div class="post-metadata">

**Author:** ![Henkhi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henkhi/32/8486_2.png) [@Henkhi](https://community.homey.app/u/Henkhi)\
**Post date:** [August 7, 2022, 3:58pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/46 "2022-08-07T15:58:33Z")

</div>

Aha, it explains why it acts (not) as it does.  
I did not ordered Advanced Flows (yet) as standard flows did the every job for me so far.  
I understand that additional functionality is only available in the newer versions but it is a pity that new functions apparently break the standard functionality.  
Thanks any way for your reply and maybe you can report this as a bug to Athom

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 7, 2022, 4:22pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/47 "2022-08-07T16:22:17Z")

</div>

I didn’t expect this behaviour. I will check and fix it.  
But advanced flow will make creating flows easier. Especially this one. With AdvFlow you can execute the SQL and check the result directly. With standard flow you have to execute the SQL and check the result via a new When card (the trigger). You can see the difference in the screenshots above.

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 13, 2022, 10:06am UTC](https://community.homey.app/t/app-pro-mysql-client/62459/48 "2022-08-13T10:06:14Z")

</div>

New test version 0.0.15:

> **[MySQL](https://homey.app/en-us/app/de.ronnywinkler.mysql/MySQL/)**
>
> Access your MySQL database from Homey

Athom decided to hide all flow action with existing result tokens (for use in Advanced Flows) in standard flows. The flow action in this app was implemented to be used in both versions. But now I had to add a second (identical) flow action for standard flows.

So standard flow will now show this action card again.  
In AdvancedFlows, two identical action cards are shown.

- One without result token to use in combination with the corresponding flow trigger (SQL statement was executed)
- One with result tags for use in AdvancedFlows with directly added further actions.

 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/b/1b2f8a4ac7fa02e61b5081e3774929b905eb1011.png)  
1st one with result token, 2nd one without.

In standard flows you will only see one action card:

 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/2/228b43e859f594b395de43b53d109c605163d3fc.png)

@Henkhi : You can install the test version and check if it’s ok now. The stable version will be available after approval by Athom (next week)

---

<div class="post-metadata">

**Author:** ![Henkhi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henkhi/32/8486_2.png) [@Henkhi](https://community.homey.app/u/Henkhi)\
**Post date:** [August 13, 2022, 1:16pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/49 "2022-08-13T13:16:14Z")

</div>

@RonnyW : update works as a charm, Thanks

---

<div class="post-metadata">

**Author:** ![Soap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/soap/32/33981_2.png) [@Soap](https://community.homey.app/u/Soap)\
**Post date:** [August 14, 2022, 6:57pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/50 "2022-08-14T18:57:25Z")

</div>

This was very useful. THANKS!!  
Now I can retire one of my virtual machines that otherwise did som magic towards my SQLserver.

I also have an old application using MSACCESS (not my choice and I can’t migrate it to SQL).  
Is it too much work to create a MSACCESS connector?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 14, 2022, 8:38pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/51 "2022-08-14T20:38:35Z")

</div>

Hi,  
I haven’t found a possible MSACCESS connector.  
For direct access to the database files, you need a access driver installed. So that’s only possible for applications in a windows environment.  
For access your DB vie ODBC, you need a NodeJS package and Unix binaried (driver) installed on Homey.  
So there is no possible way I can see at the moment.  
I haven’t found a way to connect to MSAccess using MySQL. I only found a way to access MySQL database from MSAccess via ODBC. So I think, the only way would be a connection using ODBC. But this swill need a standalone NodeJS package without forther requirements. But I haven’t found such a package.

Is your application directly using a MSAccess DB? Or is MSAccess only needed for the dialog and macros? Perhaps you can migrate the DB to MySQL and connect from the application to the DB via ODBC. So you can use the Access frontend with a MySQL DB as backend.  
[https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-examples-tools-with-access-linked-tables.html](https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-examples-tools-with-access-linked-tables.html)  
Just a thought, but I don’t think such an Access application can easily be splitted.

---

<div class="post-metadata">

**Author:** ![Soap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/soap/32/33981_2.png) [@Soap](https://community.homey.app/u/Soap)\
**Post date:** [August 15, 2022, 9:32am UTC](https://community.homey.app/t/app-pro-mysql-client/62459/52 "2022-08-15T09:32:47Z")

</div>

Thanks.  
the application is only using ACCESS database. I would much rather prefer it using MySQL.  
I have tried for years to get it connected to MySQL but to no avail. ( the option is there in the application settings, but it wont work.)

---

<div class="post-metadata">

**Author:** ![Soap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/soap/32/33981_2.png) [@Soap](https://community.homey.app/u/Soap)\
**Post date:** [August 15, 2022, 12:40pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/53 "2022-08-15T12:40:30Z")

</div>

I just came up with a dirty solution. replicate entire mdb to mysql - I dont mind if it´s one way replication to mysql, I just want homey to be able to get data from it.  
In fact I dont need the entire DB, i only need 3 columns…  
I will try this approach and see if I can get it working. 🙂

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [August 15, 2022, 12:52pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/54 "2022-08-15T12:52:18Z")

</div>

I think its a DB export, so one way. If you need only historical data, it’s a solution. Perhaps you can automate it with an Access macro or batch file. Depends in your used tool.

---

<div class="post-metadata">

**Author:** ![Soap](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/soap/32/33981_2.png) [@Soap](https://community.homey.app/u/Soap)\
**Post date:** [August 16, 2022, 7:02pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/55 "2022-08-16T19:02:02Z")

</div>

I created a new DB on mySQL, on the MSaccess database server I created a script to upload selected colums to the SQL server. The script runs once a minute so I get a little bit of a delay, but I can live with that.

---

<div class="post-metadata">

**Author:** ![Bert\_Wissink](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bert_wissink/32/30075_2.png) [@Bert\_Wissink](https://community.homey.app/u/Bert_Wissink)\
**Post date:** [November 17, 2022, 6:59pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/56 "2022-11-17T18:59:51Z")

</div>

Nice App, Ronny! Got it working fairly easy.  
A question: is there any way to use this via Homeyscript?

---

<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 17, 2022, 8:00pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/57 "2022-11-17T20:00:21Z")

</div>

When you run the …list.js script, all your available And & Then flowcards will be shown (takes quite a while before it has finished!)  
The …run.js script shows how to use them  
 ![Screenshot from 2022-11-17 20-57-56](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/4/340e1d05ccc8a71a96dbc347676af14584bbecb4.png)

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [November 17, 2022, 9:13pm UTC](https://community.homey.app/t/app-pro-mysql-client/62459/58 "2022-11-17T21:13:52Z")

</div>

What do you want to do in HomeyScript in addition to flow actions?  
I think it’s easier to start a SQL query as a flow action in AdvancedFlow and read the result using the JSON logic cards. Or take the SQL result as token and use this as parameter for HomeyScript to extract JSON attributes in JomeyScript.

---

<div class="post-metadata">

**Author:** ![Bert\_Wissink](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bert_wissink/32/30075_2.png) [@Bert\_Wissink](https://community.homey.app/u/Bert_Wissink)\
**Post date:** [November 18, 2022, 8:05am UTC](https://community.homey.app/t/app-pro-mysql-client/62459/59 "2022-11-18T08:05:09Z")

</div>

Thanks Peter, very insightful, I will try this out!

---

<div class="post-metadata">

**Author:** ![Bert\_Wissink](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bert_wissink/32/30075_2.png) [@Bert\_Wissink](https://community.homey.app/u/Bert_Wissink)\
**Post date:** [November 18, 2022, 8:06am UTC](https://community.homey.app/t/app-pro-mysql-client/62459/60 "2022-11-18T08:06:50Z")

</div>

Hi Ronny,  
I want to make it dynamic by looping through all my PBTH devices, selecting their energy consumption and costs, and store that in a SQL database. I think the hint from Peter will get me there.  
Thanks!

[Previous page](https://community.homey.app/t/app-pro-mysql-client/62459.md?page=2)

[Next page](https://community.homey.app/t/app-pro-mysql-client/62459.md?page=4)
