Complications - as in Watch ones

4 comments started 2022-04-24 last 2023-01-28
Home AutomationHome Assistant
A
#1 anglefire

I've managed to get complications onto my iWatch. Not perfect yet as I can't seem to limit the number of decimal places - but it works and can see the kWh solar and solar power - it only updates 4 times an hour, but it was the principle that I wanted more than anything else!

N
#2 NeilTaylor

anglefire I was just about to start trying to do this myself. Would you be open to sharing the code that you have for this?

A
#3 anglefire

NeilTaylor yes of course.

I have a few but the principle is always the same.

This is for a graphic corner. The template is a gauge text.

Leading:

{{states ("sensor.givenergy_pvi_today_kwh")}}kWh

Outer:

{{ states("sensor.givenergy_solar_power")|float|int}}W

Trailing I have blank.

Gauge:

{{ states("sensor.givenergy_battery_soc")|float /100.0|round}}

Style is ring.

This works with faces with corners.
I also have one for a modular face.

The centre text is a standard body template.

Header is titled energy

Body 1

Gas: £{{ '%.2f' | format(states("sensor.gas_cost_today") | float) }}

Body 2

Elec: £{{ '%.2f' | format(states("sensor.electric_cost_today") | float) }} Pwr: {{ states("sensor.givenergy_solar_power")|float | int}}W

Icon is a/b testing.

I then have some circular graphic ones using the open gauge simple text template.

Centre:

{{ states("sensor.givenergy_solar_power")|float(0) /1000.0}} kW

Bottom says kW

Gauge:

{{ states("sensor.givtcp_saxxxxxx_pv_power") | float / 6000 }}

The 6000 is to scale the power to a value between 0 and 1 so it depends on the max expected max power of your solar panels.

I use this one for battery SOC using the appropriate sensor.

Hopefully this makes some sort of sense. It should do if you go into the complication on your phone Homeassistant companion app.

N
#4 NeilTaylor

Thank you!