question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Smart WiFi meter data

See original GitHub issue

Hello,

I’m trying to retrieve the data from a Smart WiFi meter and switch. I’ve successfully connected to the device using TuyAPI, but I don’t get to understand the data I’m getting.

Using a simple script based in the asynchronous one in README.md, I get the following information:

Connected to device!
Data from device: { dps: { '1': 5407, '10': 0, '16': true, '18': '111111111111' } }
Data from device: { dps: { '1': 5408 }, t: 1613651565 }
Data from device: { dps: { '6': 'CNEAJ5AACOw=' }, t: 1613651573 }
Data from device: { dps: { '1': 5409 }, t: 1613651581 }
Data from device: { dps: { '6': 'CM8AJ3YACOQ=' }, t: 1613651588 }
Data from device: { dps: { '1': 5410 }, t: 1613651597 }
Disconnected from device.

Data from dps 1 (absolute current consumption), 10, 16 and 18 is irrelevant. I’m guessing that the string in dps[6] contains the rest of the data I was expecting (current, active power and voltage), but I’m not sure. I’ve tried to decode it using the data shown in the app (decoding each string to binary and then grouping to see if I could find the numbers), but this has been unhelpful. Also, I’m not sure if there are any other dps not being shown (2, 3, 4, 5, 7, 8, 9…).

I also haven’t found any specific information about the device online.

Any suggestions?

Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
juancrrncommented, Mar 14, 2021

I was copying the code for the examples but you were right, there is no change depending on the source character set. I was confused because of that website.

Thank you.

FYI, the current function that I am using is this one:

public static function stringToBinaryD(string $string): string
{
    $byteArray = unpack('C*', base64_decode($string));

    $result = '';

    foreach ($byteArray as $byte) {
        $result .= str_pad(decbin($byte), 8, '0', STR_PAD_LEFT) . ' ';
    }

    return $result;   
}

For the string, COEAA8MAAMo=, the result is 00001000 11100001 00000000 00000011 11000011 00000000 00000000 11001010, just as you said.

0reactions
juancrrncommented, Mar 16, 2021

Hi @Chanete. I’m using the API with the example in the README.md file. As you see in the first comment, sometimes I get a data event with the data you mention, and then the device sends the data that is useful for me.

@codetheweb, maybe this should be moved to a different/new issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

IoT for Smart Metering and big data - with eSIM for secure data
Smart meter data feeds into the smart grid, which gives utility companies the ability to aggregate and manage this as well as monitor...
Read more >
smart single Phase Energy Meter Wi-Fi,Cloud/app,electric ...
It is highly integrated power meter with Wi-Fi module embedded, which measures the data, such as single-phase AC voltage, current, power etc, and...
Read more >
WiFi-Enabled Smart Meter Reader - Hackster.io
WiFi -Enabled Smart Meter Reader. This device will capture the data from the smart (energy) meter and publish the values via a webserver...
Read more >
Smart Meter Data Portal Explore Datasets & Code Samples
Then, the wireless data was averaged for 10 minutes periods. The energy data was logged every 10 minutes with m-bus energy meters. Weather...
Read more >
Smart Meter: Remote Patient Monitoring Company
Smart Meter is proud to partner with AT&T to provide ultra-reliable data collection over secure cellular networks. Unlike Bluetooth, which requires a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found