Skip to content

Rearchitect of integration, fix of multiple issues and many improvements#178

Merged
dinki merged 3 commits intodinki:devfrom
msp1974:rearchitect
Oct 14, 2025
Merged

Rearchitect of integration, fix of multiple issues and many improvements#178
dinki merged 3 commits intodinki:devfrom
msp1974:rearchitect

Conversation

@msp1974
Copy link
Copy Markdown
Contributor

@msp1974 msp1974 commented Oct 12, 2025

In this PR

Further Info

On screen overlay for unregistered devices

For devices that do not have their display ID utilised in a VA instance (will not show on mimic device), the below overlay will show on any view in the View Assist dashboard. It will not show on other dashboards or views. If any of the core HACs resources (card-mod, layout-card and button-card) are not installed, this will be highlighted in red. If all ok, it will be noted in green.
image
image

ValidateRequirements helper function

This new helper function can be utilised in a view (using button-card). You can provide either a single string value or a list of string values to this function.

custom_fields:
  error: >-
    [[[ return
    viewassist.helpers.validateRequirements('test2') ]]]

If the resource is not found in the pages custom elements (meaning it is not installed) then a box will be displayed in the middle of the screen to highlight this missing resource.
image

NOTE: The dashboard needs updating to include the error custom field format as below.

error:
          - position: absolute
          - font-size: 3vw
          - width: 100%
          - text-align: center
          - background-color: var(--error-color)
          - z-index: 3
          - display: flex
          - justify-content: center

Clock Custom Element

A new mode parameter has been added to the clock custom element. Set this parameter to date or time and remove the format parameters to present the date/time in local language and format.

<viewassist-clock server_time=true mode='date'></viewassist-clock>

Navigate Service

A new optional parameter of revert_timeout has been added to the navigate service call. This will override the default timeout to revert the screen if used.

action: view_assist.navigate
data:
  revert_timeout: 10
  device: sensor.lenovo_tsv
  path: view-assist/intent

Timer cards helper function

This is a POC to utilise the JS helper to create dynamic cards for core functions, rather than place this within the card itself or in the dashboard file (as status icons/menu is currently). Whilst it removes the ability for user to tweak these elements, it is expected that they are not really parts that should be user configurable as they are core to making some functions useable.

It is expected that the menu/status icons and the intent objects would follow this method later (in a js file for each one). The generating javascript code is in the timers.js file located in the js_modules directory. Below is the planned timer card to give an overview of how this would be used.

type: custom:button-card
variables:
  timerscardversion: 1.0.0
  var_background: >-
    [[[ try {if (variables.var_assistsat_entity &&
    hass.states[variables.var_assistsat_entity].attributes.mode === "night")
    return ""; else return
    hass.states[variables.var_assistsat_entity].attributes.background} catch
    {return ""}]]]
template:
  - variable_template
  - body_template
styles:
  grid:
    - grid-template-areas: |
        "title status"
        "timers timers"
        "assist assist"
    - grid-template-rows: .5fr 3fr max-content
    - grid-template-columns: 1fr 1fr
  card:
    - background: |-
        [[[ 
          return `center / cover no-repeat url(${variables.var_background})`;
        ]]]
    - background-size: cover
    - background-color: "#24292c"
  custom_fields:
    title:
      - padding: 10px 0
    timers:
      - display: flex
      - justify-self: start
      - padding: 0 5vw
      - z-index: 1
      - font-size: 20vw
      - font-weight: bold
      - color: white
      - max-height: 70vh
      - width: 100%
      - overflow-y: scroll
    shader:
      - position: absolute
      - top: 0
      - height: 100%
      - width: 100%
      - background-color: rgba(0,0,0,0.15)
custom_fields:
  title: Timers & Alarms
  shader: ""
  timers:
    card:
      type: custom:layout-card
      layout_type: custom:vertical-layout
      layout:
        max_cols: 1
      cards: |-
        [[[ 
          return viewassist.helpers.timerCards();
        ]]]

@dinki
Copy link
Copy Markdown
Owner

dinki commented Oct 14, 2025

Wow! What a ton of effort! You are absolutely awesome man

@dinki dinki merged commit 579430b into dinki:dev Oct 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants