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

sdk, core: add Charger interface #680

Merged
merged 5 commits into from
Apr 2, 2023
Merged

sdk, core: add Charger interface #680

merged 5 commits into from
Apr 2, 2023

Conversation

bjia56
Copy link
Collaborator

@bjia56 bjia56 commented Apr 2, 2023

Tested using the following script:

class TestCharger implements OnOff {

    async turnOff(): Promise<void> {
        try {
            device.chargeState = "trickle";
            //device.chargeState = "not-charging";
        } catch (e) {
            device.console.log(e);
        }
        device.on = false;
        device.console.log(device.chargeState);
    }

    async turnOn() {
        try {
            device.chargeState = "charging";
        } catch (e) {
            device.console.log(e);
        }
        device.on = true;
        device.console.log(device.chargeState);
    }
}

device.handleTypes(ScryptedInterface.Charger);

export default TestCharger;

image
image
image

@koush koush merged commit f976699 into koush:main Apr 2, 2023
@bjia56 bjia56 deleted the charger branch June 2, 2023 11:58
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.

2 participants