scottyphillips / pychonet

A simple to use library for interfacing with the ECHONETlite protocol
GNU General Public License v3.0
19 stars 17 forks source link

add group 1 class 35 air cleaner support #36

Closed leonunix closed 2 years ago

leonunix commented 2 years ago

add air cleaner support . Now only sharp air cleaner support it. Also there is something unkown field. But in ECHONET SPECIFICATION APPENDIX field are supported in this pull request.

[{'class': ('0x35', 'Air cleaner'), 'getmap': [('0x80', 'Operation status'), ('0xa0', 'Air flow rate setting'), ('0xc0', 'Air pollution detection status'), ('0xf0', 'Unknown'), ('0x81', 'Installation location'), ('0xf1', 'Unknown'), ('0x82', 'Standard version information'), ('0xf2', 'Unknown'), ('0xf3', 'Unknown'), ('0x84', 'Measured instantaneous power consumption'), ('0x85', 'Measured cumulative power consumption'), ('0x86', 'Manufacturers fault code'), ('0x88', 'Fault status'), ('0x89', 'Fault description'), ('0x8a', 'Manufacturer code'), ('0x8b', 'Business facility code'), ('0x8c', 'Product code'), ('0xfc', 'Unknown'), ('0x9d', 'Status change announcement property map'), ('0xfd', 'Unknown'), ('0x9e', 'Set property map'), ('0x9f', 'Get property map')], 'group': ('0x1', 'Air conditioner-related device group'), 'host': '172.16.1.118', 'instance': '0x1', 'manufacturer': 'Sharp', 'setmap': [('0x80', 'Operation status'), ('0x81', 'Installation location'), ('0xa0', 'Air flow rate setting'), ('0xf3', 'Unknown')], 'uid': None}]

scottyphillips commented 2 years ago

You legend! Thanks so much for your contribution!

scottyphillips commented 2 years ago

I am pretty certain that Sharp has implemented a LOT of vendor specific EPC codes - which is why most of those field are 'unknown'. Unless we have some means of obtaining the vendor documentation to describe what those fields do, we won't have a way of implementing that functionality correctly. As it stands we would likely have to create a kludge (like a SharpAirCleaner class) to implement the non-standard functionality.

glockpete commented 2 years ago

(0xF1) Returns the temperature and humidity. This website (In Japanese) says this and I replicated the results myself using SSNG application.

leonunix commented 2 years ago

I think 0xf3 may be Humidifier on/off 0xf1 return temperature and humidity in only 4 bytes. So what is other info. And there is a pm2.5 sensor on it.

this is return

12:52:30,T,172.16.1.118,1081 000E 05FF01 013501 62 01 F0 00 12:52:30,R,172.16.1.118,1081 000E 013501 05FF01 72 01 F0 20 00000000060000003D0181000BB80BB804E2E14A380000000000000000030001 12:52:39,T,172.16.1.118,1081 000F 05FF01 013501 62 01 F1 00 12:52:39,R,172.16.1.118,1081 000F 013501 05FF01 72 01 F1 28 6400D91734070000000000000B2E8B2C9B0000000B000D7D160000000402C502C50000007A7A0116 12:52:59,T,172.16.1.118,1081 0100 05FF01 013501 62 01 F2 00 12:52:59,R,172.16.1.118,1081 0100 013501 05FF01 72 01 F2 28 00000000000000000000000000000019001901FFFF00000080FF0000000200000000000000000000 12:53:05,T,172.16.1.118,1081 0101 05FF01 013501 62 01 F3 00 12:53:05,R,172.16.1.118,1081 0101 013501 05FF01 72 01 F3 1B 000000000000000083000000000000FF0000000000000000000000

scottyphillips commented 2 years ago

0xF1 EDT = 6400D91734070000000000000B2E8B2C9B0000000B000D7D160000000402C502C50000007A7A0116

If that website (and google translate) is correct, those bytes above in Bold are the temperature and humidity? would that be correct for that particular output? (17h being 23 degrees, and 34h being 52% humidity?)

There is a lot of other data in there - no idea what that would be for, but its easy enough to pull the individual bytes into a dict with something like this:

def _0135F1_sharp(edt):
     return {'temp': int.from_bytes(edt[3:4], 'big'), 'humidity' : int.from_bytes(edt[4:5], 'big')}

But here is my issues with this - it is not in the ECHONET spec. I am pretty loathed to start including all this vendor specific stuff because I will have to create escape routines to run vendor specific functions - and all the other data must mean something. It would be more appropriate to parse the raw data in the home assistant component using template sensors.

At any rate, can we try to test the air cleaner in the latest code as is and see if we can get the device even added to Home Assistant? All I want to focus on at the moment are the EPCs that are documented in the spec. We can work out what to do with vendor specific EPCs later once we know the component is working.

leonunix commented 2 years ago

@scottyphillips one question of add to home assistant. sharp have not return uid. How we can set a uid in home assistant?

scottyphillips commented 2 years ago

If the UID is none, It should generate a unique UID based upon the IP address and the combined EOJGC-EOJCC-EOJCI values.