Register-device-node Category and Capabilities - what payload?

Hi!

I’ve been playing with virtual devices, trying to bring some values via MQTT from another Node Red installation.

I have setup several virtual devices using register-device function, however it is very unclear what header and payload types are required based on the existing Category and Capabilities - for instance if I select a light strip as category and brightness as capabilities it will work and display this in ewe cube, for other, i have not had much success. Where can I find how these are matched?

I presume you use the API documentation here, but I agree these are not clearly specified.
You may find interesting some earlier threads on this theme

but I haven’t tried with energy devices and at this moment I don’t have time but will get back if I can.

Thanks John!

I did read all I could find on the forum and documentation-but it seems obsolete :man_shrugging:

I did finally managed to get around it and have it reported as battery, but it’s useless as I can’t create scenes (which was one of my intentions), I can however create node red flows.

If you do want to go my route, you would need to bring up such values (which is quite easy via mqtt) and use them in scenes, I could only make them work if they are reported as temperature or humidity - I also tried as brightness (since sonoff devices have dimmer, but this doesn’t work, perhaps there are others)

One strange thing (why I said documentation might be obsolete), when I tried to use “temperature”, no matter what I selected as registered-device, it would always give me “invalid parameters” when I was trying to put-device-state. Worked with “humidity”

To help us resolve the issue, we would need the following information from you:

  1. What kind of virtual device are you trying to sync, and what kind of scenario or functionality are you trying to achieve?
  2. When you mentioned “invalid parameters”, which specific parameter were you referring to?

If convenient, you may also export your Flow and share it with us. We will try to reproduce the issue on our side and work on a solution for you.

Hi SuiKa,

I have Node-red setup on my Victron equipment, which transmits battery SoC via mqtt broker (mqtt broker is setup on iHost in case this matters).

This gets into iHost node red instance as below number (there is also limit messages/minute function after, I will not include this as it should not matter)

image

I then use a function to convert this number to string

image

Next I use another function to round the string to integer and convert to json object so it’s being read by put-device-state

Finally, put-device-state registers this value (don’t know why payload appears “empty” in debug) to the device registered in iHost

This is what is configured in register-device

Finally, all of this works and I see the device in iHost and shows correct value.

End-to-end flow

I have tried to reproduce the error from yesterday, but it’s not there anymore. Now it works with both “temperature” and “humidity”… very strange, but happy it works.

When creating a new device with register-device, does Category influence Capabilities, or the other way around?
After playing around tonight trying to recreate the issue, seems it does not matter, only matters that data send via put-device-state matches the Capabilities

Update: I am unable to find a way to capture power…

Based on above flow, I was trying to create a virtual device to display power (w).

I have setup an Switch with Electric Power as Capabilities

When trying to use put-device-state, i get the parameter error

What device Category and what Capabilities should be used for electricPower, or any of the others?? I have tried them all.

1 Like

There is no fixed mapping or combination relationship between Category and Capabilities. You may use any Category together with any Capabilities to create a virtual device.

The electricPower capability should be written as electric-power, like this:

msg.payload = {
    'electric-power': {
        'electric-power': value
    }
}
2 Likes

Thank you!

Unbelievable how now it works…. i tried electric-power before as well as the without hyphen or the others from API documentation.

I now believe there may be something unstable with my setup. It’s the second time something works or works differently than previous day.

Quick side note - the put function only accepts integer numbers and there is no way, that I found to send with decimal places although documentation shows decimal places…

So a value of 50 like in the example, it will show are 0.5W, not 50W. To solve this I am multiplying the arsed value by 100 before being sent.

So it’s showing 193000 instead of 1930

But it is displayed correctly in iHost

Now if there would only be a way to bring these iHost devices to eWelink app, that would be great :smiley:

I tried this, but didn’t work :frowning: https://www.youtube.com/watch?v=CwgnMTcWVaE

1 Like

Congratulations on finally getting the device added successfully!

We do not and will not provide a way to sync iHost devices directly to the eWeLink app. We sincerely apologize for that.

However, it is possible to sync the devices to the eWeLink app through Matter. To make this work, you will need a hub (such as NSPanel Pro or ZBBridge-U) to act as a matter hub, and then use the Matter Bridge feature on iHost to sync the devices out.

Hi, I am doing a detailed thing but for Huawei inverter Sun-2000.

Great, I will give it a shot, as I have a NSPanel.

Should I sync the “virtual” devices from iHost to NSPanel and from NSPanel share them via Matter bridge? Is there a tutorial I can look into?

Thanks!

Let’s sync on that if you want. I also use huawei, but only as a “dumb” device and use Victron’s smart meter to capture production (since they can’t integrate like it works with Fornius), alternatively can use Shelly as it also works with node-red if i’m not mistaken.

I will post a guide of what I have done so it’s clear and “easy” if other people are interested in repeating my general setup.

It’s super nice to finally bring PV generation in eWelink and do consumption automations with Sonoff :smiley:

I found a way to connect the inverter to the iHost.