This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
MySQL power device
MySQL power device
Today i wrote a little app that can present energy readings and powermeter readings from a SQL database in homey. I use this app to get data from my smart meter and solarpanels to homey.
The app can be found here: https://github.com/rebtor/nl.rebtor.sql
After setting up the connection with the MySQL server homey will poll the server every x seconds for new data.
![Image: https://forum.athom.com/uploads/editor/7g/4n5xawnpqf4c.jpg](https://forum.athom.com/uploads/editor/7g/4n5xawnpqf4c.jpg)
![Image: https://forum.athom.com/uploads/editor/rw/06lt2vd6sb7u.jpg](https://forum.athom.com/uploads/editor/rw/06lt2vd6sb7u.jpg)
Or used in a graph.
Today i wrote a little app that can present energy readings and powermeter readings from a SQL database in homey. I use this app to get data from my smart meter and solarpanels to homey.
The app can be found here: https://github.com/rebtor/nl.rebtor.sql
After setting up the connection with the MySQL server homey will poll the server every x seconds for new data.
![Image: https://forum.athom.com/uploads/editor/7g/4n5xawnpqf4c.jpg](https://forum.athom.com/uploads/editor/7g/4n5xawnpqf4c.jpg)
The data will be presented as a device.
![Image: https://forum.athom.com/uploads/editor/rw/06lt2vd6sb7u.jpg](https://forum.athom.com/uploads/editor/rw/06lt2vd6sb7u.jpg)
Or used in a graph.
Comments
In settings you only specify the remote login of the mysql server and the query you do in flow cards.
So make an option to create/update/delete/insert records in a remote mysql database.
Could look something like this Flow card:
IF:
$result = "SELECT myrow FROM MyTable WHERE id='something'"
AND:
$result = x
THEN
do this (activate flow)
of
"UPDATE myrow SET row='new (or cards)' WHERE id ='something'
I think this app could be very usefull if you can use cards with yoru own queries, would be great to use this to log remotely into a db, or use this the sameway as betterlogic but restore it in a (external) mysql db which also can be updated from other devices.
The results can be in plain values or json, this can be used in other flow cards as well!
you will help a lot of Davis lovers to make it possible to connect homey to the Davis
@satbopper Its not that mutch work to add a Weather station sql device. what kind of measurements are you looking for? Just temp, humidity or do you need more? If you let me know i will see if i can put something together later this week.
@B3rt I like that idea i need something like that for my own logging also. The thing is that its not that hard for me to get a value from a database and place it in a value within a virtual homey device. I just haven't done a lot of flow stuf yet and haven't figured out how to put a homey variable(s) within a query that can be defined by a user.
I will look into this for sure (if someone does not beat me to it) but first this child has to be born and things have to calm down a little at work.
I'm planning on having the user select the data which the user would like to export and an action card to do the actual export.
@RobinVanKekem. I'm looking forward tot that.
I tried making a card that could write device parameters tot a database. The SQL part is easy. But building An interface to acces the data is still a challange foto me
If you join the developer channel you can ask questions to most of the major developers.
Yesterday I've implemented your solution for reading the P1 interface. My situation is dat through a RJ11 cable to USB I read out the P1 port on my NAS and send this to a MySQL database (MariaDB). Therefor this works great and I really like this app!
The only two things I miss in this app, which seem to be added quit simply I suppose, are the following:
1. I have a meter with two rates. In my database there is a record with says high or low rate. Is it possible to add this?
2. Is it possible to also add gas for the current meaterreading, without a 'power' value and maybe a different logo?
Besides of the implementation of SDK2 i added support the gasmeter and weather device.
in the query use:
Power device: power and meter
gas device: meter
weather device: temp and humidity
Gas only has a meter value as homey does not support current usage.
Regarding to the Gas meter: This sounds like a decent implementation, since the Gasmeters only sends his meter value twice an hour. The power meter sends the meter and power every 10 seconds.
I've talked to Emile and there wasn't any specific reason for this capability not to be there so he asked me to create an issue for it.
Hope they implement it rather soon.
Ik krijg het niet aan de gang.
Maar aanpassen moet zeker lukken
EDIT:
Gelukt
Power:
Gas:
Bedankt voor de app,
Is het mogelijk dat je bij de power meter intern meerdere tellers maakt?
Laag tarief kwh
hoog tarief kwh
laag tarief teruglevering kwh
hoog tarief kwh
current power usage
Total power usage ( die je dan zelf can configureren met (1+2) - (1+2) of 1+2 als je niet terugleverd.