Identify what is causing a switch off

Hi,

Just wondering if the is an easy was to find out what is turnig a switch off?

I have a ton of devices and scenes set up and recently I have a single on / off switch that randomly switches off? Due to the large number of devices and switches I have it is very hard to look into everything to see where the cmd may be coming from. Can I look in the logs or similar and of so what would I specifocqly look for? I have looked at logs once before via telnet it think it was.

Many thanks.

Sent from my HTC HD2 using Tapatalk 2

Install the info viewer and here you can add the device id and look specifically in the log for that device, without the need to use telnet

Hi Screamhouse,

great thanks for that will give it a go :slight_smile:

Hi Screamhouse,

Wow what a plug in - this will be of great help for many things!

add the device id and look specifically in the log for that device

Could you offer a little more detail on where I add the device ID and how I can pin point activity in the log? apologies cant fine other info so a few pointers would be great if you could?

You can enter a string into the Lua pattern box on the Set Pattern tab and then click Update. Now the log will only show lines containing that string. Try using Device=“69” (replacing 69 with the ID of your device). Some log entries use a different format for the device ID so you may have to experiment.

Hi RexBeckett,

Many thanks - looks like it is working, so now to stuffy it for a while and see if I can identify the source of the switch randomly turning off.

Hi again all,

Just a quick update. so I am using as described above and it is very helpful but does not show what is actualy the trigger. I am getting lots of info similar to the below:

****** Lua pattern is now set to: Device="10" ****** 04 07/29/13 10:20:15.542 <Job ID="1004" Name="pollnode #9 1 cmds" Device="10" Created="2013-07-29 10:20:15" Started="2013-07-29 10:20:15" Completed="2013-07-29 10:20:15" Duration="0.440909000" Runtime="0.438748000" Status="Successful" LastNote="" Node="9" NodeType="ZWaveNonDimmableLight" NodeDescription="Bedroom Speaker"/> <0x2b49b680> 04 07/29/13 10:27:25.543 <Job ID="1024" Name="pollnode #9 1 cmds" Device="10" Created="2013-07-29 10:27:25" Started="2013-07-29 10:27:25" Completed="2013-07-29 10:27:25" Duration="0.440688000" Runtime="0.439411000" Status="Successful" LastNote="" Node="9" NodeType="ZWaveNonDimmableLight" NodeDescription="Bedroom Speaker"/> <0x2b49b680> 04 07/29/13 10:30:38.673 <Job ID="1038" Name="OFF node 9" Device="10" Created="2013-07-29 10:30:35" Started="2013-07-29 10:30:35" Completed="2013-07-29 10:30:38" Duration="3.411047000" Runtime="3.319723000" Status="Successful" LastNote="Transmit was ok" Node="9" NodeType="ZWaveNonDimmableLight" NodeDescription="Bedroom Speaker"/> <0x2b49b680>

What I want to see is “what” is causing the device to turn on or off, not just the fact that it die turn off or no. I am hoping to see if it is a scene or something else that is causing the on/off so I can go and remove it.

Any ideas?

[code]<?php

// CHANGE HERE
$veraUsr = ‘USER’;
$veraPwd = ‘PASS’;
$veraId = ‘UNIT_ID’;
$recherche = array (‘“10”’); // This is an array because we can search multiple strings (‘“11”’, ‘12’, ‘luup.call_action(’, [etc etc etc])

// DO NOT MODIFY BELOW
function veraConnect($usr, $pwd, $id) {
// Find the active fwd server on sta1.mios.com
$units = json_decode(file_get_contents(‘https://sta1.mios.com/locator_json.php?username=’ . $usr));
if (!empty ($units)) {
foreach ($units->units as $unit) {
if ($unit->serialNumber == $id) {
$data = json_decode(file_get_contents(‘https://’ . $unit->active_server . ‘/’ . $usr . ‘/’ . $pwd . ‘/’ . $id . ‘/data_request?id=user_data2’));
if (empty($data)) {
$data = veraConnect($usr, $pwd, $id);
}
}
}
}
return $data;
}

print ‘Recherche de mots-clef’;
// Connection
$veraData = veraConnect($veraUsr, $veraPwd, $veraId);
foreach ($recherche as $variable) {
print(‘

RECHERCHE DE ’ . $variable . ‘

’);
if (!empty($veraData)) {
if (strpos($veraData->StartupCode, $variable) !== false) {
$sceneDisplay = $veraData->StartupCode;
$sceneDisplay = str_replace($variable, ‘’ . $variable . ‘’, $sceneDisplay);
$sceneDisplay = nl2br($sceneDisplay);
print(’
Startup Code
’ . $sceneDisplay . ‘

’);
}
foreach ($veraData->scenes as $scene) {
if ($scene->triggers != ‘’) {
foreach ($scene->triggers as $trigger) {
if ($trigger->lua != ‘’) {
if (strpos($trigger->lua, $variable) !== false) {
$sceneDisplay = $trigger->lua;
$sceneDisplay = str_replace($variable, ‘’ . $variable . ‘’, $sceneDisplay);
$sceneDisplay = nl2br($sceneDisplay);
print(‘
Trigger ’ . $trigger->name . ‘
’ . $sceneDisplay . ‘

’);
}
}
}
}
if ($scene->lua != ‘’) {
if (strpos($scene->lua, $variable) !== false) {
$sceneDisplay = $scene->lua;
$sceneDisplay = str_replace($variable, ‘’ . $variable . ‘’, $sceneDisplay);
$sceneDisplay = nl2br($sceneDisplay);
print(’
’ . $scene->name . ‘
’ . $sceneDisplay . ‘

’);
}
}
print(‘
’);
}
}
}
print ‘’;
?>[/code]

Hi,

Here is a php code to display every luup code (luup event, startup, lua code, etc etc etc) where there is the searched keyword. Just put it on a webserver and change the key variables (user, password, vera unit ID, keyword).

Hi Shaigan,

Wow that relay looks like something - thank you.

I am by no means this technical however - could you offer me a few pointers?

  1. I assume keyword ($recherche) is the device ID?
  2. Could you offer more detail about putting it on a webserver? do you mean open it in a webpage? (apologies I must sounds very silly here) :frowning:

Thank you for the help.

can’t you add a notification to this device…you get an email and based upon that timestamp scroll through the logs? Or check you scenes, when they last ran?

Hi Screamhouse,

Thank you for the input.

So I can see with the plugin mentioned here when it was triggered so this would achieve the same result as you suggest with notifications but good thought thank you.

So you suggest that based on the time stamp of the “on” or “off” that takes place that I could then go through the logs and identify what ran? if so I think I am with you and would likely work. But what if no scenes runs? could this then determining Vera misbehaving? I will need to see I guess.

Other than looking in the logs how do I see what time each scene was run?

I did make a note of times this morning so could look now if I can backtrack somehow?

thank you for the help.

In the scene go to Schedule, here you can see (AFAIK) when it ran successfully last time.

I do not know if my suggestion will solve it, but this is what I (also as newbee) would try

In the Dashboard > Overview there is both Triggers and Upcoming Schedules which may assist in drilling through to establish the event/scene.

You can also go through your user_data manually searching for where the device exists against a Scene.

VeraIP/data_request?id=user_data&output_format=xml

Hi Brientim,

Thank you.

VeraIP/data_request?id=user_data&output_format=xml

Look interesting - changed the ip to the correct one but no joy?

do I need to change the “id=user” bit?

Many thanks.

It needs to be http://veraip:3480/data_request?id=user_data&output_format=xml

  • Garrett

Garrett as always correct, thanks.
No need to change the other than the IP address.

This is exactly what is doing my script (with remote access since I’m not hosting my server in my LAN) with some string research. But you can search with an external text editor too :wink:

Hi All,

Thank you for all this help.

Got the string to work and have searched it.

Seems I am not the only one who has had this similar problem given a few here seem to have solutions :wink:

Using the string I still struggle to see what is triggering things so I think best to go back to basics and look in the logs for a device activation at times I know it happened.

Will Vera have logged on its own since this morning or do I have to have a logging tool open? also do I need to ssh into Vera for this - did it once before.

Yes, similar has been raised a number of time and @Shaigen stepped in last time with the script to which made the user that was looking at future schedules very happy…

You may also look at installing @a-lurkers’ info viewer plugin which enable you to search for patterns which would potentially save time. The most recent version can be found at:

http://forum.micasaverde.com/index.php/topic,13477.msg119913.html#msg119913

Hi Brientim (and all),

Yes I had installed info viewer as per 2nd post here - great tool and very powerful!!

I think I now have my best way to find my issue. I will share intention below for any one else if useful.

I have identified the device ID and Node ID, and “name” of the troublesome device.

I have looked at logs via SSH and searched for the device name (ctrl+f). I then ran some tests with scenes etc. and found that if the device is triggered by a scene the scene details are almost directly above it in the log, and if it is not triggered by a scene and in simply operated by itself (manual on off of switch via vera) then it is a stand alone line stating on or off.

So - My hope is that it will be a scene that is causing the problem and this will be a best practice way of finding the offending scene. by noting the time of occurrence and then searching logs for these clues.

Only issue is my logs only go back till 9am this morning and my issues were around 6am so will have to follow this process in the morning shortly after I see the same odd behaviour to identify the cause.

One thought however. If it turns out that it is not a scene casing the on / off’s, but the log does shows activity of a switch turning on / off, with no preceding scene identifier, what then? ???