Open DavidFFerreira opened 4 years ago
Looking for this too. Purchased the DW2 instead of the zigbee equivalent SNZB-04, and I don't want to mess with firmware flashing. May just start a return unless supporting these is trivial.
Home assistant will detect the state quickly whenever it changes, but then a few seconds later it changes to unavailable. Can anyone explain?
@alexwohlbruck I found a way to have the Dw2 working fine in my HA Usigng Log as data support
sensor:
sonoff: username: !@Secret Username password: !@Secret Password scan_interval: 60 #(optional, lower values than 60 won't work anymore!) grace_period: 600 #(optional) api_region: 'eu' #(optional) entity_prefix: True #(optional) debug: False #(optional)
binary_sensor:
After that you can use your Binary sensor for
@alexwohlbruck I found a way to have the Dw2 working fine in my HA Usigng Log as data support
sensor:
- platform: sql db_url: !secret db_url queries:
- name: Sonoff_GetLastState query: > SELECT state FROM "states" WHERE entity_id = 'switch.sonoff_1000e0ed27' AND state NOT IN ( 'unavailable', 'unknown') ORDER BY Last_Updated desc LIMIT 1; column: 'state'
sonoff: username: !@secret Username password: !@secret Password scan_interval: 60 #(optional, lower values than 60 won't work anymore!) grace_period: 600 #(optional) api_region: 'eu' #(optional) entity_prefix: True #(optional) debug: False #(optional)
binary_sensor:
- platform: template sensors: front_door: device_class: opening value_template: > {{ ((is_state('sensor.Sonoff_GetLastState', 'off')) and is_state('switch.sonoff_1000e0ed27', 'on')) or ((is_state('sensor.Sonoff_GetLastState', 'on')) and is_state('switch.sonoff_1000e0ed27', 'unavaliable')) }}
After that you can use your Binary sensor for
@DavidFFerreira Thank you for the code. Please note that I'm new to HA and YAML. The code won't work. I think the alignment spaces are out. Can you please assist by repost or post a text file for download.
Hi There, dont bother with this code, right now you can do a total integration with sonoff adon in HA. With works great and there is no need for that code anymore
@DavidFFerreira Thank you. My 6 other sonoff devices works using HACS in HA. The DW2 does not. It does not come up in Entities. I guess I'll have to do some more trouble shooting. Regards
Is anyone have a the same problem as me with the Sonoff DW2 not showing in Entities in HA? Also let me know if it works for you and how you got it to work. I now have 8 x Sonoff devices working with problems. It's just the DW 2 that's not working.
DW2 only supports “easy” SSID passwords. Only regular characters and numbers.
@FelisucoVFR Thank you. I checked. I don't have special characters for SSID. I can see the DW2 on the network and also ping it. It just does not appear in HA. All other sonoff devices appear fine. I might look at flashing it with Tasmota or something when i get time. regards
Ahh, ok. So it is paired already. Give me some time and I will tell you how I did and how I made it holding the state even after a HA reboot. If I remember correct I did the search in the Development tools by the third column using “dw2”. Not at entity name, at the last column.
Regards
El 9 feb 2021, a las 6:29, FairozJaf notifications@github.com escribió: @FelisucoVFR Thank you. I checked. I don't have special characters for SSID. I can see the DW2 on the network and also ping it. It just does not appear in HA. All other sonoff devices appear fine. I might look at flashing it with Tasmota or something when i get time. regards
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@FairozJaf
Here it is how I could find it. Not hard but at the begining I was just doing the search at entity column. Once you have this solved, you will want to make it keep the last known status as it use to loose it after a HA restart and sometimes itself, indicating unavailable instead, so let us know when you can find it to go to the next step.
at Configuration.yaml:
`# Garaje DW2 WIFI Door sensor data
bateria_puerta_garaje: friendly_name: Batería puerta garaje volts unit_of_measurement: V value_template: "{{ state_attr('binary_sensor.sonoff_10010xxxxx', 'battery') }}"
bateria_puerta_garaje_pct: friendly_name: Batería puerta garaje PCT unit_of_measurement: '%' value_template: "{{ ((state_attr('binary_sensor.sonoff_10010xxxxx', 'battery')-2)|float/0.01)|round(0) }}" device_class: battery rssi_garaje: friendly_name: Señal Wifi unit_of_measurement: dbi value_template: "{{ state_attr('binary_sensor.sonoff_1001039bba', 'rssi') }}" device_class: signal_strength
And the binary_sensor to get the state according last state recorded instead of the actual. Very usefull to know the state after a restart until it receives the actual which may take a long while:
binary_sensor:
Hope it works for you too. Just need to replace the "xxxxx" with your sensor data. I have found this solution around a few forums. It took me a while adapting it but after restarting HA it worked nice.
Thank you @FelisucoVFR
The DW2 does not appear in HA. I search everything. It works in the eWelink App.
I search as you suggested and also device ID. Used the browser text search for the whole page.
I also deleted ".sonoff.json". New one created.
I find the deviceid & name in the ".sonoff.json" file. but not anywhere in HA. I've got 10 other Sonoff Devices that work great.
I'm really out of ideas.
sonoff Dw2 support?! Can you please add support for this?