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

Support Timestamp class Sensor #222

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

prairiesnpr
Copy link
Contributor

@prairiesnpr prairiesnpr commented Oct 4, 2024

It does add support for the HVAC Thermostat attribute setpoint_change_source_timestamp, primarily so I would have an attribute to test against.

Closes: #220

Copy link

codecov bot commented Oct 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.41%. Comparing base (cda1b95) to head (53c8f12).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #222   +/-   ##
=======================================
  Coverage   96.40%   96.41%           
=======================================
  Files          61       61           
  Lines        9359     9373   +14     
=======================================
+ Hits         9023     9037   +14     
  Misses        336      336           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

"""Pass-through formatter."""
return getattr(
self,
NON_NUMERIC_FORMATTERS.get(self._attr_device_class, "numeric_formatter"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be clearest to have a single formatter function for the base sensor (converter?) and then have each sub-type override it, having NumericSensor, StringSensor, and DateTimeSensor provide an implementation.

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

Successfully merging this pull request may close these issues.

Sensor can only return numeric datatypes
2 participants