Skip to content

Mold_indicator.py fixed not to include spaces or dots in attribute names#11694

Merged
Danielhiversen merged 1 commit into
home-assistant:devfrom
olskar:patch-1
Jan 16, 2018
Merged

Mold_indicator.py fixed not to include spaces or dots in attribute names#11694
Danielhiversen merged 1 commit into
home-assistant:devfrom
olskar:patch-1

Conversation

@olskar
Copy link
Copy Markdown
Contributor

@olskar olskar commented Jan 16, 2018

mold_indicator should be fixed not to include spaces or dots in attribute names

https://community.home-assistant.io/t/how-to-show-sensor-attribute-est-crit-temp-in-customize-template-and-extra-badge/39451

Description:

Related issue (if applicable): fixes #

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>

Example entry for configuration.yaml (if applicable):

Checklist:

  • The code change is tested and works locally.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@olskar olskar changed the title fixed not to include spaces or dots in attribute names Mold_indicator.py fixed not to include spaces or dots in attribute names Jan 16, 2018
@Danielhiversen Danielhiversen merged commit dce079e into home-assistant:dev Jan 16, 2018
@olskar olskar deleted the patch-1 branch January 16, 2018 10:32
@Mariusthvdb
Copy link
Copy Markdown
Contributor

Mariusthvdb commented Jan 16, 2018

thanks for the request, tried to use the sensor and declare attributes as extra_badges which isn't possible for Est. Crit. Temp

If i might add to the request: don't use capitals on the attributes either: Dewpoint , Est. Crit. Temp

which would suggest changing the title into:
Mold_indicator.py fixed not to include capitals, spaces or dots in attribute names

Cheers,
Marius

_LOGGER = logging.getLogger(__name__)

ATTR_CRITICAL_TEMP = 'Est. Crit. Temp'
ATTR_CRITICAL_TEMP = 'EstimatedCriticalTemp'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attributes should be lowercase snakecase.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes indeed please. Change EstimatedCriticalTemp in estimated_critical_temp

is this updated now, and do we need to change anything in the HA setup?
just using platform: most_indicator as is.
No need to put mold_indicator.py in custom_components ?

Cheers,
Marius

@balloob balloob mentioned this pull request Jan 26, 2018
@jjanderson
Copy link
Copy Markdown

Can you guys please update the mold indicator docs? I used to use this, then with this breaking change, I see that (from the docs) my config remains the same (the example in the docs is the same old example) However I am getting "unavailable" in the ui... PLease can you provide a bit more clartity around this change and what is expected from the user in order to keep using the sensor? Thanks

@olskar
Copy link
Copy Markdown
Contributor Author

olskar commented Jan 31, 2018

Hm, I am not sure why this change would break anything, do you have any idea @MartinHjelmare @Danielhiversen ?

@Danielhiversen
Copy link
Copy Markdown
Member

A template sensor using the attribute will probably be broken.
But I can not see anything wrong with the documentation.

@jjanderson Please open an issue if you still can not make it work.

@Mariusthvdb
Copy link
Copy Markdown
Contributor

Mariusthvdb commented Jan 31, 2018

hope this helps:
this works fine in my setup of ha 0.62.0
and should be according to the documentation?

- platform: mold_indicator
  name: Schimmel sensor
  indoor_temp_sensor: sensor.temperatuur_living
  indoor_humidity_sensor: sensor.luchtvochtigheid_living
  outdoor_temp_sensor: sensor.br_temperature
  calibration_factor: 1.16
sensor.schimmel_sensor:
  icon: mdi:blur-radial
  extra_badge:
    - attribute: dewpoint
      unit: Dew
    - attribute: estimated_critical_temp
      unit: Crit
    - entity_id: sensor.br_temperature
      unit: "°C"
  templates:
    theme: >
      if (entity.state > 60) return 'red'; else return 'default';

schermafbeelding 2018-01-31 om 19 17 51

don't watch the dropped % ...;-) didn't see that before btw, so might be because of the new sensor definition, or something with customization. Will check.

@Danielhiversen
Copy link
Copy Markdown
Member

@home-assistant home-assistant locked and limited conversation to collaborators Jan 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants