soft reboot node
Moderator: leecollings
-
- Posts: 31
- Joined: Monday 21 September 2015 16:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Latest
- Contact:
soft reboot node
is it possible to from domoticz send a command reboot?
-
- Posts: 673
- Joined: Thursday 02 October 2014 6:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.2
- Location: Geleen
- Contact:
Re: soft reboot node
Set this as code in the On-action of a virtual switch:
http://192.168.1.2:8080/json.htm?type=c ... tem_reboot
(replace the ip-address with your own)
Edit: I use this on a Pi.
http://192.168.1.2:8080/json.htm?type=c ... tem_reboot
(replace the ip-address with your own)
Edit: I use this on a Pi.
-
- Posts: 31
- Joined: Monday 21 September 2015 16:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Latest
- Contact:
Re: soft reboot node
This restart domoticz.
Is necessary to reboot the devices mysensors.
How does MYSController
Is necessary to reboot the devices mysensors.
How does MYSController
-
- Posts: 673
- Joined: Thursday 02 October 2014 6:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.2
- Location: Geleen
- Contact:
Re: soft reboot node
That actually reboots the Pi, not just Domoticz, see https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's
-
- Posts: 31
- Joined: Monday 21 September 2015 16:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Latest
- Contact:
Re: soft reboot node
I mean, this is:
I_REBOOT 13 Used by OTA firmware updates. Request for node to reboot.
http://www.mysensors.org/download/serial_api_15
I_REBOOT 13 Used by OTA firmware updates. Request for node to reboot.
http://www.mysensors.org/download/serial_api_15
-
- Posts: 31
- Joined: Monday 21 September 2015 16:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Latest
- Contact:
Re: soft reboot node
Used by OTA firmware updates. Request for node to reboot.
I tried to implement it. I have not used even once git pull request (It would be nice to receive instructions)
add in MySensorsBase.cpp
after void MySensorsBase::RemoveNode(const int nodeID)
after
void CWebServer::Cmd_MySensorsRemoveNode(WebEmSession & session, const request& req, Json::Value &root)
add
add in MySensorsBase.h
after
void RemoveNode(const int nodeID);
add in WebServer.h
after
void Cmd_MySensorsRemoveNode(WebEmSession & session, const request& req, Json::Value &root);
add in WebServer.cpp
after
RegisterCommandCode("mysensorsremovenode", boost::bind(&CWebServer::Cmd_MySensorsRemoveNode, this, _1, _2, _3));
add in HardwareController.js
after MySensorsDeleteNode = function(nodeid)
After these lines
/* Add a click handler to the rows - this could be used as a callback */
$("#mysensorsnodestable tbody").off();
$("#mysensorsnodestable tbody").on( 'click', 'tr', function () {
$('#updelclr #nodedelete').attr("class", "btnstyle3-dis");
$('#updelclr #nodeupdate').attr("class", "btnstyle3-dis");
add
ibid after this line
$('#updelclr #nodeupdate').attr("class", "btnstyle3");
add
ibid after this line
$("#updelclr #nodedelete").attr("href", "javascript:MySensorsDeleteNode(" + idx + ")");
add
in hardware.html
it
replace by
p.s.
I do not know C ++ and Java, and web. I do not know the architecture Domoticz. But it works. Strongly do not scold.
You have to have a bootloader with watchdogs enabled like optiboot or the MySensors bootloader
I tried to implement it. I have not used even once git pull request (It would be nice to receive instructions)
add in MySensorsBase.cpp
after void MySensorsBase::RemoveNode(const int nodeID)
Code: Select all
void MySensorsBase::RebootNode(const int nodeID)
{
SendNodeCommand(nodeID, 0, MT_Internal, I_REBOOT, "");
}
void CWebServer::Cmd_MySensorsRemoveNode(WebEmSession & session, const request& req, Json::Value &root)
add
Code: Select all
void CWebServer::Cmd_MySensorsRebootNode(WebEmSession & session, const request& req, Json::Value &root)
{
if (session.rights != 2)
{
//No admin user, and not allowed to be here
return;
}
std::string hwid = request::findValue(&req, "idx");
std::string nodeid = request::findValue(&req, "nodeid");
if (
(hwid == "") ||
(nodeid == "")
)
return;
int iHardwareID = atoi(hwid.c_str());
CDomoticzHardwareBase *pBaseHardware = m_mainworker.GetHardware(iHardwareID);
if (pBaseHardware == NULL)
return;
if (
(pBaseHardware->HwdType != HTYPE_MySensorsUSB) &&
(pBaseHardware->HwdType != HTYPE_MySensorsTCP)
)
return;
MySensorsBase *pMySensorsHardware = (MySensorsBase*)pBaseHardware;
int NodeID = atoi(nodeid.c_str());
root["status"] = "OK";
root["title"] = "MySensorsRebootNode";
pMySensorsHardware->RebootNode(NodeID);
}
after
void RemoveNode(const int nodeID);
Code: Select all
void RebootNode(const int nodeID);
after
void Cmd_MySensorsRemoveNode(WebEmSession & session, const request& req, Json::Value &root);
Code: Select all
void Cmd_MySensorsRebootNode(WebEmSession & session, const request& req, Json::Value &root);
after
RegisterCommandCode("mysensorsremovenode", boost::bind(&CWebServer::Cmd_MySensorsRemoveNode, this, _1, _2, _3));
Code: Select all
RegisterCommandCode("mysensorsrebootnode", boost::bind(&CWebServer::Cmd_MySensorsRebootNode, this, _1, _2, _3));
after MySensorsDeleteNode = function(nodeid)
Code: Select all
MySensorsRebootNode = function (nodeid) {
if ($('#updelclr #nodereboot').attr("class") == "btnstyle3-dis") {
return;
}
$.ajax({
url: "json.htm?type=command¶m=mysensorsrebootnode" +
"&idx=" + $.devIdx +
"&nodeid=" + nodeid +
"&name=" + encodeURIComponent(name),
async: false,
dataType: 'json',
success: function (data) {
RefreshMySensorsNodeTable();
},
error: function () {
ShowNotify($.t('Problem Updating Node!'), 2500, true);
}
});
}
/* Add a click handler to the rows - this could be used as a callback */
$("#mysensorsnodestable tbody").off();
$("#mysensorsnodestable tbody").on( 'click', 'tr', function () {
$('#updelclr #nodedelete').attr("class", "btnstyle3-dis");
$('#updelclr #nodeupdate').attr("class", "btnstyle3-dis");
add
Code: Select all
$('#updelclr #nodereboot').attr("class", "btnstyle3-dis");
$('#updelclr #nodeupdate').attr("class", "btnstyle3");
add
Code: Select all
$('#updelclr #nodereboot').attr("class", "btnstyle3");
$("#updelclr #nodedelete").attr("href", "javascript:MySensorsDeleteNode(" + idx + ")");
add
Code: Select all
$("#updelclr #nodereboot").attr("href", "javascript:MySensorsRebootNode(" + idx + ")");
it
Code: Select all
<div id="mysensors" style="display:none;">
<div class="page-header-small">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<h1 data-i18n="Nodes">Nodes</h1>
</td>
</tr>
</table>
</div>
<table class="display" id="mysensorsnodestable" border="0" cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr>
<th width="80" align="center" data-i18n="NodeID">NodeID</th>
<th align="left" data-i18n="Name">Name</th>
<th align="left" data-i18n="Sketch Name">Sketch Name</th>
<th width="60" align="left" data-i18n="Version">Version</th>
<th width="60" align="left" data-i18n="Childs">Childs</th>
<th width="160" align="left" data-i18n="Last Seen">Last Seen</th>
</tr>
</thead>
</table>
<table id="updelclr" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<a class="btnstyle3-dis" id="nodeupdate" data-i18n="Update">Update</a>
<a class="btnstyle3-dis" id="nodedelete" data-i18n="Delete">Delete</a>
Code: Select all
<div id="mysensors" style="display:none;">
<div class="page-header-small">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<h1 data-i18n="Nodes">Nodes</h1>
</td>
</tr>
</table>
</div>
<table class="display" id="mysensorsnodestable" border="0" cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr>
<th width="80" align="center" data-i18n="NodeID">NodeID</th>
<th align="left" data-i18n="Name">Name</th>
<th align="left" data-i18n="Sketch Name">Sketch Name</th>
<th width="60" align="left" data-i18n="Version">Version</th>
<th width="60" align="left" data-i18n="Childs">Childs</th>
<th width="160" align="left" data-i18n="Last Seen">Last Seen</th>
</tr>
</thead>
</table>
<table id="updelclr" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<a class="btnstyle3-dis" id="nodeupdate" data-i18n="Update">Update</a>
<a class="btnstyle3-dis" id="nodedelete" data-i18n="Delete">Delete</a>
<a class="btnstyle3-dis" id="nodereboot" data-i18n="Reboot">Reboot</a>
I do not know C ++ and Java, and web. I do not know the architecture Domoticz. But it works. Strongly do not scold.
You have to have a bootloader with watchdogs enabled like optiboot or the MySensors bootloader
Who is online
Users browsing this forum: No registered users and 1 guest