Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing State Names #32

Open
thebotanists opened this issue Nov 6, 2023 · 5 comments
Open

Changing State Names #32

thebotanists opened this issue Nov 6, 2023 · 5 comments

Comments

@thebotanists
Copy link

I would like to change the state names e.g. 'job_ongoing' to 'Running' or 'Composting' (as I am using this for my Lomi Composter!). It would be nice if this was supported or addl. details added to the readme to illustrate as such.

@Wheemer
Copy link

Wheemer commented Dec 22, 2023

Edit the package file for your appliance and at the bottom you will find a translated state sensor you can uncomment.

@GijsTimmers
Copy link

@Wheemer can you point out where this is exactly? I don't see it

@Wheemer
Copy link

Wheemer commented Oct 7, 2024

At the bottom of the coffee maker package yaml linked here: https://github.com/leofabri/hassio_appliance-status-monitor/blob/release/v3.0.0-dev/home%20assistant/packages/coffee_maker/asm_coffee_maker.yaml

I have changed mine to below, the names of states can be adjusted to your liking here.

`#________________________

* ADDITIONAL FEATURES *

template: # <- IMPORTANT! Remove the [] if you enable any macro

-- MACROS --

OPTIONAL

NAME: State translation macro

INSTRUCTIONS: #16 (comment)

DSCRIPTION: This macro translates each state into something more human-readable.

A sensor is created and available to the user.

The following lines define how each state should be translated:

:

It allows you to customize how each state should be displayed on the UI.

The template below is disabled by default,

if you want to enable it you need to uncomment the lines that will follow (remove all the '# ').

Press ctrl + K & ctrl + U to uncomment from VSCode.

  • sensor:
    • name: Coffee Maker Current State
      unique_id: coffee_maker_current_state_translated
      state: >
      {%- macro state_machine_translation(state) -%}
      {% set STATE_MACHINE_TRANSLATION = {
      "unplugged": "Unplugged",
      "idle": "Idle",
      "paused": "Paused",
      "detached_overload": "Overload",
      "job_ongoing": "Brewing",
      "job_completed": "Coffee is ready",
      } %}
      {{ STATE_MACHINE_TRANSLATION[state]}}
      {%- endmacro -%}
      {{ state_machine_translation(states('input_select.coffee_maker_state_machine')) }}`

@Wheemer
Copy link

Wheemer commented Oct 7, 2024

I have no idea why the terrible github editor reformats things designated as code. Sorry it looks a mess.

@GijsTimmers
Copy link

Thank you, I was still looking in the main branch.

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

No branches or pull requests

3 participants