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

Add Number entity type, and update README docs for Switch and Button #115

Merged
merged 3 commits into from
Sep 17, 2023

Conversation

DavidMikeSimon
Copy link
Contributor

@DavidMikeSimon DavidMikeSimon commented Sep 4, 2023

  • Add the Number entity, which can control a single numeric value (just like how Text can control a single string)
    • Add docs for Number to the README
    • Add basic tests for Number (similar to the Text tests)
  • Update some existing docs in README:
    • Add documentation for Button, which was undocumented before.
      • Document that you have to call write_config() to make buttons discoverable
    • Add example code to handle the typical payloads for a Switch
    • Update examples to make it clearer that, when you receive a command from HA, you also have to update the MQTT state on your entity (e.g. when you get an "ON" payload for a Switch, it's your job to call on())

License Acceptance

  • This repository is Apache version 2.0 licensed and by making this PR, I am contributing my changes to the repository under the terms of the Apache 2 license.

Type of changes

  • Add/update a helper script
  • Add/update link to an external resource like a blog post or video
  • Bug fix
  • New feature
  • Test updates
  • Text cleanups/updates

Checklist

  • I have read the CONTRIBUTING document.
  • All new and existing tests pass.
  • Any scripts added use #!/usr/bin/env interpreter instead of potentially platform-specific direct paths (#!/bin/sh is an allowed exception)
  • Scripts added/updated in this PR are all marked executable.
  • Scripts added/updated in this PR do not have a language file extension unless they are meant to be sourced and not run standalone. No one should have to know if a script was written in bash, python, ruby or whatever. Not including file extensions makes it easier to rewrite the script in another language later without having to change every reference to the previous version.
  • I have confirmed that any links added or updated in my PR are valid.

@DavidMikeSimon DavidMikeSimon marked this pull request as ready for review September 4, 2023 20:58
@DavidMikeSimon
Copy link
Contributor Author

Heya, I'm noticing that the linter is unhappy about sensors.py, but most of the lines it's complaining about were not changed in my PR. Should I just reformat the whole file to make it pass the line length lint?

README.md Outdated
# Information about the `number` entity.
number_info = NumberInfo(name="test", min=0, max=50, mode="slider", step=5)

settings = Settings(mqtt=mqtt_settings, entity=switch_info)

Choose a reason for hiding this comment

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

Vestigial switch_info
settings = Settings(mqtt=mqtt_settings, entity=number_info)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@philharlow Updated, along with some similar pre-existing mis-names.

@DavidMikeSimon
Copy link
Contributor Author

@unixorn Bump. Anything you'd like me to do on this PR? I can reformat that file to pass the linter, though I'm not sure about how it was passing the linter in the first place.

@unixorn
Copy link
Owner

unixorn commented Sep 13, 2023

@DavidMikeSimon, if you're willing, I'd appreciate the formatting help.

Sorry I've been slow, work's been busy busy.

@DavidMikeSimon
Copy link
Contributor Author

@unixorn Ok, lints passing now!

Copy link
Owner

@unixorn unixorn left a comment

Choose a reason for hiding this comment

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

Thanks for the help!

@unixorn unixorn merged commit 0ca039f into unixorn:main Sep 17, 2023
4 checks passed
unixorn added a commit that referenced this pull request Sep 24, 2023
- Add `state_class` property to Sensor class, fixes #96
- Add ability to specify non-standard MQTT ports, closes #91
- Various dependency bumps
- Add `Number` entity type, and update README docs for `Switch` and `Button` in #115

Signed-off-by: Joe Block <[email protected]>
unixorn added a commit that referenced this pull request Sep 24, 2023
- Add `state_class` property to Sensor class, fixes #96
- Add ability to specify non-standard MQTT ports, closes #91
- Add `Number` entity type, and update README docs for `Switch` and `Button` in #115
- Put entity types in alphabetical order in README.md
- Update TOC in README.md
- Various dependency bumps

Signed-off-by: Joe Block <[email protected]>
@unixorn unixorn mentioned this pull request Sep 24, 2023
14 tasks
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.

3 participants