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

Can't turn HotWater to OFF #8

Open
jonbev opened this issue Jan 18, 2017 · 2 comments
Open

Can't turn HotWater to OFF #8

jonbev opened this issue Jan 18, 2017 · 2 comments

Comments

@jonbev
Copy link

jonbev commented Jan 18, 2017

I can set it to manual or schedule but if I try and turn it off the call just seems to be ignored.

I have tried -

hotwater.SetState(hotwater.State.Off);
hotwater.SetState(hotwater.Mode.Off);
hotwater.SetState(''OFF");

All of these seem to be ignored, no events are fired.

Thanks.

@aklambeth
Copy link
Owner

aklambeth commented Jan 25, 2017

The underlying Hive api isn't very intuitive when it comes to setting the water to always off, it looks like the setState method can't do this but there is an onOffState method which can. After some investigating I found that the following code will do what you want.


var Hive = require('bg-hive-api');
var hive = new Hive('your login', 'your password');
var HotWaterControl = require('bg-hive-api/hotWaterControl');

hive.on('login', function (context) {

    // Create an instance of the hot water controller
    var water = new HotWaterControl(context);

    water.once('accepted', function (response) {
        console.log('Water is off');
        hive.Logout();
    });

    water.Call({
        'onOffState': {
            'PUT': {
                'onOffState': 'OFF'
            }
        }
    });
    
});

//Log in
hive.Login();

Counter-intuitively setting the onOffState to On will set the water back to Scheduled therefore to explicitly set the water to on use
water.SetState(water.Mode.Manual);

And back to schedule
water.SetState(water.Mode.Schedule);

as per the documentation. I'll need to handle this is in code so the setState method works as expected.

@jonbev
Copy link
Author

jonbev commented Jan 26, 2017

Thanks for getting back to me, really appreciate your work on this.

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

No branches or pull requests

2 participants