Widget Examples

Ist ein Forum nicht für sowas gemacht das man jemanden hilft wenn man nicht weiter kommt

I hate being the guy that asks this but has there been a widget made for seeing the latest tweets by specific twitter accounts?

Doppelte Kommata etc. sind mE kein Fall für Hilfe durch andere, sondern für Selbststudium. Und wer soll

[quote=“Hans-Dieter_Schuster, post:545, topic:7994”]
ich habe noch eins da kommt mir auch immer Fehler des ist ein schönes Wetter widget[/quote]
zum einen verstehen und zum anderen beantworten?

I created a widget showing information about your data usage.
It only works for German Telekom contracts because it uses the Telekom API.
You can get it here.

If you are interested in creating your own widget with the telekom data, you can use my Telekom-module in your projects. The module itself and instructions on how to use it can be found here.

2 Likes

I’m sorry I don’t speak German, and it looks like @Stefan75K helped with your initial issue. Regarding the error you’re getting, from the code you pasted in it looks like there are some extra characters out of place (colum,) that may be causing the issue. Were you able to work it out?

Hello,

has anyone time to write me a simple script?
I only want to show the diesel price from this page:

That looks awesome. I didn‘t ever consider doing something like that, but I might look into it now.
Will have to check out if Congstar or Vodafone offer a similar API.

Is it just me, or are the ‚here‘ links just red text? I am not able to click them.

1 Like

Thank you very much!!
I thing Congstar should work with the Telekom API too. I just didn’t mention it.

The red text should be links. But it seems like they don’t work.
Well here is the link:

1 Like

Hi Pih!
Oh, My gosh…
I see the cat clock in your Screen!
I‘m in Love… i have 4.cats…:heart_eyes_cat:
I would like to ask you of it’s possible to get the Script pretty please? Would Love this so much!
Thank you so much in advance

@simonbs Hi,I have a q,why does this error occur? runsInWidget

1 Like

Hi Fellbande,
I’m sorry to tell you that the cat clock comes from another app called ‘火萤’, you can customize the dial style and background.What I can share is only the pic of the lovely cat.

1 Like

The link of the app:

1 Like

Hi Pih!
Thank you, Thank you sooooooo much,for the cat and the App!
I get it!:heart_eyes_cat:
You made My Day!
Thank you so much for your help!:+1:t2:

I am so happy it helps.

1 Like

A hint: there is an API which gives you the real time prices of all Gas stations (in Germany) by location and type of fuel:

1 Like

Based on a widget I found here:(Covid incidence by location):

If you add the parameter

diesel@50.5525979, 9.7259095

The widget shows the current price. If no parameter is given, the current location is used and e5 is shown.

And I woul ask you to get your own api-Key at tankerkönig, it is free.

I am no JS pro and the script is not bullet proof and I do not know how to post a script properly. But it does what you want:


const apiURL = (location,fuel) =>
`https://creativecommons.tankerkoenig.de/json/list.php?lat=${location.latitude.toFixed(3)}&lng=${location.longitude.toFixed(3)}&rad=1&sort=price&type=${fuel}&apikey=c5e49ed8-d412-d598-7f86-e87609a12d6e`

console.log(apiURL)

let widget = await createWidget()
if (!config.runsInWidget) {
  await widget.presentSmall()
}
Script.setWidget(widget)
Script.complete()

async function createWidget(items) {
  let location
  if(args.widgetParameter) {
    
    arg1=args.widgetParameter.split("@")
    console.log(arg1)
    const fixedCoordinates =   arg1[1].split(",").map(parseFloat)
    location = {
      latitude: fixedCoordinates[0],
      longitude: fixedCoordinates[1]
    }
    fuel=arg1[0]
  } else {
    location = await Location.current()
    fuel="e5"
  }

  const data = await new Request(apiURL(location,'e5')).loadJSON()
  if(!data) {
    const errorList = new ListWidget()
    errorList.addText("Keine Ergebnisse für den aktuellen Ort gefunden.")
    return errorList
  }
  console.log(data)
  const attr = data.stations[0]
  incidence=attr.price
  const list = new ListWidget()
  if(Device.isUsingDarkAppearance()){
    const gradient = new LinearGradient()
    gradient.locations = [0, 1]
    gradient.colors = [
      new Color("111111"),
      new Color("222222")
    ]
    list.backgroundGradient = gradient
  }
  const header = list.addText("⛽️"+" "+fuel.toUpperCase())
  header.font = Font.mediumSystemFont(13)
  list.addSpacer()
  const label = list.addText(incidence+"€")
  label.font = Font.boldSystemFont(24)
  list.addText(attr.street)
  return list
}

3 posts were split to a new topic: German Fuel Station Prices

Hi, could you help me?

Isn’t this an exact duplicate of the post in the following topic?

Have you read the information I posted there the other day about what that error message means and details of the documentation you need to look at?

Simply add:

let widget = await createWidget()

before the Format the Widget comment and may be at the end:

Script.setWidget(widget)
Script.complete()