Closed htilly closed 5 years ago
hello @htilly
I haven't set an alarm panel in my Domoticz. However I am would be able to add it into the module.
I just need to know the reply from the alarm panel just enter
http://172.16.200.130:8088/json.htm?type=devices&used=true&filter=all
based on your config in the browser. This will show you a JSON file similar like this one
`
{....},
{
"Data" : "On",
"Description" : "",
"Favorite" : 0,
"LastUpdate" : "2018-07-27 08:16:18",
"Name" : "NAME OF YOUR ALARM PANEL",
"PlanID" : "13",
"PlanIDs" : [ 13 ],
"Protected" : false,
"Status" : "On",
"Type" : "Scene",
"TypeImg" : "scene",
"UsedByCamera" : false,
"XOffset" : 0,
"YOffset" : 0,
"idx" : "28"
},
{.....},
` Find the one of your alarm panel between { } and please send me that part from the JSON file i will implement it for you
Thanks for the fast reply! Here is the data, but the strange thing is that it seems to be the same as in this thread, thats why I thought it was strange that it didnt work..
Data: { "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 0, "Data" : "Normal", "Description" : "", "Favorite" : 0, "HardwareID" : 1, "HardwareName" : "Domoticz Internal", "HardwareType" : "Domoticz Internal interface", "HardwareTypeVal" : 67, "HaveDimmer" : false, "HaveGroupCmd" : false, "HaveTimeout" : false, "ID" : "148702", "LastUpdate" : "2019-01-09 19:11:47", "MaxDimLevel" : 0, "Name" : "Domoticz Security Panel", "Notifications" : "false", "PlanID" : "2", "PlanIDs" : [ 2 ], "Protected" : false, "ShowNotifications" : true, "SignalLevel" : "-", "Status" : "Normal", "StrParam1" : "", "StrParam2" : "", "SubType" : "Security Panel", "SwitchType" : "Security", "SwitchTypeVal" : 0, "Timers" : "false", "Type" : "Security", "TypeImg" : "security", "Unit" : 0, "Used" : 1, "XOffset" : "0", "YOffset" : "0", "idx" : "40" },
Hello Henrik,
I made a few changes between the lines 169 until 183 I check the device Data AND the device Status and have a reply based on that.
If there is no alarmOffLabel set then it forces a 'Disarmed' now.
`
if (dev.Name == "Domoticz Security Panel"){
// for domoticz alarm
alarmCount++;
// The name Normal replaced by setting from config
if (dev.Data=='Normal' || dev.Status=='Normal'){
var showTxt = this.config.alarmOffLabel;
if (!this.config.alarmOffLabel){
// force this label if config fails
showTxt='Disarmed';
}
} else {
var showTxt = dev.Status;
}
alarm += '<tr><td class="small">' + dev.Name +'</td><td class="small ">' + showTxt +'</td></tr>';
}
`
Please let me know if this is fixed
Greetings from the Netherlands
Carl
Thanks! Works!
Can I make two suggestions?
1: If status is NOT Disarmed, make the text red. (i.e. when the house is set to armed).
2: Does look strange when using subMenus. Is this a code thing or can it be fixed in the config. See attached images.
Maby a new section such as "Current Temperatures" but "Current Alarm Status"?
Once again, thanks!
Greetings from Sweden =)
Hello Henrik,
I made the status colored if Disarmed is a kind of green and armed is red.
The alarm title you set in the config will be in the list so it will look like
Fixed the submenu issue (forgot the set the proper properties) Current alarm Status Armed
I hope this is what you meant.
How does it come that your bathroom temperature is 53C or is that the Humidity? Does it need a fix as well?
Grtz
Carl
Awesome!
Does seem to be a bug in:
alarm += '<tr><td class="small">' + this.config.alarmLabel +'</td><td class="small '+(disAm==0?'red':'green') +'">' + showTxt +'</td></tr>';
It will always show status in red. Also, maybe change green to white? I.e. just highlight in red when alarm is on. Otherwise, discrete white.
Love it !
Created a PullRequest with the fix =)
Hello Henrik,
I merged your edit. The last hours I was busy changing the code and your edits are in the new code as well. Thanks for your input.
Carl
Cool. I made another PR for re-adding some code for sensors that seems to have been lost. Anyway, one final question before closing this thread..
Question regarding the design. How can I make more space between the subMenus?
As it is right now they are quite close.. It would be much nicer design if there was some more space between the groups. So in this picture, more space above: "Alarm System" and "Window/Door Sensors" so it´s clear that a new section starts.
Hello Henrik,
I will look into it later today. I am out of office until 3 in the afternoon.
--update
Just before I left I made some changes I have added your PR's manually to make sure all code has same style. The padlock has been added The spacing above a sub menu should be a bit bigger let me know if you need more
Back after 3 pm
Cool, thanks for fixing.. Im really not a coder, so my fix was more just to get it to work =)
However, I did a clean install and not it only says: "Loading Domoticz Data"..
Did you make any other changes that I need to adopt to?
I guess you mention it only shows loading.
I look into it tomorrow morning, mine is working
Just uploaded a revision
Thanks! Now it works again.. But the layout is still strange for me..
Not doing a PR this time, but rather explain my problem..
With the current code (git pull) it looks like this for me (right & left layout):
If I change the following lines to:
batt += '<tr><td class="small '+(dev.BatteryLevel < this.config.batteryThreshold - 8?'red':'')+'">' + dev.Name + '</td><td class="small '+(dev.BatteryLevel< 15?'red':'') + '"><i class="fa fa-battery-' + batteryIcon + '"></i> ' + dev.BatteryLevel + '%</td></tr>';
and
alarm += '<tr><td class="small">' + showTxt +'</td><td class="small ' + (dev.Status=="Normal"?'' + '"><i class="fa fa-unlock"></i></td></tr>':'red' + '"><i class="fa fa-lock"></i></td></tr>');
I get the following result:
Once again, thanks for a great module!
Hello Henrik,
You should see how happy I am that you like the module!
The spacing between the submenus worked out good as well
I made some repairs on my layout. I used a wrong variable (tdEndOpenSmall) that hat to be tdClassOpenSmall
The error didn't appear on my mirror because I did have the items in my list .
Hope all is well after this revision
soooo close =)
Just need to change:
"this.config.alarmLabel" TO "showTxt"
So, it should be:
alarm += trClassOpenSmall +(disAm==0?'red':'')+ '">' + this.config.alarmLabel + tdEndClassSmall + '' + endLine;
Otherwise, it will just read "Current alarm status" (literally), instead of "Armed Away" , "Disarbed", etc..
But battery status etc is working just fine!
hello @htilly
I just updated the module. Now the text armed and disarmed can be set in the config so it is more user friendly (probably will add translation files soon, it could make config a lot smaller)
Can you check if the space between the modules is now working.
grtz from the Netherlands
Carl
Perfect! Closing!
Awesome plugin. Everything works except the status for the alarm. The text: "Domoticz Security Panel" is shown at the screen but no data or status. Config bellow (all temp are showing so it´s getting data)..
What am I doing wrong?
Versions: Plugin: Latest pull from git
Domoticz: 4.10303
Config:
{ module: "MMM-Domoticz", position: "top_left", // see mirror setting for options config: { updateInterval: 45, // every 45 seconds apiBase: '172.16.200.130', apiPort: 8080, moduleTitle: "Domoticz", subMenus: true, showItems: ['alarm', 'temperature'], excludeDevices: ['none'], // Device that will not be shown textWhite: false, alarmOffLabel: "Disarmed", groupSensors: false } },