peterbuga / HASS-sonoff-ewelink

Home Assistant component to control Sonoff/eWeLink devices with original firmware
MIT License
794 stars 293 forks source link

Sonoff RF Bridge integration #38

Open peterbuga opened 5 years ago

peterbuga commented 5 years ago

This dumps contain one single _Wireless Door Window Detector_

Open door detector

[
   {
      "__v":0,
      "_id":"[hidden]",
      "apikey":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "brandName":"Sonoff",
      "createdAt":"xxxx-xx-xxxxx:xx:xx.xxx",
      "deviceStatus":"",
      "deviceUrl":"",
      "deviceid":"[hidden]",
      "devicekey":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "extra":{
         "_id":"[hidden]",
         "extra":{
            "apmac":"xx:xx:xx:xx:xx:xx",
            "brandId":"58e5f344baeb368720e25469",
            "description":"WO1852",
            "mac":"xx:xx:xx:xx:xx:xx",
            "manufacturer":"\u6df1\u5733\u677e\u8bfa\u6280\u672f\u6709\u9650\u516c\u53f8",
            "model":"PSC-B67-GL",
            "modelInfo":"5a2e1ae50cf772f92c342ef6",
            "ui":"\u529f\u7387\u68c0\u6d4b\u63d2\u5ea7\u8fc7\u8f7d\u544a\u8b66",
            "uiid":32
         }
      },
      "group":"",
      "groups":[

      ],
      "ip":"[hidden]",
      "location":"",
      "name":"[hidden]",
      "offlineTime":"xxxx-xx-xxxxx:xx:xx.xxx",
      "online":true,
      "onlineTime":"xxxx-xx-xxxxx:xx:xx.xxx",
      "params":{
         "alarmCValue":[
            -1,
            -1
         ],
         "alarmPValue":[
            -1,
            -1
         ],
         "alarmType":"pcv",
         "alarmVValue":[
            -1,
            -1
         ],
         "controlType":8,
         "current":"0.16",
         "endTime":"",
         "fwVersion":"2.8.0",
         "hundredDaysKwh":"get",
         "init":1,
         "oneKwh":"get",
         "partnerApikey":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
         "power":"21.90",
         "rssi":-60,
         "sledOnline":"on",
         "staMac":"xx:xx:xx:xx:xx:xx",
         "startTime":"xxxx-xx-xxxxx:xx:xx.xxx",
         "switch":"on",
         "timeZone":2,
         "voltage":"235.62"
      },
      "productModel":"Pow_R2",
      "settings":{
         "alarmNotify":1,
         "opsHistory":1,
         "opsNotify":0
      },
      "sharedTo":[

      ],
      "showBrand":true,
      "type":"10",
      "uiid":32
   },
   {
      "__v":0,
      "_id":"[hidden]",
      "apikey":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "brandName":"Sonoff",
      "createdAt":"xxxx-xx-xxxxx:xx:xx.xxx",
      "deviceStatus":"",
      "deviceUrl":"",
      "deviceid":"[hidden]",
      "devicekey":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "extra":{
         "_id":"[hidden]",
         "extra":{
            "apmac":"xx:xx:xx:xx:xx:xx",
            "brandId":"58e5f344baeb368720e25469",
            "description":"WO1851",
            "mac":"xx:xx:xx:xx:xx:xx",
            "manufacturer":"\u6df1\u5733\u677e\u8bfa\u6280\u672f\u6709\u9650\u516c\u53f8",
            "model":"PSF-BRA-GL",
            "modelInfo":"5a2e1b360cf772f92c342f01",
            "ui":"RFBridge",
            "uiid":28
         }
      },
      "group":"",
      "groups":[

      ],
      "ip":"[hidden]",
      "location":"",
      "name":"[hidden]",
      "offlineTime":"xxxx-xx-xxxxx:xx:xx.xxx",
      "online":true,
      "onlineTime":"xxxx-xx-xxxxx:xx:xx.xxx",
      "params":{
         "cmd":"trigger",
         "fwVersion":"2.7.0",
         "init":1,
         "rfChl":0,
         "rfList":[
            {
               "rfChl":0,
               "rfVal":"331801CC0582EE4D13"
            }
         ],
         "rfTrig0":"xxxx-xx-xxxxx:xx:xx.xxx",
         "rssi":-37,
         "sledOnline":"on",
         "timers":[

         ]
      },
      "productModel":"RF_Bridge",
      "settings":{
         "alarmNotify":1,
         "opsHistory":1,
         "opsNotify":0
      },
      "sharedTo":[

      ],
      "showBrand":true,
      "tags":{
         "disable_timers":[

         ],
         "zyx_info":[
            {
               "buttonName":[
                  {
                     "0":"Button Name1"
                  }
               ],
               "name":"[hidden]",
               "remote_type":"6"
            }
         ]
      },
      "type":"10",
      "uiid":28
   }
]

Closed door detector

[ { "__v": 0, "_id": "[hidden]" "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "brandName": "Sonoff", "createdAt": "xxxx-xx-xxxxx:xx:xx.xxx", "deviceStatus": "", "deviceUrl": "", "deviceid": "[hidden]" "devicekey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "extra": { "_id": "[hidden]" "extra": { "apmac": "xx:xx:xx:xx:xx:xx", "brandId": "58e5f344baeb368720e25469", "description": "WO1852", "mac": "xx:xx:xx:xx:xx:xx", "manufacturer": "\u6df1\u5733\u677e\u8bfa\u6280\u672f\u6709\u9650\u516c\u53f8", "model": "PSC-B67-GL", "modelInfo": "5a2e1ae50cf772f92c342ef6", "ui": "\u529f\u7387\u68c0\u6d4b\u63d2\u5ea7\u8fc7\u8f7d\u544a\u8b66", "uiid": 32 } }, "group": "", "groups": [], "ip": "[hidden]" "location": "", "name": "[hidden]", "offlineTime": "xxxx-xx-xxxxx:xx:xx.xxx", "online": true, "onlineTime": "xxxx-xx-xxxxx:xx:xx.xxx", "params": { "alarmCValue": [ -1, -1 ], "alarmPValue": [ -1, -1 ], "alarmType": "pcv", "alarmVValue": [ -1, -1 ], "controlType": 8, "current": "0.16", "endTime": "", "fwVersion": "2.8.0", "hundredDaysKwh": "get", "init": 1, "oneKwh": "get", "partnerApikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "power": "21.87", "rssi": -60, "sledOnline": "on", "staMac": "xx:xx:xx:xx:xx:xx", "startTime": "xxxx-xx-xxxxx:xx:xx.xxx", "switch": "on", "timeZone": 2, "voltage": "232.78" }, "productModel": "Pow_R2", "settings": { "alarmNotify": 1, "opsHistory": 1, "opsNotify": 0 }, "sharedTo": [], "showBrand": true, "type": "10", "uiid": 32 }, { "__v": 0, "_id": "[hidden]" "apikey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "brandName": "Sonoff", "createdAt": "xxxx-xx-xxxxx:xx:xx.xxx", "deviceStatus": "", "deviceUrl": "", "deviceid": "[hidden]" "devicekey": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "extra": { "_id": "[hidden]" "extra": { "apmac": "xx:xx:xx:xx:xx:xx", "brandId": "58e5f344baeb368720e25469", "description": "WO1851", "mac": "xx:xx:xx:xx:xx:xx", "manufacturer": "\u6df1\u5733\u677e\u8bfa\u6280\u672f\u6709\u9650\u516c\u53f8", "model": "PSF-BRA-GL", "modelInfo": "5a2e1b360cf772f92c342f01", "ui": "RFBridge", "uiid": 28 } }, "group": "", "groups": [], "ip": "[hidden]" "location": "", "name": "[hidden]", "offlineTime": "xxxx-xx-xxxxx:xx:xx.xxx", "online": true, "onlineTime": "xxxx-xx-xxxxx:xx:xx.xxx", "params": { "cmd": "trigger", "fwVersion": "2.7.0", "init": 1, "rfChl": 0, "rfList": [ { "rfChl": 0, "rfVal": "331801CC0582EE4D13" } ], "rfTrig0": "xxxx-xx-xxxxx:xx:xx.xxx", "rssi": -37, "sledOnline": "on", "timers": [] }, "productModel": "RF_Bridge", "settings": { "alarmNotify": 1, "opsHistory": 1, "opsNotify": 0 }, "sharedTo": [], "showBrand": true, "tags": { "disable_timers": [], "zyx_info": [ { "buttonName": [ { "0": "Button Name1" } ], "name": "[hidden]", "remote_type": "6" } ] }, "type": "10", "uiid": 28 } ] 
peterbuga commented 4 years ago

@ranski1999 these are the HA guidelines https://www.home-assistant.io/integrations/binary_sensor/ specifically:

door: On means open, Off means closed window: On means open, Off means closed

you could create/duplicate the binary_switches to have a sensor with open/close values with the template platform. i won't go into details about this, it's all in the documentation ;)

ranski1999 commented 4 years ago

Thank you I found that I can use the customization in home assistant. And I use the change node in node red for my notifications and now they all say open for on and close for off.

peterbuga commented 4 years ago

@ranski1999 & everyone else the update on RF Bridge to send-out-signals from HA aka the "rf buttons" (not just receive as it's currently now) it'll be delayed a bit due to the fact that the more devices I add the messier the code becomes and I need to re-write everything to accommodate this volatile type of API changes.

in the case of triggering to send rf signals from HA, the request itself is totally different than what it's used until now and i just cannot continue with the current code :pensive:

CptKalibak commented 4 years ago

@ranski1999 & everyone else the update on RF Bridge to send-out-signals from HA aka the "rf buttons" (not just receive as it's currently now) it'll be delayed a bit due to the fact that the more devices I add the messier the code becomes and I need to re-write everything to accommodate this volatile type of API changes.

in the case of triggering to send rf signals from HA, the request itself is totally different than what it's used until now and i just cannot continue with the current code

Hi, Thanks for your great work and enthusiasm. I'm looking forward to seeing the RF bridge work in HA. It would be a game changer for me.

Just wanted the tell my gratitude and appreciation for your hard work on this!

LukaszP2 commented 4 years ago

in the case of sonoff bridge i think tasmota it's a better fit because you can attach many more rf devices to it vs. the original fw (unless itead changed something meanwhile, i'm not totally up to date) so it's entirely up to you.

Now it can be 16 x 4 device in Sonoff rf

ashoktvm commented 4 years ago

Is RF bridge updated to 3.3.0 supported?

Update: It does support and works well. Thanks @peterbuga The alarm sensor is working. Don't know about the button sensor since I don't have one to test.

ashoktvm commented 4 years ago

in the case of sonoff bridge i think tasmota it's a better fit because you can attach many more rf devices to it vs. the original fw (unless itead changed something meanwhile, i'm not totally up to date) so it's entirely up to you.

Now it can be 16 x 4 device in Sonoff rf

What do you mean 16*4? u mean 16 buttons in remotes or switches?

LukaszP2 commented 4 years ago

in the case of sonoff bridge i think tasmota it's a better fit because you can attach many more rf devices to it vs. the original fw (unless itead changed something meanwhile, i'm not totally up to date) so it's entirely up to you.

Now it can be 16 x 4 device in Sonoff rf

What do you mean 16*4? u mean 16 buttons in remotes or switches?

You can add 16 device with 4 swiches. If you add alarm or montion detector is one device.

ahmst commented 4 years ago

Thanks for your work, Peter! It would be amazing to have the sonoff rf bridge sending RF codes from HA. Sure you'll achieve it! I use it as a remote for arming and disarming my 433mhz alarm system. If you need someone who test it out your new code, just tell me :)

prasanthmk82 commented 4 years ago

Is RF bridge updated to 3.3.0 supported?

Update: It does support and works well. Thanks @peterbuga The alarm sensor is working. Don't know about the button sensor since I don't have one to test.

version 3.3.0 doesn't seem to be working now

peterbuga commented 4 years ago

@prasanthmk82 any errors / logs to back that? it'll help explaining what exactly is not working anymore

ahmst commented 4 years ago

When pressing button of entity from HASSIO i get this error... am I doing anything wrong? Captura

peterbuga commented 4 years ago

@ahmst clearly you're doing something wrong. by definition a sensor it's a read-only entity, it just reports data, you cannot turn it on/off :))

stefanmechelen commented 4 years ago

any chance for a 3.4 update?

tjhiwa commented 4 years ago

Do we have successful progress on RF Bridge for sending signal out? This would be really great and very useful for many of us. I use the RF Bridge remote-buttons to trigger Arm/Disarm of my alarm system. My sonoff devices aren't sharing the same WiFi SSID (different IP range, too) with HA, so I do not wish to use AlexxIT/SonoffLAN to achieve it.

peterbuga commented 4 years ago

Do we have successful progress on RF Bridge for sending signal out? This would be really great and very useful for many of us. I use the RF Bridge remote-buttons to trigger Arm/Disarm of my alarm system. My sonoff devices aren't sharing the same WiFi SSID (different IP range, too) with HA, so I do not wish to use AlexxIT/SonoffLAN to achieve it.

on my last updates, i understood wrong that RF bridge was actually able to copy-send the signals out (stupid i know, but i don't know what made me think that... it happens). as more & more people steer towards AlexxIT/SonoffLAN 's solution (on obvious step and i'm glad i was able to kickstart the integration of these vanilla devices!) i kinda paused the development of this due to obvious reasons. for me it just works better not to stick the devices constantly in lan mode or having them controlled only by HA.

in other words: i can fix it but probably no one (else) will use it 😒

tjhiwa commented 4 years ago

in other words: i can fix it but probably no one (else) will use it

you would be pleasantly surprised by how many actually care and will use it. many don't put their HA on same subnet as their devices (either on different vlan, different router, using repeater, or even hosted elsewhere like in the office or cloud). many don't have multicast available. also, many agree with you on not confining things into only LAN or home HA. with what you created here, it allows devices from multiple homes/buildings (network physically separated) to connect together to a single or multiple HA hosted elsewhere (thru ewelink device sharing into one or multiple secondary accounts). different HA users could be separated thru the HA settings to limit which devices are accessible. in other words, one to many, many to one, and many to many configuration. Tasmota or AlexxIT would only allow one to one (one account one location). the expansion and configuration is wide and forward. it can cater for even corporate or industrial setups. the RF bridge integration is the only thing holding people back from going full swing using what you develop here. please.. please.. fix the RF Bridge integration 🙏

SBastrykin commented 4 years ago

This is necessary for me, since the component from AlexxIT / SonoffLAN does not fit me - it hangs a 4g modem in the router All hope is in you

peter-sounthararajah commented 4 years ago

hi all i have a sonoff basic and an rf bridge , i would like HS to be able to receive one of 4 remote signals and trigger different automatons unfortunately the only one remote entity shows up. i will leave a copy of the file below. would someone like to look at it and tell me whats relevant, what can be used to create other entities from the RF bridge. or just give a breakdown on what each part of the code dose what kind regards Peter s sonoff.docx