Giter Site home page Giter Site logo

Comments (4)

philipabbey avatar philipabbey commented on September 12, 2024

There's been a previous post requesting something similar here: https://community.home-assistant.io/t/home-assistant-app-for-garmin/637348/20, perhaps worth using the HA forum to home in more precisely on what might be involved? Then post a firm proposal here.

E.g. what's the JSON format look like? How closely does that map to HA YAML fields?

from garminhomeassistant.

philipabbey avatar philipabbey commented on September 12, 2024

Current thinking is that we can offer a very basic status display for anything as short text. That potentially means that the JSON configuration supplies some code that is sent to the server for evaluation in a template, the response must be text, or more precisely text wrapped in JSON ( e.g. {status: "cover off"}) for the makeWebRequest() Connect IQ call. We would then use a menu item with text & sub-text to display the result on the second row.

This keeps the complexity in the JSON and on the server, and the watch implementation simple if limited.

If a toggle menu item needs to display alternative text (cover on/off), then we could (finally) implement a mapping from on/off to text from a definition in the JSON, so that no second API status update is required. This is important because each additional status update reduces the responsiveness of the menu to external changes (from outside of the watch app).

from garminhomeassistant.

JosephAbbey avatar JosephAbbey commented on September 12, 2024

This would mean that you can render a temperature with "{{ states('sensor.my_temperature') }}°C" or a battery as "{{ states('sensor.my_battery_level') }}%".

I have been having some fun with the android version of this feature here.

from garminhomeassistant.

JosephAbbey avatar JosephAbbey commented on September 12, 2024

Docs

POST to

https://<homeassistant>/api/template

with

{
    "template": "Paulus is at {{ states('device_tracker.paulus') }}!"
}

Returns the rendered template in plain text.

Paulus is at work!

Sample curl command:

curl -s -X POST \
  -H "Authorization: Bearer ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"template": "It is {{ now() }}!"}' ${URL}/template

Response:

It is 2024-01-12 18:48:40.429751+00:00!

from garminhomeassistant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.