MWD5 WiFi thermostat (OJ Electronics/Microtemp)

I’ve had the Microtemp MWD5 WiFi thermostat for a couple of years, and a while back I successfully sniffed the communication between the mobile app and the cloud.
It communicates with HTTP POST/GET with json data, and seems simple to create an integration for it.

Is there a similar thermostat integration that would be easier to modify than start from scratch?

I’ve postponed this task for almost a year now, so if anyone else wants to have a go, use my notes below. The main priority is to control it in manual mode and get energy usage from it.

Signin:

POST https://owd5-mh015-app.ojelectronics.com/api/UserProfile/SignIn
{
    "APIKEY": "f219aab4-9ac0-4343-8422-b72203e2fac9",
    "ClientSWVersion": 1,
    "CustomerId": 111,
    "Password": "password",
    "UserName": "username"
}

HTTP/1.1 200 OK
{
    "ErrorCode": 0,
    "SessionId": "fXL6a_GsEkODSl0xFXtXRA",
    "UserName": "username"
}

GetGroupContents:

GET https://owd5-mh015-app.ojelectronics.com/api/Group/GroupContents?sessionid=fXL6a_GsEkODSl0xFXtXRA&APIKEY=f219aab4-9ac0-4343-8422-b72203e2fac9

HTTP/1.1 200 OK

{
    "ErrorCode": 0,
    "GroupContents": [
        {
            "Action": 0,
            "BoostEndTime": "1900-01-01T00:00:00",
            "ComfortEndTime": "1900-01-01T00:00:00",
            "ComfortSetpoint": 2300,
            "FrostProtectionTemperature": 500,
            "GroupId": 17953,
            "GroupName": "Bad",
            "LastPrimaryModeIsAuto": true,
            "ManualModeSetpoint": 2197,
            "RegulationMode": 1,
            "Schedule": {
                "Days": [
                    {
                        "Events": [
                            {
                                "Active": true,
                                "Clock": "06:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 0,
                                "Temperature": 2208
                            },
                            {
                                "Active": true,
                                "Clock": "07:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 1,
                                "Temperature": 1818
                            },
                            {
                                "Active": false,
                                "Clock": "12:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 2,
                                "Temperature": 2000
                            },
                            {
                                "Active": false,
                                "Clock": "13:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 3,
                                "Temperature": 1500
                            },
                            {
                                "Active": true,
                                "Clock": "15:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 4,
                                "Temperature": 2175
                            },
                            {
                                "Active": true,
                                "Clock": "23:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 5,
                                "Temperature": 1814
                            }
                        ],
                        "WeekDayGrpNo": 1
                    },
                    {
                        "Events": [
                            {
                                "Active": true,
                                "Clock": "06:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 0,
                                "Temperature": 2208
                            },
                            {
                                "Active": true,
                                "Clock": "07:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 1,
                                "Temperature": 1818
                            },
                            {
                                "Active": false,
                                "Clock": "12:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 2,
                                "Temperature": 2000
                            },
                            {
                                "Active": false,
                                "Clock": "13:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 3,
                                "Temperature": 1500
                            },
                            {
                                "Active": true,
                                "Clock": "15:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 4,
                                "Temperature": 2175
                            },
                            {
                                "Active": true,
                                "Clock": "23:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 5,
                                "Temperature": 1814
                            }
                        ],
                        "WeekDayGrpNo": 2
                    },
                    {
                        "Events": [
                            {
                                "Active": true,
                                "Clock": "06:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 0,
                                "Temperature": 2208
                            },
                            {
                                "Active": true,
                                "Clock": "07:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 1,
                                "Temperature": 1818
                            },
                            {
                                "Active": false,
                                "Clock": "12:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 2,
                                "Temperature": 2000
                            },
                            {
                                "Active": false,
                                "Clock": "13:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 3,
                                "Temperature": 1500
                            },
                            {
                                "Active": true,
                                "Clock": "15:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 4,
                                "Temperature": 2175
                            },
                            {
                                "Active": true,
                                "Clock": "23:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 5,
                                "Temperature": 1814
                            }
                        ],
                        "WeekDayGrpNo": 3
                    },
                    {
                        "Events": [
                            {
                                "Active": true,
                                "Clock": "06:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 0,
                                "Temperature": 2208
                            },
                            {
                                "Active": true,
                                "Clock": "07:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 1,
                                "Temperature": 1818
                            },
                            {
                                "Active": false,
                                "Clock": "12:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 2,
                                "Temperature": 2000
                            },
                            {
                                "Active": false,
                                "Clock": "13:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 3,
                                "Temperature": 1500
                            },
                            {
                                "Active": true,
                                "Clock": "15:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 4,
                                "Temperature": 2175
                            },
                            {
                                "Active": true,
                                "Clock": "23:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 5,
                                "Temperature": 1814
                            }
                        ],
                        "WeekDayGrpNo": 4
                    },
                    {
                        "Events": [
                            {
                                "Active": true,
                                "Clock": "06:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 0,
                                "Temperature": 2208
                            },
                            {
                                "Active": true,
                                "Clock": "07:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 1,
                                "Temperature": 1818
                            },
                            {
                                "Active": false,
                                "Clock": "12:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 2,
                                "Temperature": 2000
                            },
                            {
                                "Active": false,
                                "Clock": "13:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 3,
                                "Temperature": 1500
                            },
                            {
                                "Active": true,
                                "Clock": "15:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 4,
                                "Temperature": 2175
                            },
                            {
                                "Active": true,
                                "Clock": "23:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 5,
                                "Temperature": 1814
                            }
                        ],
                        "WeekDayGrpNo": 5
                    },
                    {
                        "Events": [
                            {
                                "Active": true,
                                "Clock": "06:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 0,
                                "Temperature": 2197
                            },
                            {
                                "Active": false,
                                "Clock": "09:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 1,
                                "Temperature": 1798
                            },
                            {
                                "Active": false,
                                "Clock": "12:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 2,
                                "Temperature": 2000
                            },
                            {
                                "Active": false,
                                "Clock": "13:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 3,
                                "Temperature": 1500
                            },
                            {
                                "Active": false,
                                "Clock": "17:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 4,
                                "Temperature": 2000
                            },
                            {
                                "Active": true,
                                "Clock": "23:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 5,
                                "Temperature": 1786
                            }
                        ],
                        "WeekDayGrpNo": 6
                    },
                    {
                        "Events": [
                            {
                                "Active": true,
                                "Clock": "06:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 0,
                                "Temperature": 2197
                            },
                            {
                                "Active": false,
                                "Clock": "09:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 1,
                                "Temperature": 1798
                            },
                            {
                                "Active": false,
                                "Clock": "12:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 2,
                                "Temperature": 2000
                            },
                            {
                                "Active": false,
                                "Clock": "13:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 3,
                                "Temperature": 1500
                            },
                            {
                                "Active": false,
                                "Clock": "17:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 4,
                                "Temperature": 2000
                            },
                            {
                                "Active": true,
                                "Clock": "23:00:00",
                                "EventIsOnNextDay": false,
                                "ScheduleType": 5,
                                "Temperature": 1786
                            }
                        ],
                        "WeekDayGrpNo": 7
                    }
                ],
                "ModifiedDueToVerification": false
            },
            "Thermostats": [
                {
                    "Action": 0,
                    "AdaptiveMode": false,
                    "BoostEndTime": "1900-01-01T00:00:00",
                    "ComfortEndTime": "1900-01-01T00:00:00",
                    "ComfortSetpoint": 2300,
                    "CustomerId": 15,
                    "DaylightSaving": false,
                    "DaylightSavingActive": false,
                    "ErrorCode": 0,
                    "FloorTemperature": 2190,
                    "FloorType": 2,
                    "FrostProtectionTemperature": 500,
                    "GroupId": 17953,
                    "GroupName": "Bad",
                    "Heating": false,
                    "Id": 89037,
                    "LastPrimaryModeIsAuto": true,
                    "ManualModeSetpoint": 2679,
                    "MaxSetpoint": 4000,
                    "MinSetpoint": 500,
                    "Online": true,
                    "OpenWindow": false,
                    "RegulationMode": 1,
                    "RoomTemperature": 2317,
                    "SWversion": "1013W212",
                    "Schedule": {
                        Same as Schedule section above, I removed this because of the character limit
                    },
                    "SensorAppl": 3,
                    "SerialNumber": "299386",
                    "ThermostatName": "Gulvvarme",
                    "TimeZone": 3600,
                    "VacationBeginDay": "2017-01-01T00:00:00",
                    "VacationEnabled": false,
                    "VacationEndDay": "2017-01-02T00:00:00",
                    "VacationTemperature": 500
                }
            ],
            "VacationBeginDay": "2016-01-01T00:00:00",
            "VacationEnabled": false,
            "VacationEndDay": "2016-01-01T00:00:00",
            "VacationTemperature": 500
        }
    ]
}

Manual Setpoint:

POST https://owd5-mh015-app.ojelectronics.com/api/Group/UpdateGroup?sessionid=fXL6a_GsEkODSl0xFXtXRA

{
    "APIKEY": "f219aab4-9ac0-4343-8422-b72203e2fac9",
    "SetGroup": {
        "BoostEndTime": "1900-01-01T00:00:00",
        "ComfortEndTime": "1900-01-01T00:00:00",
        "ComfortSetpoint": 2300,
        "ExcludeVacationData": false,
        "GroupId": 17953,
        "GroupName": "Bad",
        "LastPrimaryModeIsAuto": true,
        "ManualModeSetpoint": 2470,
        "RegulationMode": 3,
        "Schedule": {
           I removed this because of the character limit
        },
        "VacationBeginDay": "2016-01-01T00:00:00",
        "VacationEnabled": false,
        "VacationEndDay": "2016-01-01T00:00:00",
        "VacationTemperature": 0
    }
}

HTTP/1.1 200 OK
{
    "ErrorCode": 0
}

Return to plan:

POST https://owd5-mh015-app.ojelectronics.com/api/Group/UpdateGroup?sessionid=fXL6a_GsEkODSl0xFXtXRA

{
    "APIKEY": "f219aab4-9ac0-4343-8422-b72203e2fac9",
    "SetGroup": {
        "BoostEndTime": "1900-01-01T00:00:00",
        "ComfortEndTime": "1900-01-01T00:00:00",
        "ComfortSetpoint": 2300,
        "ExcludeVacationData": false,
        "GroupId": 17953,
        "GroupName": "Bad",
        "LastPrimaryModeIsAuto": true,
        "ManualModeSetpoint": 2470,
        "RegulationMode": 1,
        "Schedule": {
            I removed this because of the character limit
        },
        "VacationBeginDay": "2016-01-01T00:00:00",
        "VacationEnabled": false,
        "VacationEndDay": "2016-01-01T00:00:00",
        "VacationTemperature": 0
    }
}

HTTP/1.1 200 OK
{
    "ErrorCode": 0
}

Boost mode:

POST https://owd5-mh015-app.ojelectronics.com/api/Group/UpdateGroup?sessionid=fXL6a_GsEkODSl0xFXtXRA

{
    "APIKEY": "f219aab4-9ac0-4343-8422-b72203e2fac9",
    "SetGroup": {
        "BoostEndTime": "2021-12-29T17:47:00",
        "ComfortEndTime": "1900-01-01T00:00:00",
        "ComfortSetpoint": 2300,
        "ExcludeVacationData": false,
        "GroupId": 17953,
        "GroupName": "Bad",
        "LastPrimaryModeIsAuto": true,
        "ManualModeSetpoint": 2470,
        "RegulationMode": 8,
        "Schedule": {
            I removed this because of the character limit
        },
        "VacationBeginDay": "2016-01-01T00:00:00",
        "VacationEnabled": false,
        "VacationEndDay": "2016-01-01T00:00:00",
        "VacationTemperature": 0
    }
}

HTTP/1.1 200 OK
{
    "ErrorCode": 0
}

Comfort mode:

POST https://owd5-mh015-app.ojelectronics.com/api/Group/UpdateGroup?sessionid=D0eepWCdFkq6rfiTiNTKCA

{
    "APIKEY": "f219aab4-9ac0-4343-8422-b72203e2fac9",
    "SetGroup": {
        "BoostEndTime": "2021-12-29T17:47:00",
        "ComfortEndTime": "2021-12-29T19:00:00",
        "ComfortSetpoint": 2175,
        "ExcludeVacationData": false,
        "GroupId": 17953,
        "GroupName": "Bad",
        "LastPrimaryModeIsAuto": true,
        "ManualModeSetpoint": 2470,
        "RegulationMode": 2,
        "Schedule": {
            I removed this because of the character limit
        },
        "VacationBeginDay": "2016-01-01T00:00:00",
        "VacationEnabled": false,
        "VacationEndDay": "2016-01-01T00:00:00",
        "VacationTemperature": 0
    }
}

HTTP/1.1 200 OK
{
    "ErrorCode": 0
}

Eco mode:

POST https://owd5-mh015-app.ojelectronics.com/api/Group/UpdateGroup?sessionid=8t1DR49y90SB2XfCVlsshg

{
    "APIKEY": "f219aab4-9ac0-4343-8422-b72203e2fac9",
    "SetGroup": {
        "BoostEndTime": "2021-12-29T17:47:00",
        "ComfortEndTime": "2021-12-29T19:00:00",
        "ComfortSetpoint": 2175,
        "ExcludeVacationData": false,
        "GroupId": 17953,
        "GroupName": "Bad",
        "LastPrimaryModeIsAuto": true,
        "ManualModeSetpoint": 2470,
        "RegulationMode": 9,
        "Schedule": {
            I removed this because of the character limit
        },
        "VacationBeginDay": "2016-01-01T00:00:00",
        "VacationEnabled": false,
        "VacationEndDay": "2016-01-01T00:00:00",
        "VacationTemperature": 0
    }
}

Energy usage:

POST https://owd5-mh015-app.ojelectronics.com/api/EnergyUsage/GetEnergyUsage?sessionid=MniO_4mA8ECJOt3d54Gfwg

Week:
{
    "APIKEY": "f219aab4-9ac0-4343-8422-b72203e2fac9",
    "DateTime": "2021-12-29T17:04:49",
    "History": 0,
    "ThermostatID": "299386",
    "ViewType": 2
}

{
    "EnergyUsage": [
        {
            "Usage": [
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                }
            ]
        }
    ],
    "ErrorCode": 0
}


Month:
{
    "APIKEY": "f219aab4-9ac0-4343-8422-b72203e2fac9",
    "DateTime": "2021-12-29T17:05:33",
    "History": 4,
    "ThermostatID": "299386",
    "ViewType": 2
}

{
    "EnergyUsage": [
        {
            "Usage": [
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                }
            ]
        },
        {
            "Usage": [
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                }
            ]
        },
        {
            "Usage": [
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                }
            ]
        },
        {
            "Usage": [
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                }
            ]
        },
        {
            "Usage": [
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                }
            ]
        }
    ],
    "ErrorCode": 0
}


Year:
{
    "APIKEY": "f219aab4-9ac0-4343-8422-b72203e2fac9",
    "DateTime": "2021-01-29T17:05:48",
    "History": 0,
    "ThermostatID": "299386",
    "ViewType": 4
}

{
    "EnergyUsage": [
        {
            "Usage": [
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                },
                {
                    "EnergyKWattHour": 0.0
                }
            ]
        }
    ],
    "ErrorCode": 0
}

Negotiate (2 steps) (unsure if this is at the start, or if it is needed):

GET https://owd5-mh015-app.ojelectronics.com/ocd5notification/negotiate?clientProtocol=1.3

Response:
{
    "ConnectionId": "7fe6ba31-be25-44cb-ac72-6b62e3ce5ecb",
    "ConnectionTimeout": 110.0,
    "ConnectionToken": "3H5PCkeD1lLHiLvVS0xklpe5apgHYIudkycXcHbUwFv2Qzy/4EFQF8SXwBT7fssqUb4UpnwIGoNsnH63nl1+M/Av2/L3fo/3UinL42Yqphf9Br3fQyeGStSXJ4kirwpc",
    "DisconnectTimeout": 30.0,
    "KeepAliveTimeout": 20.0,
    "LongPollDelay": 0.0,
    "ProtocolVersion": "1.3",
    "TransportConnectTimeout": 5.0,
    "TryWebSockets": true,
    "Url": "/ocd5notification"
}


----

GET https://owd5-mh015-app.ojelectronics.com/ocd5notification/connect?transport=serverSentEvents&connectionToken=3H5PCkeD1lLHiLvVS0xklpe5apgHYIudkycXcHbUwFv2Qzy%2F4EFQF8SXwBT7fssqUb4UpnwIGoNsnH63nl1%2BM%2FAv2%2FL3fo%2F3UinL42Yqphf9Br3fQyeGStSXJ4kirwpc&connectionId=7fe6ba31-be25-44cb-ac72-6b62e3ce5ecb
No response
2 Likes

Would love to see this integration, however I don’t have the coding skills to write it. Happy to help test it though. Even better would be a local offline integration, but that’s probably pushing it.

Just wondering if you have any success with this?
I do have 6 OJ Electronics MWD5 thermostats. I was trying to use Node-Red (http request node) at least to get basic info from thermostats. However I’m not able to get through the authentication phase.
I cannot read “SessionID” from the first sign-in POST response. Most likely it’s related to TLS/SSL certificates in NodeRed and in that 'http request" node, which I don’t know how to setup.

This is how the response look like
image

I’ve not been working on this at all to be honest.
NodeRED was an interesting approach which I haven’t thought of, maybe I’ll give that a go.
I have been playing around with pyscript (from HACS) recently, and I was thinking of writing a pyscript app to interface with the WiFi thermostats, it would at least be something I feel confident in.

@zdenek.masek I testet Node-RED today, and got the login thing working.
You need to download the node-red-contrib-https node.
You can test it by importing my simple login flow:

[
    {
        "id": "11e00fc5a1e0e44c",
        "type": "https-node",
        "z": "923feb3d885b568e",
        "name": "",
        "method": "use",
        "ret": "obj",
        "url": "",
        "authorized": false,
        "agent": false,
        "x": 650,
        "y": 360,
        "wires": [
            [
                "e8e9e70685e66a83",
                "4a90e3f7a408c1e6"
            ]
        ]
    },
    {
        "id": "e8e9e70685e66a83",
        "type": "debug",
        "z": "923feb3d885b568e",
        "name": "debug 1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 880,
        "y": 360,
        "wires": []
    },
    {
        "id": "d392991e53d0eed6",
        "type": "inject",
        "z": "923feb3d885b568e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 240,
        "y": 360,
        "wires": [
            [
                "834fdcca9d707a1a"
            ]
        ]
    },
    {
        "id": "834fdcca9d707a1a",
        "type": "change",
        "z": "923feb3d885b568e",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "url",
                "pt": "msg",
                "to": "https://owd5-mh015-app.ojelectronics.com/api/UserProfile/SignIn",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "method",
                "pt": "msg",
                "to": "POST",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "headers",
                "pt": "msg",
                "to": "{'Content-Type': 'application/json'}",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\"APIKEY\":\"f219aab4-9ac0-4343-8422-b72203e2fac9\",\"UserName\":\"user\",\"ClientSWVersion\":1,\"CustomerId\":15,\"Password\":\"pass\"}",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 440,
        "y": 360,
        "wires": [
            [
                "11e00fc5a1e0e44c"
            ]
        ]
    },
    {
        "id": "4a90e3f7a408c1e6",
        "type": "change",
        "z": "923feb3d885b568e",
        "name": "SessionId",
        "rules": [
            {
                "t": "set",
                "p": "SessionId",
                "pt": "flow",
                "to": "payload.SessionId",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 880,
        "y": 280,
        "wires": [
            []
        ]
    }
]

This sets a flow.SessionId. Since I am completely new to Node-RED I do not know what is considered best practice.
I would appreciate if you shared your final result, as I am keen to learn more about Node-RED.

@oppigard - without any changes on my flow I can see SessionID now. Really don’t know what has changed, but certainly I didn’t update my flow since my last post here.
So, finally I can now read thermostat data and make them visible in the HA. I’m not expert in Node Red and my approach certainly is not the best, but it works.
I’m using MQTT broker and then MQTT sensor in HA.

My test flow:

[{"id":"99d1772b779dadb3","type":"debug","z":"e0263d19a83676e6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":630,"y":100,"wires":[]},{"id":"d45fab97172ab747","type":"inject","z":"e0263d19a83676e6","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":260,"wires":[["0f236c45fe4a817a"]]},{"id":"0f236c45fe4a817a","type":"function","z":"e0263d19a83676e6","name":"POST","func":"msg.headers = {}\nmsg.method = \"POST\"\nmsg.url = \"https://owd5-r1099-app.ojelectronics.com/api/UserProfile/SignIn\" ;\n//msg.url = \"https://owd5-mh015-app.ojelectronics.com/api/UserProfile/SignIn\";\nmsg.headers[\"Accept\"] = \"application/json; charset=utf-8\"\n//msg.headers[\"Content-Type\"] = \"application/json; charset=utf-8\"\nmsg.headers[\"Content-Type\"] = \"application/json\"\n//msg.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\"\nmsg.headers[\"User-Agent\"] = \"Dalvik/2.1.1 (Linux; U; Android 6.0.1; LG-H955 Build/MMB29M)\"\nmsg.headers[\"Host\"] = \"owd5-r1099-app.ojelectronics.com\"\nmsg.headers[\"connection\"] = \"Keep-Alive\"\nmsg.headers[\"Accept-Encoding\"] = \"gzip\"\nmsg.headers[\"Content-Length\"] = \"147\"\n\n\nmsg.payload = {\n//\"id\":\"ID\",\n//\"method\":\"authenticate\",\n//\"params\":\n//{\n\"UserName\":\"username\",\n\"APIKEY\":\"APIKEY\",\n\"Password\":\"password\",\n\"ClientSWVersion\":1,\n\"CustomerId\":99\n};\n//\"jsonrpc\":\"2.0\"\n//};\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":260,"wires":[["c3cd1b0b6dd5cb7d","cecedc157612aa60","cbe43e2bad5ac903"]]},{"id":"cbe43e2bad5ac903","type":"http request","z":"e0263d19a83676e6","name":"","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":true,"proxy":"","insecureHTTPParser":true,"authType":"","senderr":false,"headers":[],"x":430,"y":260,"wires":[["99d1772b779dadb3","5c34bea42383719b","f399d38a516ba036","3f2b1873c9858ffa","e50259c33c62cae4"]]},{"id":"c3cd1b0b6dd5cb7d","type":"debug","z":"e0263d19a83676e6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"headers","targetType":"msg","statusVal":"","statusType":"auto","x":410,"y":120,"wires":[]},{"id":"cecedc157612aa60","type":"debug","z":"e0263d19a83676e6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":390,"y":160,"wires":[]},{"id":"5c34bea42383719b","type":"debug","z":"e0263d19a83676e6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"responseCookies","targetType":"msg","statusVal":"","statusType":"auto","x":660,"y":60,"wires":[]},{"id":"f399d38a516ba036","type":"debug","z":"e0263d19a83676e6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"statusCode","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":140,"wires":[]},{"id":"3f2b1873c9858ffa","type":"debug","z":"e0263d19a83676e6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"headers","targetType":"msg","statusVal":"","statusType":"auto","x":630,"y":180,"wires":[]},{"id":"e50259c33c62cae4","type":"function","z":"e0263d19a83676e6","name":"GET","func":"var cookies = msg.responseCookies;\nvar payload = msg.payload;\nmsg.headers={};\nmsg.cookies = cookies;\nmsg.method = \"GET\"\nmsg.url = \"https://owd5-r1099-app.ojelectronics.com/api/Group/GroupContents?sessionid=\" + payload.SessionId + \"&APIKEY=f219aab4-9ac0-4343-8422-b72203e2fac9\";\n//msg.url = \"https://owd5-mh015-app.ojelectronics.com/api/UserProfile/SignIn\";\nmsg.headers[\"Accept\"] = \"application/json; charset=utf-8\"\n//msg.headers[\"Content-Type\"] = \"application/json; charset=utf-8\"\n//msg.headers[\"Content-Type\"] = \"application/json\"\n//msg.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\"\n//msg.headers[\"User-Agent\"] = \"Dalvik/2.1.1 (Linux; U; Android 6.0.1; LG-H955 Build/MMB29M)\"\n//msg.headers[\"Host\"] = \"owd5-r1099-app.ojelectronics.com\"\n//msg.headers[\"connection\"] = \"Keep-Alive\"\n//msg.headers[\"Accept-Encoding\"] = \"gzip\"\n//msg.headers[\"Content-Length\"] = \"147\"\nmsg.headers[\"Cookie\"] = msg.cookies\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":630,"y":260,"wires":[["80806d9fdd13b4e5","2a1f2eee8ec13822","215a0cff42e95e93","bb34643926129db1"]]},{"id":"80806d9fdd13b4e5","type":"debug","z":"e0263d19a83676e6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"cookies","targetType":"msg","statusVal":"","statusType":"auto","x":910,"y":100,"wires":[]},{"id":"543459c338fdf022","type":"comment","z":"e0263d19a83676e6","name":"Thermostat test","info":"","x":120,"y":60,"wires":[]},{"id":"2a1f2eee8ec13822","type":"debug","z":"e0263d19a83676e6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"headers","targetType":"msg","statusVal":"","statusType":"auto","x":910,"y":140,"wires":[]},{"id":"215a0cff42e95e93","type":"http request","z":"e0263d19a83676e6","name":"","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":850,"y":260,"wires":[["d761323c71e31933","307c384836989811","5fbd744d568d3a65"]]},{"id":"d761323c71e31933","type":"debug","z":"e0263d19a83676e6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1110,"y":120,"wires":[]},{"id":"307c384836989811","type":"debug","z":"e0263d19a83676e6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"headers","targetType":"msg","statusVal":"","statusType":"auto","x":1110,"y":160,"wires":[]},{"id":"bb34643926129db1","type":"debug","z":"e0263d19a83676e6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"url","targetType":"msg","statusVal":"","statusType":"auto","x":900,"y":180,"wires":[]},{"id":"85528b133b3417b8","type":"mqtt out","z":"e0263d19a83676e6","name":"","topic":"","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"08297b6e8c8c1fdf","x":550,"y":380,"wires":[]},{"id":"b85d847f397e9d02","type":"change","z":"e0263d19a83676e6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.GroupContents[0].Thermostats[2].ThermostatName","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"Thermostats/Room_Z/ThermostatName","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":600,"wires":[["2d86bde923a21172"]]},{"id":"2d86bde923a21172","type":"mqtt out","z":"e0263d19a83676e6","name":"","topic":"","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"08297b6e8c8c1fdf","x":550,"y":600,"wires":[]},{"id":"71d80512bf128717","type":"mqtt out","z":"e0263d19a83676e6","name":"","topic":"","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"08297b6e8c8c1fdf","x":550,"y":420,"wires":[]},{"id":"c6fe90d025c50587","type":"mqtt out","z":"e0263d19a83676e6","name":"","topic":"","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"08297b6e8c8c1fdf","x":550,"y":460,"wires":[]},{"id":"e3a737fc5eb4a98e","type":"mqtt out","z":"e0263d19a83676e6","name":"","topic":"","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"08297b6e8c8c1fdf","x":550,"y":500,"wires":[]},{"id":"50adb823903fb0a0","type":"mqtt out","z":"e0263d19a83676e6","name":"","topic":"","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"08297b6e8c8c1fdf","x":550,"y":540,"wires":[]},{"id":"1ac9c16c7e9d831f","type":"comment","z":"e0263d19a83676e6","name":"Thermostat Room_A","info":"","x":370,"y":320,"wires":[]},{"id":"5fbd744d568d3a65","type":"junction","z":"e0263d19a83676e6","x":60,"y":320,"wires":[["83d6de01d96ec96e","ea69aba7bc52427f","bf0d23c19014e679","b85d847f397e9d02","a758cc700caa388f","30d20d6ff7811a53"]]},{"id":"7f45fcb61c725a82","type":"group","z":"e0263d19a83676e6","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["83d6de01d96ec96e","a758cc700caa388f","ea69aba7bc52427f","30d20d6ff7811a53","bf0d23c19014e679"],"x":274,"y":339,"w":212,"h":242},{"id":"83d6de01d96ec96e","type":"change","z":"e0263d19a83676e6","g":"7f45fcb61c725a82","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.GroupContents[0].Thermostats[3].ThermostatName","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"Thermostats/Room_A/ThermostatName","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":380,"wires":[["85528b133b3417b8"]]},{"id":"a758cc700caa388f","type":"change","z":"e0263d19a83676e6","g":"7f45fcb61c725a82","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.GroupContents[0].Thermostats[3].RoomTemperature/100","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"Thermostats/Room_A/RoomTemperature","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":420,"wires":[["71d80512bf128717"]]},{"id":"ea69aba7bc52427f","type":"change","z":"e0263d19a83676e6","g":"7f45fcb61c725a82","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.GroupContents[0].Thermostats[3].FloorTemperature/100","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"Thermostats/Room_A/FloorTemperature","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":460,"wires":[["c6fe90d025c50587"]]},{"id":"30d20d6ff7811a53","type":"change","z":"e0263d19a83676e6","g":"7f45fcb61c725a82","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.GroupContents[0].Thermostats[3].Heating","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"Thermostats/Room_A/Heating","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":500,"wires":[["e3a737fc5eb4a98e"]]},{"id":"bf0d23c19014e679","type":"change","z":"e0263d19a83676e6","g":"7f45fcb61c725a82","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.GroupContents[0].Thermostats[3].ManualModeSetpoint/100","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"Thermostats/Room_A/ManualModeSetpoint","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":540,"wires":[["50adb823903fb0a0"]]},{"id":"08297b6e8c8c1fdf","type":"mqtt-broker","name":"","broker":"192.168.2.10","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":"","credentials":{}}]

and entities in HA :smiley:

I’ll be testing manual temperature set. Basically my goal is to do automation and start heating once there’s energy surplus from my solar system.

Test it and let me know your results.

1 Like

Hi guys. I also just bought the MWD5. Fiddling around in node-red with your flow, and looking promising :slight_smile:
Small question: how do you find you API key?

Btw, I have the full decompiled source code for the android app if that might be interesting?