Can you define a Gauge complication to not start with 0?

I’m trying to do some gauge complications for the Apple Watch. I’d like to do a gauge but I’m not sure how to make one that doesn’t start with 0. Right now my gauge code is

{{ states("sensor.dc_voltage") | float / 29 }}

I’m trying to define my gauge range as 25 - 29 and the sensor result should fall in that. The problem is even if the Voltage was 25 that’s still 86% of 29 and it shows the bar nearly full. So is it possible to create a gauge for a limited range and have the result show correctly? Do I need to figure out how to convert my range to 100 and then apply that same to the result?

Simple answer, yes.

You could easily make it a percent, which might be more useful.
Not having all the information below seems like what you are really wanting.

{{ ((states("sensor.dc_voltage") | float) -25 ) / 29 }}

Or, you can use a custom bar graph and set the min max (you stated bar).
Or you can use a canvas gauge.
Are you trying to display this on the watch? or get voltage from the watch?
bar

type: 'custom:auto-entities'
sort:
  method: entity_id
  numeric: true
card:
  type: 'custom:bar-card'
  severity:
    - color: '#0513eb'
      from: '0'
      to: '30'
    - color: '#34bdeb'
      from: '30.1'
      to: '50'
    - color: '#68c843'
      from: '50.1'
      to: '55'
    - color: '#68aa43'
      from: '55.1'
      to: '60'
    - color: '#ffff55'
      from: '60.1'
      to: '65'
    - color: '#ef8533'
      from: '65.1'
      to: '70'
    - color: '#ea3324'
      from: '70.1'
      to: '75'
    - color: '#8c1a4b'
      from: '75.1'
      to: '80'
    - color: '#731425'
      from: '80.1'
      to: '100'
  min: '0'
  max: '100'
  icon: ''
  decimal: 1
  height: 16
  positions:
    value: inside
    indicator: outside
    icon: 'off'
    name: inside
    minmax: 'off'
  show_header_toggle: false
  title: ''
show_empty: false
filter:
  include:
    - entity_id: '*dewpoint*'
  exclude:
    - entity_id: '*description*'

AQI

type: 'custom:canvas-gauge-card'
card_height: 300
entity: sensor.purpleair_aqi_a
name: ''
gauge:
  type: radial-gauge
  title: AQI
  width: 300
  height: 300
  minValue: 0
  maxValue: 500
  startAngle: 40
  ticksAngle: 280
  valueBox: true
  majorTicks:
    - '0'
    - '50'
    - '100'
    - '150'
    - '200'
    - '250'
    - '300'
    - '350'
    - '400'
    - '450'
    - '500'
  minorTicks: 10
  strokeTicks: true
  highlights:
    - from: 0
      to: 50
      color: 'rgba(104, 225, 67, .75)'
    - from: 50
      to: 100
      color: 'rgba(255, 255, 85, .75)'
    - from: 100
      to: 150
      color: 'rgba(239, 133, 51, .75)'
    - from: 150
      to: 200
      color: 'rgba(234, 51, 36, .75)'
    - from: 200
      to: 300
      color: 'rgba(140, 26, 75, .75)'
    - from: 300
      to: 500
      color: 'rgba(115, 20, 37, .75)'
  borders: 'no'
  needleType: arrow
  needleWidth: 4
  needleCircleSize: 7
  needleCircleOuter: true
  needleCircleInner: false
  animationDuration: 1500
  animationRule: linear
  valueBoxBorderRadius: 10
  colorValueBoxRect: '#222'
  colorValueBoxRectEnd: '#333'
  valueDec: 0
  valueInt: 0

How would I do this for a temperature range? The following gives a negative result for me (-0,666667):

{{ ((states("states.sensor.ironing_room_temperature") | float) -16 ) / 24 }}

I would like the temperature range to be between 16 and 24.

{% set original = states("states.sensor.ironing_room_temperature") | float %}
{% set minimum = 16.0 %}
{% set maximum = 24.0 %}
{% set constrained_original = [maximum, [minimum, original] | max] | min %}
{{ (constrained_original - minimum) / (maximum - minimum) }}
1 Like

Hmm, the preview output unfortunately still returns “0”, even though the sensor value is around 19.

It works, thank you! For some reason the watch needs some time to ‘save’(?) what’s entered in the input field. Works like a charm!