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

[Feature]: Show current humidity level in humidifier card #1088

Open
2 tasks done
ADeeds opened this issue Mar 28, 2023 · 7 comments · May be fixed by #1625
Open
2 tasks done

[Feature]: Show current humidity level in humidifier card #1088

ADeeds opened this issue Mar 28, 2023 · 7 comments · May be fixed by #1625
Labels
enhancement New feature or request

Comments

@ADeeds
Copy link

ADeeds commented Mar 28, 2023

Requirements

  • I have updated Mushroom to the latest available version
  • I did a search to see if there is a similar issue or if a pull request is open.

Is your feature request related to a problem?

I currently use my dehumidifier with the Mushroom humidifier card. I really like it, but it would be helpful to be able to display the current humidity level (which my dehumidifer measures) inside of the card.

Describe the solution you'd like

I'm not sure what's best implementation from a dev perspective, from a user perspective it would be cool if I could provide an arbitrary sensor for primary/secondary information type.

Describe alternatives you've considered

AFAICT templating doesn't work in fields like the card name, otherwise I would do something like set the name to Dehumidifier ({{ states(blahblahblah)}}%.

I can get that to work in the template card but I don't think there's a way to add a slider to control the humidity level there. Maybe that would be a more powerful way to make this feature request possible? It would also help people who want to do a bit more customization for thermostats or lights.

Additional context

No response

@ADeeds ADeeds added the enhancement New feature or request label Mar 28, 2023
@RickeyWard
Copy link

Templates are always rendered on the backend so allowing them everywhere is a performance hog, generates extra requests. Mushroom does have access to the hass state object, but it doesn't support JavaScript templating like custom-button-card which is what would be required to use front end templates (not too hard to do, but probably not in the cards (heh) for mushroom anytime soon.

Not sure having arbitrary entities outside of templates is common enough to get accepted.

How does everyone feel about JS templates from button-card?

@T-Fyre
Copy link

T-Fyre commented Oct 14, 2024

Is it possible to have the state of the humidifier actually pull the target humidity attribute and display that on the card insead of displaying "on" the majority of the time and only momentarily changing when the humidity target gets updated

Also like the climate card, it'd be nice to have the -/+ buttons as actual UI elements and not a slider

@T-Fyre
Copy link

T-Fyre commented Oct 14, 2024

Actually, if the humidifier card worked more like the climate card I think it'd function a lot better, be much more usable, and be a lot more in line with the overall vibes of the mushroom cards

@vinnyfuria
Copy link

I dug into this a bit because the humidity card in the documentation shows the current humidity, but my mushroom cards do not. I think I may have found the issue within the render function:

    let stateDisplay = this.hass.formatEntityState(stateObj);
    if (this.humidity) {
      const humidity = this.hass.formatEntityAttributeValue(
        stateObj,
        "current_humidity",
        this.humidity
      );
      stateDisplay = humidity;
    }

this.humidity does not appear to be properly set elsewhere in the card. The similar temperature card does not use a private variable to store the temperature; instead it gets it directly from the state property and appends the temperature property to the overall state. To make this similar, I would suggest a change like:

    let stateDisplay = this.hass.formatEntityState(stateObj);
    if (stateObj.attributees.current_humidity !== null) {
      const humidity = this.hass.formatEntityAttributeValue(
        stateObj,
        "current_humidity",
        this.humidity
      );
      stateDisplay +=  ` ⸱ ${humidity}`;
    }

I think this change will make the card more like the climate card that displays the current state and temperature in the "State" option that can be chosen in the card's various data fields.

I'm just jumping into typescript, so I haven't yet figure out how to best test this modification. Can anyone actively working on these cards take a look?

Thanks!

@vinnyfuria
Copy link

vinnyfuria commented Dec 26, 2024

@piitaya Apologies for the ping, this issue is old enough I wasn't sure anyone would see my comment above. (And you are the only person to have touched this code for > 2 years).

@mxr
Copy link

mxr commented Jan 6, 2025

I can also reproduce that "the humidity card in the documentation shows the current humidity, but my mushroom cards do not." Your fix sounds reasonable. I suggest opening a PR with what you described.

@vinnyfuria vinnyfuria linked a pull request Jan 10, 2025 that will close this issue
11 tasks
@vinnyfuria
Copy link

Finally got a dev environment working. PR submitted #1625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants