Garfonso / dlinkWebSocketClient

Allows to control D-Link DSP-W115 and DSP-W245 smartplugs and maybe other devices using the "mydlink" app.
MIT License
12 stars 5 forks source link

Watt consumption #1

Open mar1ged opened 4 years ago

mar1ged commented 4 years ago

More a question and less an issue

I found your code coincidentally and had a quick look. Do you happen to know if it is possible to read the consumption in Watt and if this is the current consumption and/or total ? I have a DSP-W245 which after 20 or so attempts runs fine with the app but would be happy to dump the app.

Btw: I ask myself if the device will stick to the schedule if it loses the Internet connection. I haven't seen a setSchedule function or alike and this makes me think that this might run outside of the device

Garfonso commented 4 years ago

Hm, can the device measure power consumption at all? Does the app show those readings?

mar1ged commented 4 years ago

Yes, W245 is capable to do this in all four sockets separately and the app shows the values too

jonassjoh commented 4 years ago

Regarding the schedule, you could try to disable the internet on your router (perhaps by unplugging the ethernet cable) to check if the device will stick to the schedule without internet access?

Possible commands that can be sent to the device are:

sign_in
av_config
get_setting
set_setting
status
get_status
start_viewing
stop_viewing
register
recycle_channel
get_policy
get_schedule
change_policy
change_schedule
change_scene
event
unbind_device
update_info
device_reset
reload_config
get_server_info
set_service_level
get_service_level
keep_alive
upload_log
voice_report
get_unit_data
get_setup_status
wlan_survey
test_token
get_regular
conn_init
conn_add_candidate
rtsp_command
rtsp_start_viewing
conn_close
conn_list
device_status
update_cnvr_state
sd_list_event
sd_list_snapshot
sd_list_file
fw_upgrade
m2m_event
rtsp_ack_channel
set_fw_auto_upgrade
get_fw_auto_upgrade
change_policy_batch
change_schedule_batch
change_scene_batch

There is a get_schedule and change_schedule command which is of interest here. Perhaps one of the others will return the power usage.

mar1ged commented 4 years ago

Thanks, that sounds interesting although none of them conveys a connection to the wattage. I will try to find out more.

Can you provide a link where you got the list of possible commands from ?

jonassjoh commented 4 years ago

Can you provide a link where you got the list of possible commands from ?

I got the list by reverse engineering the binary that controls the plugs. Since I only did the work for my own project, I did not explore every possible command.

mar1ged commented 4 years ago

Thank you for your work and support. I just wanted to let you and possibly others) know that I will no longer consider the D-Link products for my project.

While I like the looks and quality of the DSP-W245 I am still annoyed by the many attempts I had to make in order to get the app working. In addition to this I dislike the "cloud-only" approach, I know that there is a way to use the device with only a local wifi connection but this is a based on a "hack". And - perhaps this is just my personal problem ;-) - I couldn't yet befriend with the app: the schedules don't work the way I need them and when checking the Watt consumption there always is a risk that I switch off the socket. Which is bad because that socket drives the pump of my daughters aquarium.

Because of this I searched for alternatives. As far as multi-socket devices are concerned I couldn't find good alternatives. The alternatives are either much more expensive (200€ for a Ethernet cable based device), have less features or are provided by vendors from which I can not buy with confidence. Due to this I decided to buy a regular multi socket power strip and equip if with single socket devices.

I found an interesting alternative that is based on Bluetooth and not wifi: the Voltcraft SEM 6000 (it looks like Recogi sells the identical device under a different name). Some shops sell a three pack for 70€. But what is more interesting is the fact that there is library that can be compared to what you provide: https://github.com/Heckie75/voltcraft-sem-6000

But I looked even further because I could not falsify my impression that the device is near end of life from a sellers perspective. And Bluetooth might have its advantages (less power consumption, less interference with my wifi) but it makes it more difficult if I want to use several sockets in several rooms of my house.

By coincidence (I saw an advertisement while ordering a Raspberry Pi Zero WH) I found out about the Shelly Plug S. While it will perhaps take some time to get used to the looks of the device (I prefer the compact size and square looks of the Voltcraft device, but hey: sockets can be hidden in a corner ;-)) I like their approach: you can run it with a local wifi and/or the cloud. But what's even best there is an extensive and well document REST API that allows you to access the device from custom solutions. MQTT and CoAP are also built in and the firmware gets updated regularly and you can even flash Tasmota. I also like this concept because it shows clearly that this device was crafted by tinkerers and people who have a soft spot for technical stuff.

By the way: the vendor sells a four pack for a cheap price of 77€ and there is an interesting warranty extension for only 10%

Garfonso commented 4 years ago

Yes, the products from Shelly are quite nice and are recommended by a lot in the smart home community.

If you do not want to keep the DSP-W245, maybe you want to donate for further development of the library?

mar1ged commented 4 years ago

I can get a full refund and will get my money back so I can buy the Shelly plugs