I have a solar plant, and the way I get the data into my vera, is by polling the values of the webgateway, and posting them into the “Variable Container”, I there have an output of how much the plans produces in Watt, KHW today, and KHW total
But in Datamine I can not take any value and log it as “category” 21 (I’d like to take the Watt into datamine)
Hi @Cokeman
Yes, you’re right. Currently DM only allows setting of the “energy category” for variables that are known energy variables. This was done to avoid mis-configuration.
I need to have a think about this before changing it just in case something else checks this, but I think I can easily change it.
As a matter of interest though, I assume you’ve written a plugin to poll the values from the webgateway? If so, why don’t you just store the data into your plugin and use the energy service variable. That way the watts being generated will also be visible in UI5 along with the other energy data…
Look at the attached to this post which you could use this to write the value too and capture in DM.
You could also set it to on/off depending on whether or not you system is generating an output:
I don’t think this needs anything fancy. If you write the data with the “standard” service:variable, then it will automatically be picked up in DM and UI5 (and remote controls etc). It seems like @cokeman is already getting the data and writing it to a variable (I assume), so changing this to the standard service:variable (Service = “urn:micasaverde-com:serviceId:EnergyMetering1”, Variable = “Watts”) will make everything work…
There may be a reason that this isn’t possible though…
Well I’m quite bad at programming, but good at copy and paste…
Found a php script that reads out the Watt and KWH from the webgateway, and I then use the Variables container to store the value, as I don’t know where else to display them. quite an easy way to display: Current Watt, KWN Produced today, KWH produced in total…
But yes, I have an repeating sceen pulling the webgateway, and storing the output in the VC
So, you have a PHP script running on a server somewhere (or on Vera???), and it pushes the variables into the variable container? I’ve not used Variable Container, but I assume (??) that you can specify the service and variable name - or am I wrong and it just sets the variable?
If you can set both service and variable, then if you use the service/variable that I put in my earlier post, everything should work “properly”. I could change DM, and this would fix the problem on DM, but if you can use the standard variable, then it potentially opens up other plugins etc to also use the data…
[quote=“cokeman, post:7, topic:174402”]the VC is only a display thing
line 1 text 1
line 2 text 2
…
line 5 text 5
I don’t think you can change anything in regards to “type”[/quote]
I’m sure @chixxi will correct me, but I understood VC stored variables as UPnP variables. If so, it’s not just a display thing - it’s storing the data in the standard format - otherwise DM and scenes etc wouldn’t be able to use it. The question is if it’s possible to set the service id, or if that is hard coded and you only have access to the variable name…
How does your PHP script get the data into VC - does VC have a system to simply ingest text data along the lines of what you’ve put above? Or, are you using the MCV calls to set UPnP variables?
[quote=“cokeman, post:9, topic:174402”]Hi I use this luup code:
l_1, sunwatt = luup.inet.wget(“http://pv.cokeman.dk/watt.php”)
luup.variable_set(“urn:upnp-org:serviceId:VContainer1”,“Variable1”,sunwatt,172)[/quote]
Cool - so, you have two options…
The simple option - stick with using VC and just change urn:upnp-org:serviceId:VContainer1//Varible1 to urn:micasaverde-com:serviceId:EnergyMetering1//Watts. Unfortunately, this might (likely) stop VC showing the data on the UI, but UI5 should display it in the normal way as it does for power data. @Chixxi may need to comment on the impact of this in VC, but I don’t think it should be more than this…
The second option is to create a different device, using the power monitoring device Id, and then use the variables as above. This would make your device look exactly the same as any other device to remote controls etc. If you were interested in this, it’s pretty simple and I could tell you what to do… No programming required Your only issue here is that this would solve the problem for immediate power generation, but your other data (hourly, daily, whatever) would be hidden away - still available to DM, but not presented in the nice way that I’m sure VC does…
Then of course there’s the third option, which is for me to change DM to remove the link to the energy monitoring service. This probably isn’t a problem, but I think that doing either of the above will make your setup more standard…
Let me know what you think… I’m not against changing DM - I’m just not convinced it’s the right/best way to solve the problem…
That was what someone else wanted it for. It is actually designed around a constant known load and a standard switch. When switched on, the UserSuppliedWattage is inputted into Watts. Switching off reset Watts to zero. Thus, for this action leave it on.
Otherwise you could expand it use other standard switch functions setting status to on or off as if sunwatts > 0. That would then enable it to also capture operating profile of solar system.
But you could have also just used the standard energy metering device since no on/off switch is necessary. In this case, all you need to do is set the variable that I mentioned below (and you can set others if desired - there’s no limitation). There’s no need to set the user supplied watts at all - just “Watts”.
Maybe I’m missing something, but for this application, I don’t think it’s necessary. However, if @cokeman has a working solution, then that’s fine.
Chris
Best Home Automation shopping experience. Shop at Ezlo!