bikerp / dsp-w215-hnap

Tool for reading data from D-Link DSP-W215 Smart Plug
MIT License
54 stars 23 forks source link

Power / temperature module indexes wrong #2

Closed DanielO closed 8 years ago

DanielO commented 8 years ago

Hi, I tried this code and couldn't get it to read the temperature or power working.. I extracted the firmware and found some strings in the CGI module that implied the indexes were the other way around and lo and behold that worked.

However, I assume the ones in the repo work for you so it's a question of working out what they are supposed to be for a given device, and I have no clue on that :(

I have an Australian unit and the firmware is DSPW215A1_FW111b05.bin (i.e. A1 hardware).

bikerp commented 8 years ago

Hi, it probably depends on specific hardware revision and firmware. I discovered the module numbers by inspecting SQLite database which is contained in the firmware. I'm affraid I can’t help you with this. You can always fork my software and adjust to your specific firmware version.

Cheers

Pavel

DanielO commented 8 years ago

Does your unit respond to ModuleProfile? Mine gives the following output...

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
    <GetModuleProfileResponse xmlns="http://purenetworks.com/HNAP1/">
    <GetModuleProfileResult>OK</GetModuleProfileResult>
    <ModuleProfileList>
        <ModuleProfile>
            <ModuleID>1</ModuleID>
            <ModuleNickName>Socket 1</ModuleNickName>
            <ModuleCat>Reactor</ModuleCat>
            <ModuleType>Smart Plug</ModuleType>
            <ModuleSubType>Socket</ModuleSubType>
            <IsBuiltIn>true</IsBuiltIn>
            <ModuleConnType>Not Available</ModuleConnType>
            <ModuleGroupID>
                <int>0</int>
            </ModuleGroupID>
        </ModuleProfile>
        <ModuleProfile>
            <ModuleID>2</ModuleID>
            <ModuleNickName>Temperature Monitor 2</ModuleNickName>
            <ModuleCat>Notifier</ModuleCat>
            <ModuleType>Electrical Sensor</ModuleType>
            <ModuleSubType>Temperature Monitor</ModuleSubType>
            <IsBuiltIn>true</IsBuiltIn>
            <ModuleConnType>Not Available</ModuleConnType>
            <ModuleGroupID>
                <int>0</int>
            </ModuleGroupID>
        </ModuleProfile>
        <ModuleProfile>
            <ModuleID>3</ModuleID>
            <ModuleNickName>Electrical Power Meter 3</ModuleNickName>
            <ModuleCat>Notifier</ModuleCat>
            <ModuleType>Electrical Sensor</ModuleType>
            <ModuleSubType>Electrical Power Meter</ModuleSubType>
            <IsBuiltIn>true</IsBuiltIn>
            <ModuleConnType>Not Available</ModuleConnType>
            <ModuleGroupID>
                <int>0</int>
            </ModuleGroupID>
        </ModuleProfile>
    </ModuleProfileList>
</GetModuleProfileResponse>
</soap:Body>
</soap:Envelope>

which matches with the indexes I needed - so I guess you're supposed to use this to look the modules up for future queries.

bikerp commented 8 years ago

Yes it does. It's the same except module numbers 2 and 3 are swapped.

ryanbeaton commented 6 years ago

I have added how I solved this issue in https://github.com/thunderbird/homebridge-w215/issues/1