MWD5 WiFi thermostat (OJ Electronics/Microtemp)

Hi @robbinjanssen,

I just installed your custom integration and it seems to work properly. I’m using it with a Schluter Ditra Heat (customerId = 3).

However, pressing one of the two buttons in the Lovelace layout gives this error message:
climate/set_hvac_mode. OJMicrolineThermostat.async_set_hvac_mode() got an unexpected keyword argument 'hvac_mode'

I will give further feedback when I have things to add.

See also the two attached screenshots! :slight_smile:


The set hvac mode hasnt really been implemented (yet), it just sets the preset to schedule I think. I dont think its possible to tell the thermostat to ‘heat’ or ‘auto’. It just switches on/off based on the temperature?

Im close to v1 btw, so dont give up hope yet! :wink:

2 Likes

You can tell it to go to “auto” mode and then it will follow the schedule

is there a possibility that electricity consumption will also be integrated? That’d be amazing.
Thank you!

1 Like

I would like to do that, but I can’t really make sense of the data coming out of the app/api yet… any thoughts?

WEEK: POST https://13.81.215.235/api/EnergyUsage/GetEnergyUsage?sessionid=xxx
---
{
	"APIKEY": "xxx",
	"ThermostatID": "xxx",
	"History": 0,
	"ViewType": 2,
	"DateTime": "2022-12-27T09:50:38"
}
---
{
	"EnergyUsage": [{
		"Usage": [{
			"EnergyKWattHour": 0.0538
		}, {
			"EnergyKWattHour": 0.0178
		}, {
			"EnergyKWattHour": 0.0365
		}, {
			"EnergyKWattHour": 0.0403
		}, {
			"EnergyKWattHour": 0.0472
		}, {
			"EnergyKWattHour": 0.049
		}, {
			"EnergyKWattHour": 0.0417
		}]
	}],
	"ErrorCode": 0
}

I tried all year (“ViewType”: 4) result with combination of now DateTime. On last array field is actual month.

try something like this and utility_meter fot this value?

value_template: "{{ value_json.EnergyUsage[0].Usage[-1].EnergyKWattHour | round(2)}}"

The problem is the values don’t make any sense to me (yet!), but I haven’t really had the time to dive into that part yet. I’ve just updated the code and for me it’s working pretty well now :slight_smile:

Im working on publishing it to HACS!

yes, this values are chaotic :slight_smile:

I sync by configuration.yaml at this time only monthly consumption.

ViewType = 1 is hourly energy
ViewType = 2 is daily energy
ViewType = 3 same like 2?
ViewType = 4 is monthly energy

I compare the values with the application, but it is very confusing…

Hello, at this time I have basic consumption from thermostats…it’s based on API data download via configuration.yaml. However, I can’t put the current date in the payload, so it’s only for manual editing. I suppose this can be solved directly in python, but I’m not good at it yet.

I use this configuration.yaml:

  - platform: rest
    resource: https://ocd5.azurewebsites.net:443/api/UserProfile/SignIn
    headers:
      Content-Type: application/json
    name: oj_sid_token
    method: POST
    payload: '{"APIKEY": "f219aab4-9ac0-4343-8422-b72203e2fac9","ClientSWVersion": 1060,"CustomerId": 99,"Password": "****","UserName": "*****"}'
    value_template: '{{ value_json.SessionId }}'
    scan_interval: 3600

  - platform: rest
    name: oj_obyvak_energy
    method: POST
    headers:
      Content-Type: application/json
    resource_template: https://owd5-mh015-app.ojelectronics.com/api/EnergyUsage/GetEnergyUsage?sessionid={{ states.sensor.oj_sid_token.state }}
    payload: '{"APIKEY": "f219aab4-9ac0-4343-8422-b72203e2fac9","DateTime": "2023-01-08","History": 0,"ThermostatID": "140092","ViewType": 4}'
    value_template: "{{ value_json.EnergyUsage[0].Usage[-1].EnergyKWattHour | round(2)}}"
    unit_of_measurement: "kWh"
    device_class: power
    scan_interval: 60

but problem is here: payload: ‘{“APIKEY”: “f219aab4-9ac0-4343-8422-b72203e2fac9”,“DateTime”: “2023-01-08”,“History”: 0,“ThermostatID”: “140092”,“ViewType”: 4}’
I need change date by actual date, but payload doesnt support templates. Any ideas?

Finally I use utility_meter for calculate energy consumption. Its work nice :slight_smile:

I think you can dow something like: now().strftime("%Y-%m-%d"), so these values are correctly interpreted? then maybe I can include them in the package.

Thank you I tried this, but in payload is not allowed use templates…

If you can implement this on your package, it will be nice :slight_smile:

Hello and Good Morning,

im also using the Schluter Ditra. how did you get the API Key? where can i find this?

Hi @Soccs,

this is the api key:

2 Likes

Hi, I would be also interested in recovering power consumption. Any progress on this topic?
Thx

2 Likes

Hi Robin, maybe a stupid question, but how do i get the api key from the app (ios)? love to test the integration!

Hi Jory,

Stupid question do not exist :slight_smile: Getting the api key is quite a challenge. I did it by unpacking an android APK, adding a SSL Certificate provided by Charles network sniffer, repacked the apk and ran the app through an android emulator on my macbook. Then used Charles to sniff the network traffic and get the api key from the headers… not so easy at all​:sweat_smile:

What is your provider? Have you tried the api keys shared here? I am using the SWATT App on the iphone. I can share the api key im using it you want, just sent me a dm.

Just a small update, if anyone like to play with the API.
https://ocd5.azurewebsites.net/swagger/ui/index

I have just started testing a little, need to learn a bit of Python as well…

1 Like

Anybody had luck with CustomerId of 23 (Comfort Heat - Australia) ?

The Android app seems to be hitting owd5-r1099-app.ojelectronics.com but having tried this url and others above I can’t seem to login. I have tried CustomerId and ClientSWVersion quoted and non-quoted via the Swagger page, but keep getting the following

{
  "SessionId": "",
  "UserName": "",
  "ErrorCode": 1
}

Hi all. I have just stumbled onto “OJ Microline Thermostat” integration in HACS. I am running the Australian version of the MWD5 (Thermotouch WiFi 5235W).

I accepted the default host and user id parameters, and filled the API key from post 72

f219aab4-9ac0-4343-8422-b72203e2fac9

and added my user name and password from the app.

It loaded immediately and at first look, most, if not all, entities are available. EDIT: interactions seem okay, next project is to look at automations.

Batts

1 Like

Has anyone set this up recently?

I have tried the various host names mentioned here (see below) and on GitHub with the API Key from the same places, with various customer ID (99, 111, the one from the SWATT App)

All of them return “Invalid authentication”. I don’t have an Android Phone to try and sniff what host it is using, is there any other way to get this working?

ocd5.azurewebsites.net
owd5-mh015-app.ojelectronics.com
owd5-r1099-app.ojelectronics.com
owd5-sl003-app.ojelectronics.com