Community
OpenEnergyMonitor

Community

New Curl Widget available in Dashboards

Tags: #<Tag:0x00007f8df4113580> #<Tag:0x00007f8df41134b8> #<Tag:0x00007f8df4113378>

Curl Widget opens the possibility to create buttons and generate asynchronous calls using Ajax.

Screenshot of the configuration panel:

*Sorry but the system limits me to post only one image per post.

It can be used for remote activation of the desired devices or desired processes in Node-Red using HTTP request. Other use is sending messages to the EmonCMS platform to post data.

If the triggered call by the widget needs cofirmation, it is possible to show a confirmation box dialog before the call would be send.

I hope you find it useful!

Thanks! Nice contribution.

Among lots of this this could be used to control the Wifi relay thermostat direct from a dashboard.

I’ve just updated your user privileges on the forum. You can now post as many images and links as you want :slight_smile:

Since the last update it is possible to select desired method (GET or POST) and also it is possible to force the HTTPS option.

In adition extra format support is added to the payload field.

The basic usage until now is:

&json={power:200} or json={power:200}

It is possible add the APIKey to post to other user following the EmonCMS API documentation:

&json={power:200}&apikey=d75f13976ec5469dcb71ffc52848

The advanced usage includes JSON detection in message payload. If JSON format is detected, payload is created following this format:

{"data":"myJSONdata"}

For example myJSONdata can be converted as JSON in Node-Red using JSON converter:

When the recent contribution is accepted, will be possible to introduce the payload as follow:

value1=5&value2=foo&value3=12.5

The payload will be received as follow:

{“value1”:5, “value2”:“foo”, “value3”:12.5}

This option is directly parsed as json by http node in Node-Red:

1 Like

can you switch a Sonoff basic (tasmota) with it? how would this have to be configured? The Sonoff basic has been integrated in Node-Red with MQTT and HTTP Get.
A button directly on the Local emoncms Dashboard would be great.

So since I am totally lost and confused on how to use your curl widget, may I ask my question with stupid responses?
I am using an EmonPi.
I have a dashboard configured and want to add a button to it that will enable and disable my Openevse charge controller over my local network, and the same subnet.
The emonpi’s IP is 192.168.1.50 (say), and my openevse is 192.168.1.100 (say).
I want to send the rapi command to the charger $FE to enable and $FD to disable.

I have tried MANY MANY combinations and have tried to understand the “examples” with NO success. Obviously, I am missing something because nothing on the charger changes.
The fields in the curl configuration don’t make sense, like IP of server (I assume is of the charger), the port (I assume it is 80), the URL (what url?), payload (example please?, method (GET or POST for sending this data to the charger).

I would like to find a central location for some kind of user guide with examples on what the different features can be use for and what parameters are needed.
I know everyone’s time is valuable, but if your going to develop and add a feature, wouldn’t some kind of guide on how to use the feature(s) be helpful, rather than just guess and waste time trying to get things to work, and give up because there is no information?
I know the forum is here and helpful, but sometimes the questions get lost in the noise and never get answered.

Really gets frustrating when a function “seems” like it will do what I want, but doesn’t and find the information is scattered all over the place with no real helpful examples.
We all aren’t software people that write in C C++ Assembler Python, etc.

WOW it’s been OVER a year since I posted this, and NO response/help/suggestions/etc.!!!
Why is this so hard to get help for, and why are there no semi-detailed explanations as to how to use this/!!??
Seems like if your not in the clicke, you will never get any kind of help!
This POS is really pissing me off since I am having problems with it and paid good money for it, and the ONLY person that has even helped a little, is Trystan.
I know he has many irons in the fire so he can’t give that much attention to my measly little questions, but surely others have ideas and can help, even if a little.
Too bad this community and this forum is so scattered and disorganized!

Hello @pomonabill220 we are a small team and it’s difficult to keep on top of everything. To be clear @RDCH106’s contribution was voluntary and many here are helping with support in a voluntary capacity.

I think the issue you are seeing however is that you are trying to make a request to another server that does not allow access from a different origin… this is a standard security feature of javascript ajax requests that the server will generally need to be the same origin server (in this case localhost), that is unless an exception is made to allow cross origin requests - but this needs to be done in the source code of the charger in this case.

The curl widget as described by @RDCH106 above is designed for sending commands to an instance of Node-Red running on the same machine.

I will add a note to the IP-address box to highlight this. E.g IP-address of server (server must have cross origin allowed to work, will not generally work on servers other than localhost).

Added in:

image

I am lost about the access from a different origin…
Let me tell you what I am trying to do and that might give you an idea of my severe confusion!
My tablet and emonpi are on the same LAN.
My tablet has an IP add. of 192.168.1.101 (static)
My emonpi has an IP add. of 192.168.1.146 (static and wired, NOT wireless).
The dashboard on the tablet is where I am trying to create the “button” with the curl widget that does nothing.

Do I need to install something on the tablet to “make the button work”? Is this the node red that is being talked about?

I would think that since the dashboard displays what is in my input, there should be a way to configure an output, or is there much more to something like that?
As far as the button widget, what fields are mandatory and which are “optional” or not necessary?

I am sorry but I am pretty ignorant on this subject (java/python/etc.) and am trying to learn enough to be dangerous (hehe).

If I understand his explanation correctly, Trystan is saying you’re making a request to a server that doesn’t allow requests to come from anywhere other than the same machine the server itself is running on, i.e. localhost.

In order to enable that server to accept requests from (for lack of a better term) an “external” origin, i.e. from anywhere else other than localhost, the source code in the charger needs to be modified.

Let me see if I understand…
when you are saying the localhost, that is referring to the charger?

If so, that is confusing to me as the dashboard is not running on the charger, but on the tablet that is getting it’s dashboard data from the emonpi.
The emonpi is also getting the charger data from the openevse charger.

A side question… when I create a dashboard on a machine, I assume that the dashboard layout/configuration is saved on that particular machine?
or
the dashboard is saved in the emonpi, so any local access (on the LAN that is), can use that same dashboard?

The one thing i did notice is that on emoncms.org I have to create a brand new dashboard to use as the local dashboard doesn’t show up? and THAT new dashboard is saved in my account and not in the emonpi?

What I am getting at is I cannot create a dashboard on my local machine and use it in my emoncms.org account. I have to create a new on for “on line” use.

OK

This dashboard is created on your EmonPi? It may be a function of the browser you are using on the tablet especially if it is an old Android one.

If you open a browser on your computer and the button works, this is almost certainly the issue.

If it doesn’t even work on the PC, then I’m sorry, that’s outside my knowledge space.

No you can’t, they are two completely separate systems (albeit running very similar software with the option to sync data between them).

Yes, sorry I didn’t mention that. Yes, I logged into my emonpi’s web interface and created the dashboard.
Well the tablet is a Lenovo tb-x304f running android 8.1, so it isn’t the latest and greatest and is kind of a cheap tablet, but this is what i got it for without spending alot.

I will give that a try. Any recommendation as to the configuration of the button to test? Anything that is known to work? (also might give me a clue as to how the fields should be filled out).
So IF the button is configured correctly, I should be able to change the data in my emonpi, but NOT send data to my openevse? This is mainly what I am trying to do… control the charger from the dashboard.

I kind of thought so but just wanted to confirm. Thank you!

Just a “rambling thought”.
wouldn’t it be easier, for what i am trying to do, to use a widget to send an MQTT string to my charger’s IP address, like sending a command in the chargers web interface?
or is there MUCH more involved trying to do this from an emonpi’s dashboard?
Sort of like: create a widget that sends a string when triggered (by button press for example).
The string would include the IP address of the device, and the formatted MQTT string to send to that address. OR is that what the curl widget does already? (that I have been struggling with… hehe).

I want to send $FE or $FD to the charger at 192.168.1.113 to enable and disable the charger.

Not from me, I’m afraid.

Unfortunately emoncms dashboards don’t really support what your after @pomonabill220. A MQTT button widget would do the trick as you suggest but there isnt currently such a feature in the dashboard module.

I wonder if you might find it easier achieving what you are after with NodeRed or OpenHab? https://guide.openenergymonitor.org/integrations/nodered

I dont have much experience with these but there are quite a few people on here that do

Another option would be to use our DemandShaper module but it may be overkill for what you want to achieve, its also in a development stage at the moment Emoncms Demand Shaper module

Hi Trystan.
Thanks for the info! I will take a look at the other options.
Also, thank you for clearing this up about the curl button option. Too bad this kind of thing is not included for dashboard usage.
It would be great to control something “simple” like turning the charger on/off and setting the manual charge current.
The auto “eco mode” works GREAT and i use it alot, but would like to turn the charger off when the available current/power is not available from my solar.
Thanks again!

It is horses for courses. You would not use a screwdriver to undo a bolt - right tool for the job.

For Home Automation there are better tools out there that EmonCMS can supply suitable data to; Node-Red, HomeAssistant and OpenHAB to name but 3.

Personally, HomeAssistant (Hass.io) variant for most of my Home Automation with a bit of Node-Red thrown in.

YMMV