send value via dashboard

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
ingoiot
Normal user
Posts: 83
Joined: 15 Aug 2019, 22:09

send value via dashboard

#1 Post by ingoiot » 23 Aug 2019, 23:18

hi,

i want to set the switching temperature of my smartplug on the mini dashboard.
i've no html skills whatsoever, maybe someone could give me the code for an textfield which sends its value on button click

so far i copied the code from the wiki and added my sensor to display its value, but im not able to get the setpoint transfered at all.

Code: Select all

<meta name="viewport" content="width=width=device-width, initial-scale=1">
<STYLE>
* {font-family:sans-serif; font-size:16pt;}
.button {margin:4px; padding:4px 16px; background-color:#07D; color:#FFF; text-decoration:none; border-radius:4px}
</STYLE>
<HTML>
<br><br>
<table>
<tr><td>aktuelle Temperatur<td align='center'>[ds18b20#Temperature]
<td><a class='button link' href="dashboarddemo.esp?cmd=taskvalueset oder variablennamen?">Up</a>
<td><a class='button link' href="dashboarddemo.esp?cmd=event,valuedown">Down</a>
<td><a class='button link' href="dashboarddemo.esp?cmd=event,valuedown">Down</a>
</HTML>

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: send value via dashboard

#2 Post by grovkillen » 24 Aug 2019, 08:37

Try changing this line:

Code: Select all

href="dashboarddemo.esp?cmd=...
To

Code: Select all

href="/control?cmd=...
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

ingoiot
Normal user
Posts: 83
Joined: 15 Aug 2019, 22:09

Re: send value via dashboard

#3 Post by ingoiot » 24 Aug 2019, 13:14

my problem starts even earlier.
how to change "button" class to something that accepst a number input and and creates an ok button to send it.

ingoiot
Normal user
Posts: 83
Joined: 15 Aug 2019, 22:09

Re: send value via dashboard

#4 Post by ingoiot » 06 Sep 2019, 23:57

there is currently no way to add to this line

<td><a class='button link' href="dashboarddemo.esp?cmd=event,valuedown">Down</a>

a variable like

<td><a class='button link' href="dashboarddemo.esp?cmd=event,valuedown <var>22</var> Down</a>

i only can send the whole line via the button, or am wrong?

tiomny
Normal user
Posts: 31
Joined: 23 Sep 2019, 20:11

Re: send value via dashboard

#5 Post by tiomny » 23 Sep 2019, 20:17

Try this approach:
Create a script section and add the following code:
function espCommand(command) {
var req = new Image();
req.src = "/dashboarddemo.esp?cmd=" + command + ',' + document.getElementById('somevar').value;
}
Using:
<input type='text' id='somevar' />
<a class='button link' onclick="espCommand('taskvalueset')">Up</a>
This is a pure JS, indeed, with jQuery or Angular you can create a much powerful dashboard.

Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests