Skip to content

Support Timestamp class Sensor#222

Closed
prairiesnpr wants to merge 3 commits intozigpy:devfrom
prairiesnpr:sensor_formatter
Closed

Support Timestamp class Sensor#222
prairiesnpr wants to merge 3 commits intozigpy:devfrom
prairiesnpr:sensor_formatter

Conversation

@prairiesnpr
Copy link
Copy Markdown
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

@codecov
Copy link
Copy Markdown

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).
Report is 15 commits behind head on dev.

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
Copy Markdown
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.

@prairiesnpr prairiesnpr mentioned this pull request Oct 6, 2024
@prairiesnpr
Copy link
Copy Markdown
Contributor Author

Going with #224

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