Closed misko903 closed 2 years ago
Hi @misko903, Yes, that should not really be a problem.
I just need the websocket request. You can get it with a man in the middle
program like charles proxy.
But perhaps if we are lucky it is already in the start.yml
please do paste it here if you have it. we will go from there.
ok, where I can find start.yml? thanks, M
Hi @misko903 In the branch v1.2-work
there in the files directory is a start.yml
Either fill in your serial number and search_ip:
to true
of your ip and search_ip:
to false.
Copy one example file from the examples
folder to the root folder and if you run that your start.yml
should get new values added to it.
Eventually when its in master it will be documented in the readme
Perhaps this little script will help us:
from websocket import create_connection
import json, datetime, time, string, random
locale.setlocale(locale.LC_ALL, '')
# Define a random string to send to the device
def randomString(stringLength=5):
"""Generate a random string of fixed length """
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength))
ip = "192.168.2.130"
ws = create_connection("ws://"+ip+"/mca")
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNCSE-node/deviceInfo\",\"fr\":\"/\",\"rqi\":\""+randomString()+"\"}}")
js_function = json.loads(ws.recv())
print(js_function)
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNAE/0/UnitProfile/la\",\"fr\":\"/\",\"rqi\":\""+randomString()+"\"}}")
js_function = json.loads(ws.recv())
print(js_function)
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNAE/1/UnitProfile/la\",\"fr\":\"/\",\"rqi\":\""+randomString()+"\"}}")
js_function = json.loads(ws.recv())
print(js_function)
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNAE/2/UnitProfile/la\",\"fr\":\"/\",\"rqi\":\""+randomString()+"\"}}")
js_function = json.loads(ws.recv())
print(js_function)
Thanks for idea, but slower, please :) In /home/pi I have created a file called daikinSG and copied the text into it. Then sudo chmod 777. What to do next?
Thank you :)
Well as this script does not have a shebang,
python3 ./home/pi/daikinSG
It should output stuff please paste it below
openhabian@openHABianDevice:~ $ python3 daikinSG
Traceback (most recent call last):
File "daikinSG", line 1, in <module>
from websocket import create_connection
ModuleNotFoundError: No module named 'websocket'
primitive question - do I need to install the new - 1.2 branch?
no just run:
python3 -m pip install websocket
then try again
I have installed websocket also with sudo command.
now the result (does not matter if with sudo, or without):
openhabian@openHABianDevice:~ $ python3 daikinSG
Traceback (most recent call last):
File "daikinSG", line 1, in <module>
from websocket import create_connection
ImportError: cannot import name 'create_connection' from 'websocket' (/home/openhabian/.local/lib/python3.7/site-packages/websocket/__init__.py)
Hi,
Ah yes, Sorry about that:
python3 -m pip install websocket-client
There should be no need for sudo,, unless you want to install it globally for all the users on the pi
thanks, now this:
openhabian@openHABianDevice:~ $ python3 daikinSG
Traceback (most recent call last):
File "daikinSG", line 3, in <module>
locale.setlocale(locale.LC_ALL, '')
NameError: name 'locale' is not defined
RIght here you go :
from websocket import create_connection
import json, datetime, time, string, random
# Define a random string to send to the device
def randomString(stringLength=5):
"""Generate a random string of fixed length """
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength))
ip = "192.168.2.130"
ws = create_connection("ws://"+ip+"/mca")
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNCSE-node/deviceInfo\",\"fr\":\"/\",\"rqi\":\""+randomString()+"\"}}")
js_function = json.loads(ws.recv())
print(js_function)
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNAE/0/UnitProfile/la\",\"fr\":\"/\",\"rqi\":\""+randomString()+"\"}}")
js_function = json.loads(ws.recv())
print(js_function)
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNAE/1/UnitProfile/la\",\"fr\":\"/\",\"rqi\":\""+randomString()+"\"}}")
js_function = json.loads(ws.recv())
print(js_function)
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNAE/2/UnitProfile/la\",\"fr\":\"/\",\"rqi\":\""+randomString()+"\"}}")
js_function = json.loads(ws.recv())
print(js_function)
Forgot to change IP. now it answers:
openhabian@openHABianDevice:~ $ python3 daikinSG
{'m2m:rsp': {'rsc': 2000, 'rqi': 'joahl', 'to': '/', 'fr': '/[0]/MNCSE-node/deviceInfo', 'pc': {'m2m:dvi': {'rn': 'deviceInfo', 'ri': '0080', 'pi': '007e', 'ty': 13, 'ct': '20000000T000000Z', 'lt': '20000000T000000Z', 'st': 0, 'mgd': 1007, 'dlb': '194800246', 'man': 'Daikin', 'mod': 'BRP069A61', 'dty': 'HVAC controller', 'fwv': '17003908', 'swv': '436CC148000', 'hwv': ''}}}}
{'m2m:rsp': {'rsc': 2000, 'rqi': 'nxvwy', 'to': '/', 'fr': '/[0]/MNAE/0/UnitProfile/la', 'pc': {'m2m:cin': {'rn': '00000002', 'ri': '0073_00000002', 'pi': '0073', 'ty': 4, 'ct': '20211012T072803Z', 'lt': '20211012T072803Z', 'st': 2, 'con': '{"SyncStatus":"reboot","UnitStatus":["ErrorState"],"DateTime":{"DateTimeAdjustable":false}}'}}}}
{'m2m:rsp': {'rsc': 2000, 'rqi': 'tukru', 'to': '/', 'fr': '/[0]/MNAE/1/UnitProfile/la', 'pc': {'m2m:cin': {'rn': '00000004', 'ri': '0006_00000004', 'pi': '0006', 'ty': 4, 'ct': '20211014T103234Z', 'lt': '20211014T103234Z', 'st': 4, 'con': '{"SyncStatus":"update","Sensor":["IndoorTemperature","OutdoorTemperature","LeavingWaterTemperatureCurrent"],"UnitStatus":["ErrorState","InstallerState","WarningState","EmergencyState","TargetTemperatureOverruledState"],"Operation":{"Power":["on","standby"],"OperationMode":["heating","cooling","auto"],"TargetTemperature":{"heating":{"maxValue":30.0000000000000000,"minValue":12.0000000000000000,"stepValue":0.5000000000000000},"cooling":{"maxValue":35.0000000000000000,"minValue":15.0000000000000000,"stepValue":0.5000000000000000},"auto":{"maxValue":30.0000000000000000,"minValue":12.0000000000000000,"stepValue":0.5000000000000000}},"RoomTemperatureHeating":{"maxValue":30.0000000000000000,"minValue":12.0000000000000000,"stepValue":0.5000000000000000,"settable":true},"RoomTemperatureCooling":{"maxValue":35.0000000000000000,"minValue":15.0000000000000000,"stepValue":0.5000000000000000,"settable":true},"RoomTemperatureAuto":{"maxValue":30.0000000000000000,"minValue":12.0000000000000000,"stepValue":0.5000000000000000,"settable":true},"LeavingWaterTemperatureOffsetHeating":{"maxValue":10,"minValue":-10,"stepValue":1,"settable":true},"LeavingWaterTemperatureCooling":{"maxValue":22,"minValue":18,"stepValue":1,"settable":true}},"Schedule":{"Base":"action","defaultScheduleAvailable":"true","NameAdjustable":"false","List":{"heating":[{"StartTime":{"stepValue":10.0000000000000000,"unit":"minutes"},"TargetTemperature":{"heating":{"maxValue":30.0000000000000000,"minValue":12.0000000000000000,"stepValue":1}},"Actions":["StartTime","TargetTemperature"],"maxActionsAllowed":6},["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],[]],"cooling":[{"StartTime":{"stepValue":10.0000000000000000,"unit":"minutes"},"TargetTemperature":{"cooling":{"maxValue":35.0000000000000000,"minValue":15.0000000000000000,"stepValue":1}},"Actions":["StartTime","TargetTemperature"],"maxActionsAllowed":6},["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],[]]}},"Consumption":{"Electrical":{"unit":"kWh","Heating":{"Daily":{"contentCount":24,"resolution":2},"Weekly":{"contentCount":14,"resolution":1},"Monthly":{"contentCount":24,"resolution":1}},"Cooling":{"Daily":{"contentCount":24,"resolution":2},"Weekly":{"contentCount":14,"resolution":1},"Monthly":{"contentCount":24,"resolution":1}}}}}'}}}}
{'m2m:rsp': {'rsc': 2000, 'rqi': 'tuxjp', 'to': '/', 'fr': '/[0]/MNAE/2/UnitProfile/la', 'pc': {'m2m:cin': {'rn': '00000002', 'ri': '0042_00000002', 'pi': '0042', 'ty': 4, 'ct': '20211012T072943Z', 'lt': '20211012T072943Z', 'st': 2, 'con': '{"SyncStatus":"reboot","Sensor":["TankTemperature"],"UnitStatus":["ErrorState","InstallerState","WeatherDependentState","WarningState","EmergencyState","TargetTemperatureOverruledState"],"Operation":{"Power":["on","standby"],"OperationMode":["heating"],"TargetTemperature":{"heating":{}},"DomesticHotWaterTemperatureHeating":{"maxValue":60.0000000000000000,"minValue":30.0000000000000000,"stepValue":1.0000000000000000,"settable":false},"powerful":["0","1"]},"Schedule":{"Base":"action","defaultScheduleAvailable":"false","NameAdjustable":"false","List":{"heating":[{"StartTime":{"stepValue":10.0000000000000000,"unit":"minute"},"TargetTemperature":{"heating":{"maxValue":60.0000000000000000,"minValue":30.0000000000000000,"stepValue":1.0000000000000000}},"Actions":["StartTime","TargetTemperature"],"maxActionsAllowed":4},["monday","tuesday","wednesday","thursday","friday","saturday","sunday"]]}},"Consumption":{"Electrical":{"unit":"kWh","Heating":{"Daily":{"contentCount":24,"resolution":2},"Weekly":{"contentCount":14,"resolution":1},"Monthly":{"contentCount":24,"resolution":1}}}}}'}}}}
Thanks can you try these too:
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNAE/3/UnitProfile/la\",\"fr\":\"/\",\"rqi\":\""+randomString()+"\"}}")
js_function = json.loads(ws.recv())
print(js_function)
ws.send("{\"m2m:rqp\":{\"op\":2,\"to\":\"/[0]/MNAE/4/UnitProfile/la\",\"fr\":\"/\",\"rqi\":\""+randomString()+"\"}}")
js_function = json.loads(ws.recv())
print(js_function)
they should return 404 errors, but lets be sure :) Ill see if i can find the settings in there somewhere
Running the results trough a json linter I dont see any specific setting you can change for this port,, I dont think daikin is swtiching it on or off with software,,, but perhaps there is a result in device 3 / 4
{
"SyncStatus": "update",
"Sensor": ["IndoorTemperature", "OutdoorTemperature", "LeavingWaterTemperatureCurrent"],
"UnitStatus": ["ErrorState", "InstallerState", "WarningState", "EmergencyState", "TargetTemperatureOverruledState"],
"Operation": {
"Power": ["on", "standby"],
"OperationMode": ["heating", "cooling", "auto"],
"TargetTemperature": {
"heating": {
"maxValue": 30.0000000000000000,
"minValue": 12.0000000000000000,
"stepValue": 0.5000000000000000
},
"cooling": {
"maxValue": 35.0000000000000000,
"minValue": 15.0000000000000000,
"stepValue": 0.5000000000000000
},
"auto": {
"maxValue": 30.0000000000000000,
"minValue": 12.0000000000000000,
"stepValue": 0.5000000000000000
}
},
"RoomTemperatureHeating": {
"maxValue": 30.0000000000000000,
"minValue": 12.0000000000000000,
"stepValue": 0.5000000000000000,
"settable": true
},
"RoomTemperatureCooling": {
"maxValue": 35.0000000000000000,
"minValue": 15.0000000000000000,
"stepValue": 0.5000000000000000,
"settable": true
},
"RoomTemperatureAuto": {
"maxValue": 30.0000000000000000,
"minValue": 12.0000000000000000,
"stepValue": 0.5000000000000000,
"settable": true
},
"LeavingWaterTemperatureOffsetHeating": {
"maxValue": 10,
"minValue": -10,
"stepValue": 1,
"settable": true
},
"LeavingWaterTemperatureCooling": {
"maxValue": 22,
"minValue": 18,
"stepValue": 1,
"settable": true
}
},
"Schedule": {
"Base": "action",
"defaultScheduleAvailable": "true",
"NameAdjustable": "false",
"List": {
"heating": [{
"StartTime": {
"stepValue": 10.0000000000000000,
"unit": "minutes"
},
"TargetTemperature": {
"heating": {
"maxValue": 30.0000000000000000,
"minValue": 12.0000000000000000,
"stepValue": 1
}
},
"Actions": ["StartTime", "TargetTemperature"],
"maxActionsAllowed": 6
},
["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"],
["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"],
["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"],
[]
],
"cooling": [{
"StartTime": {
"stepValue": 10.0000000000000000,
"unit": "minutes"
},
"TargetTemperature": {
"cooling": {
"maxValue": 35.0000000000000000,
"minValue": 15.0000000000000000,
"stepValue": 1
}
},
"Actions": ["StartTime", "TargetTemperature"],
"maxActionsAllowed": 6
},
["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"],
[]
]
}
},
"Consumption": {
"Electrical": {
"unit": "kWh",
"Heating": {
"Daily": {
"contentCount": 24,
"resolution": 2
},
"Weekly": {
"contentCount": 14,
"resolution": 1
},
"Monthly": {
"contentCount": 24,
"resolution": 1
}
},
"Cooling": {
"Daily": {
"contentCount": 24,
"resolution": 2
},
"Weekly": {
"contentCount": 14,
"resolution": 1
},
"Monthly": {
"contentCount": 24,
"resolution": 1
}
}
}
}
}
and
{
"SyncStatus": "reboot",
"Sensor": ["TankTemperature"],
"UnitStatus": ["ErrorState", "InstallerState", "WeatherDependentState", "WarningState", "EmergencyState", "TargetTemperatureOverruledState"],
"Operation": {
"Power": ["on", "standby"],
"OperationMode": ["heating"],
"TargetTemperature": {
"heating": {}
},
"DomesticHotWaterTemperatureHeating": {
"maxValue": 60.0000000000000000,
"minValue": 30.0000000000000000,
"stepValue": 1.0000000000000000,
"settable": false
},
"powerful": ["0", "1"]
},
"Schedule": {
"Base": "action",
"defaultScheduleAvailable": "false",
"NameAdjustable": "false",
"List": {
"heating": [{
"StartTime": {
"stepValue": 10.0000000000000000,
"unit": "minute"
},
"TargetTemperature": {
"heating": {
"maxValue": 60.0000000000000000,
"minValue": 30.0000000000000000,
"stepValue": 1.0000000000000000
}
},
"Actions": ["StartTime", "TargetTemperature"],
"maxActionsAllowed": 4
},
["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
]
}
},
"Consumption": {
"Electrical": {
"unit": "kWh",
"Heating": {
"Daily": {
"contentCount": 24,
"resolution": 2
},
"Weekly": {
"contentCount": 14,
"resolution": 1
},
"Monthly": {
"contentCount": 24,
"resolution": 1
}
}
}
}
}
result after adding your should-be-404 to the end:
openhabian@openHABianDevice:~ $ python3 daikinSG
{'m2m:rsp': {'rsc': 2000, 'rqi': 'qxomc', 'to': '/', 'fr': '/[0]/MNCSE-node/deviceInfo', 'pc': {'m2m:dvi': {'rn': 'deviceInfo', 'ri': '0080', 'pi': '007e', 'ty': 13, 'ct': '20000000T000000Z', 'lt': '20000000T000000Z', 'st': 0, 'mgd': 1007, 'dlb': '194800246', 'man': 'Daikin', 'mod': 'BRP069A61', 'dty': 'HVAC controller', 'fwv': '17003908', 'swv': '436CC148000', 'hwv': ''}}}}
{'m2m:rsp': {'rsc': 2000, 'rqi': 'uowhx', 'to': '/', 'fr': '/[0]/MNAE/0/UnitProfile/la', 'pc': {'m2m:cin': {'rn': '00000002', 'ri': '0073_00000002', 'pi': '0073', 'ty': 4, 'ct': '20211012T072803Z', 'lt': '20211012T072803Z', 'st': 2, 'con': '{"SyncStatus":"reboot","UnitStatus":["ErrorState"],"DateTime":{"DateTimeAdjustable":false}}'}}}}
{'m2m:rsp': {'rsc': 2000, 'rqi': 'epruq', 'to': '/', 'fr': '/[0]/MNAE/1/UnitProfile/la', 'pc': {'m2m:cin': {'rn': '00000004', 'ri': '0006_00000004', 'pi': '0006', 'ty': 4, 'ct': '20211014T103234Z', 'lt': '20211014T103234Z', 'st': 4, 'con': '{"SyncStatus":"update","Sensor":["IndoorTemperature","OutdoorTemperature","LeavingWaterTemperatureCurrent"],"UnitStatus":["ErrorState","InstallerState","WarningState","EmergencyState","TargetTemperatureOverruledState"],"Operation":{"Power":["on","standby"],"OperationMode":["heating","cooling","auto"],"TargetTemperature":{"heating":{"maxValue":30.0000000000000000,"minValue":12.0000000000000000,"stepValue":0.5000000000000000},"cooling":{"maxValue":35.0000000000000000,"minValue":15.0000000000000000,"stepValue":0.5000000000000000},"auto":{"maxValue":30.0000000000000000,"minValue":12.0000000000000000,"stepValue":0.5000000000000000}},"RoomTemperatureHeating":{"maxValue":30.0000000000000000,"minValue":12.0000000000000000,"stepValue":0.5000000000000000,"settable":true},"RoomTemperatureCooling":{"maxValue":35.0000000000000000,"minValue":15.0000000000000000,"stepValue":0.5000000000000000,"settable":true},"RoomTemperatureAuto":{"maxValue":30.0000000000000000,"minValue":12.0000000000000000,"stepValue":0.5000000000000000,"settable":true},"LeavingWaterTemperatureOffsetHeating":{"maxValue":10,"minValue":-10,"stepValue":1,"settable":true},"LeavingWaterTemperatureCooling":{"maxValue":22,"minValue":18,"stepValue":1,"settable":true}},"Schedule":{"Base":"action","defaultScheduleAvailable":"true","NameAdjustable":"false","List":{"heating":[{"StartTime":{"stepValue":10.0000000000000000,"unit":"minutes"},"TargetTemperature":{"heating":{"maxValue":30.0000000000000000,"minValue":12.0000000000000000,"stepValue":1}},"Actions":["StartTime","TargetTemperature"],"maxActionsAllowed":6},["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],[]],"cooling":[{"StartTime":{"stepValue":10.0000000000000000,"unit":"minutes"},"TargetTemperature":{"cooling":{"maxValue":35.0000000000000000,"minValue":15.0000000000000000,"stepValue":1}},"Actions":["StartTime","TargetTemperature"],"maxActionsAllowed":6},["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],[]]}},"Consumption":{"Electrical":{"unit":"kWh","Heating":{"Daily":{"contentCount":24,"resolution":2},"Weekly":{"contentCount":14,"resolution":1},"Monthly":{"contentCount":24,"resolution":1}},"Cooling":{"Daily":{"contentCount":24,"resolution":2},"Weekly":{"contentCount":14,"resolution":1},"Monthly":{"contentCount":24,"resolution":1}}}}}'}}}}
{'m2m:rsp': {'rsc': 2000, 'rqi': 'mewsp', 'to': '/', 'fr': '/[0]/MNAE/2/UnitProfile/la', 'pc': {'m2m:cin': {'rn': '00000002', 'ri': '0042_00000002', 'pi': '0042', 'ty': 4, 'ct': '20211012T072943Z', 'lt': '20211012T072943Z', 'st': 2, 'con': '{"SyncStatus":"reboot","Sensor":["TankTemperature"],"UnitStatus":["ErrorState","InstallerState","WeatherDependentState","WarningState","EmergencyState","TargetTemperatureOverruledState"],"Operation":{"Power":["on","standby"],"OperationMode":["heating"],"TargetTemperature":{"heating":{}},"DomesticHotWaterTemperatureHeating":{"maxValue":60.0000000000000000,"minValue":30.0000000000000000,"stepValue":1.0000000000000000,"settable":false},"powerful":["0","1"]},"Schedule":{"Base":"action","defaultScheduleAvailable":"false","NameAdjustable":"false","List":{"heating":[{"StartTime":{"stepValue":10.0000000000000000,"unit":"minute"},"TargetTemperature":{"heating":{"maxValue":60.0000000000000000,"minValue":30.0000000000000000,"stepValue":1.0000000000000000}},"Actions":["StartTime","TargetTemperature"],"maxActionsAllowed":4},["monday","tuesday","wednesday","thursday","friday","saturday","sunday"]]}},"Consumption":{"Electrical":{"unit":"kWh","Heating":{"Daily":{"contentCount":24,"resolution":2},"Weekly":{"contentCount":14,"resolution":1},"Monthly":{"contentCount":24,"resolution":1}}}}}'}}}}
{'m2m:rsp': {'rsc': 4004, 'rqi': 'nvtfl', 'to': '/', 'fr': '/[0]/MNAE/3/UnitProfile/la'}}
{'m2m:rsp': {'rsc': 4004, 'rqi': 'wffof', 'to': '/', 'fr': '/[0]/MNAE/4/UnitProfile/la'}}
looks like no answer for me, righ? there is a web interface after I power cycle the LAN adapter. There are some Smart Grid settings. after 2 hours, web interface is gone. Should I link the Daikin SG adaptor manual here?
Thaw web interface, yes I know of its existence, not much you can do there i am afraid, there is also a telnet session open for the same duration,, but no luck yet on finding the password.
The manual not sure if its needed,, not even sure if you can change this in the app ? IF you can its up to a man in the middle attack to fish the setting...
No, Smart Grid options/settings are not present in the Daikin App. Shame on them :) Anyway, when you will find something, I hope you let it know :) I am still using the master branch, but I am looking forward to upgrade it to the latest later! Have a good one, thanks for your work!
Hi william, thanks for your program! I am an owner of BRP069A61 LAN adaptor, which is practically the same, but with Smard Grid / Photovoltaics ports to switch ON/OFF my Altherma. Do you think it will be possible to integrate the SG functions to your software?
Thanks, Michal