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 did read all I could find on the forum and documentation-but it seems obsolete
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”
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)
I then use a function to convert this number to string
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
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
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
}
}
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…
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.
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