Ideas wanted: Homey Logic Value as widget in Android

I’m looking for a way to display a Homey Logic Value on my Android phone as a widget.

I want to be able to see my Shelly Power Usage from a specific period of time. (I use a Shelly 3EM for power measuring)

Currently I have a flow that is sending me push notifications every day, week and month, with a summery of the power usage of my electric car charger.

I have to calculate the values, and I do so with the Homey Logic App, on which the values get stored. I now recall the stored values and display them in a push notification.

I’m looking for a way to be able to show the live (or last hour) values on my android phone. So I need a widget app that can show values, and I need a way to send the values from the Homey to that widget app.

Does anyone have a suggestion on how to accomplish that?

Ps… I already have an iPad running with a NodeRED dashboard, but that’s nog what I’m looking for. It must be a widget on my android phone.

Not exactly what you’d want, but I use Virtual thermometers to show a variables’ contents.
Adding it to the first three favorite devices, gives an instant view when you open the app.

Flow cards suppose to display the used variables instead of ?:

Maybe this can help: [How To] Setup two-way communication between Homey and Android smartphone

@Peter_Kawa
Thanks for the idea, but not really what I’m looking for.

@Joenoo
Thanks, I was already looking into a solution with webhooks myself. I few years ago I already experimented somewhat with Tasker, but it never gave me the results I was looking for.
And with this option I still need a way to implement the data into a widget,

I might have found a working solution, but with my lack of programming knowledge I currently don’t know if I will get this to work.

I have 3 problems to solve.
A) Get the data out of Homey
B) Create a platform store/process the data
C) Create a widget to show that data

C) I have a solution for this on my Android phone with an App: WebSnap.
There are several apps available that do exactly the same.

  • With this app I can create a crop image of a particular website and update the image every hour.
  • I can create one or more widgets from these images
  • I can create a Google Spreadsheet with the data I want to see (linked from another page). I can even create multiple pages with graphs and pie charts, create a cool layout and make the spreadsheet available for everyone (so login is not required and WebSnap can access the page).

B) I use Google Spreadsheets to store and process the Homey data

  • In google Spreadsheet you can create scipts that can be deployed as an online app
  • You can grant these scripts access to your google spreadsheet file without loging in
  • This script can receive data from webhooks (still figuring out how).
    See here for a short tutorial on how to create the Google Spreadsheet App Script

A) I need to use webhooks to send data to the Google Spreadsheet App Script

  • I must be able to send data from a logic value within a flow, using the Logic HTTP Post for this

This looks like a solution to me :slight_smile:

Only still could use some help with webhooks sending from Homey and implementing in the Spreadheet App Script.

I made this spreadsheet for my example.

SpreadsheetExample

And I use this code into my Google Spreadsheet App Script

function doGet(e) {
var ss = SpreadsheetApp.getActive();
var rng = ss.getActiveSheet().getRange(2, 1, 10, 3)
var vals = rng.getValues()
Logger.log(vals)
return ContentService.createTextOutput(JSON.stringify(vals)).setMimeType(ContentService.MimeType.JSON);
}
function doPost(e) {
return HtmlService.createHtmlOutput(“post request received”);
}

This returns this output onto the google webhook HTML page.

[[1000,“Zon”,“2022-01-03T23:00:00.000Z”],[3000,“Auto”,“2022-01-03T23:00:00.000Z”],[5000,“HuisVerbruik”,“2022-01-03T23:00:00.000Z”],[2000,“HuisTerug”,“2022-01-03T23:00:00.000Z”]]

The next step in the tutorial that I’ve followed now says to implement this code to be able to receive changes.

function currentTime() {
var d = new Date();
var currentTime = d.toLocaleTimeString()
return currentTime;
}
function CELL_CHANGED(row) {
var options = {
'method' : 'post',
'payload’ : JSON.stringify(row)
};

UrlFetchApp.fetch('http://requestbin.net/r/1hqonni1', options);
return "UpdatedAt: "+ currentTime()
}

This code gives a syntax error in the google script editor. Don’t know what triggers this.
Could anyone help me with this part of the code to be able to receive webhook input from my Homey?

The next step is to create the webhook.
Can anyone tell me how my flow should look like in orde to be able to send the webhook to the Google Script App?

Many thanks in advance!

Did you finish this project?
Do you think you could also set a variable in this or a similar way?