Rheem EcoNet Integration maintained by Kris Linquist

@klinquist, what came about after all the tinkering you did earlier this year? You mentioned connecting directly to the water heater’s Wi-Fi to extract info. Has any of that been turned into something for the end user?

Basically looking for current heating state and current water temperature, if possible.

2 Likes

@klinquist i'm also interested in how you log in as the water heater! can you post how to modify your code to make be able to do this? thanks

@klinquist described how to log in to the water heater in detail in this post:

@aaiyar yeah that's how to get the credentials which i got following his instructions. but he doesn't tell how to use the credentials to log into the rheem server.

Use an MQTT client.

you're not actually familiar with this integration? because you can't just log into the rheem mqtt server with the credentials. there's an authentication process.

Actually I am. Have you read the driver code?

it's for user authentication with an email address. the hpwh credentials don't have an email address.

Correct. You use those to get a user token and account id. Which is what your water heater has. Use the user token and account id to login via MQTT. My recollection is that isn't port 1883; rather 1884.

Again, going from memory, the broker is rheem.clearblade.com

again. the driver code doesn't help. it only has the url to authenticate as a user.

curl -X "POST" "https://rheem.clearblade.com/api/v/2/devices/e2e699cb0bb0bbb88fc8858cb5a401/auth" \
     -H 'Content-Type: application/json' \
     -d $'{
  "deviceName": YOUR_DEVICE_NAME,
  "activeKey": YOUR_ACTIVE_KEY
}'

Then use the returned deviceToken as the MQTT username with e2e699cb0bb0bbb88fc8858cb5a401 as the password.

const client = mqtt.connect('mqtt://rheem.clearblade.com', {
    username: YOUR_DEVICE_TOKEN,
    password: 'e2e699cb0bb0bbb88fc8858cb5a401'
})

Beware that this MQTT connection may conflict with your actual device's MQTT connection... There might be a max of 1 connection per device, and they may go back and forth...

1 Like

Here's a code snippet for you:

// Stream data from Rheem hybrid water heaters.
// Run "npm install async-mqtt axios" to install dependencies
// Then execute via "node streamWaterHeaterData.js"

const axios = require('axios')
const MQTT = require("async-mqtt");

const rheem_username = '';
const rheem_password = '';

//To obtain these credentials, connect to your water heater's wifi and go to https://192.168.10.1/cred

const rheem_deviceName = '';
const rheem_activeKey = '';


const rheem_systemKey = 'e2e699cb0bb0bbb88fc8858cb5a401';
const rheem_systemSecret = 'E2E699CB0BE6C6FADDB1B0BC9A20';

(async function () {
    console.log('Getting auth token')
 
    let user = await axios.post('https://rheem.clearblade.com/api/v/1/user/auth', {
        email: rheem_username,
        password: rheem_password
    }, {
        headers: {
            'ClearBlade-SystemKey': rheem_systemKey,
            'ClearBlade-SystemSecret': rheem_systemSecret,
            'Content-Type': 'application/json'
        }
    })

    console.log('got user token, getting location')


    let location = await axios.post(`https://rheem.clearblade.com/api/v/1/code/${rheem_systemKey}/getLocation`, null, {
        headers: {
            'ClearBlade-UserToken': user.data.user_token,
            'Content-Type': 'application/json',
            'ClearBlade-SystemKey': rheem_systemKey,
            'ClearBlade-SystemSecret': rheem_systemSecret
        }
    })
    
    let mac = location.data.results.locations[0].equiptments[0].mac_address;
    let serialnumber = location.data.results.locations[0].equiptments[0].serial_number;

    let deviceTopic = `device/${mac}/${serialnumber}/4736/reported`

    console.log('got device ID from location, getting device token')

    let auth = await axios.post(`https://rheem.clearblade.com/api/v/2/devices/${rheem_systemKey}/auth`, {
        deviceName: rheem_deviceName,
        activeKey: rheem_activeKey
    })
    console.log('Using token to connect to MQTT')

    const client = await MQTT.connectAsync("mqtt://rheem.clearblade.com", {
        username: auth.data.deviceToken,
        password: 'e2e699cb0bb0bbb88fc8858cb5a401'
    })

    console.log('Conected.')
    try {
        await client.subscribe(deviceTopic)
    } catch (err) {
        console.log('Error subscribing: ' + err)
    }
    client.on('message', function (topic, message) {
        console.log(`Message topic ${topic}`)
        console.log(message.toString())
    })
    client.on('disconnect', function () {
        console.log('disconnected')
    })
})();
1 Like

@klinquist awesome! that helps a lot! last night i stumbled upon the clearblade python sdk and was able to authenticate with their code, but couldn't figure out the mqtt topic to subscribe to. thanks!

Keep in mind that 4736 in the topic is the "device type ID" for my water heater. Yours may be different, but you should be able to find it in one of those HTTP request responses :).

4736 worked for my hpwh too. thanks!

I'm having an issue turning on my water heater after turning it off with the Off command. Off makes the status in the app change to disabled but using one of the thermostat mode commands does not turn the water heater back on and the app continues to show that it is disabled.

IIRC this did not use to be the case. I've switched over to using vacation mode for now, which I can successfully get out of. But it would be nice to be able to turn the water heater back on should it be turned off (disabled).

For the record I am having the same exact issue.

Have you been able to get this figured out?

Hm, interesting - I just duplicated that. That didn't happen to me previously, either!
Will look into it!

For now I just worked around it and used Vacation mode instead.

Are you using vacation mode via habitat? Or via Rheem's app?