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 invert output option #462

Merged
merged 1 commit into from
Feb 22, 2021
Merged

Conversation

timoschilling
Copy link
Collaborator

closes #408

@andyblac andyblac added enhancement New feature or request webUI labels Feb 4, 2021
@andyblac
Copy link
Collaborator

andyblac commented Feb 5, 2021

another one need a conflict correction 😄

Copy link
Contributor

@rojer rojer left a comment

Choose a reason for hiding this comment

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

overall looks good but there is one more thing - when constructing components, we need to reset output to non-inverted as a common baseline, so for example if you change switch into window covering, that know nothing about inverting outputs, outputs do not remain inverted.
it's not ideal, and represents a leak in abstractions, so if you have better idea how to manage it - welcome.
but for now, we'll need something similar to this.

mos.yml Outdated
@@ -40,6 +40,7 @@ config_schema:
- ["sw", "o", {title: "Switch settings", abstract: true}]
- ["sw.name", "s", "", {title: "Name of the switch"}]
- ["sw.enable", "b", true, {title: "Enable this switch in the accessory"}]
- ["sw.inverted", "b", true, {title: "Invert output, set to true for normally open output"}]
Copy link
Contributor

Choose a reason for hiding this comment

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

we have in_inverted, let's call this option out_inverted

@timoschilling
Copy link
Collaborator Author

Maybe I miss something, but I think we don't need to reset it. inverted is a config property of sw, which means that if the user switches from sw to window it reboots the devise which means a new output is created and which will use the wc setting and will never be in inverted mode.

@rojer
Copy link
Contributor

rojer commented Feb 8, 2021

it reboots the devise

except it doesn't. *restart_required = true does not mean reboot, it means HAP server restart.
HAP server gets stopped, components get destroyed and re-created. however, peripherals - the Inputs, Outputs, temp sensors, etc, do not. so if inverted setting would be preserved and new components created with inverted output(s).

@timoschilling
Copy link
Collaborator Author

timoschilling commented Feb 22, 2021

review applied

@rojer
Copy link
Contributor

rojer commented Feb 22, 2021

i don't see changes to shelly_main

@timoschilling
Copy link
Collaborator Author

thanks for the hint, lost during a rebase

@rojer rojer merged commit 4d13ccd into mongoose-os-apps:master Feb 22, 2021
@rojer
Copy link
Contributor

rojer commented Feb 22, 2021

merged, thanks!

@timoschilling timoschilling deleted the invert-output branch February 23, 2021 06:45
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 this pull request may close these issues.

Add: Inverted Output
3 participants