darconeous / concordd

Unix daemon for Concord 4 Home Automation Module
Apache License 2.0
8 stars 4 forks source link

Compiling instructions #2

Closed mralapete closed 6 years ago

mralapete commented 6 years ago

I'd like to to help testing and improving this daemon but I'm having no luck compiling it on a Raspberry Pi. I've checked through all the readme and doc files looking for basic instruction without success.

Do I need to pull in any other dependencies in order to compile this program. Sorry if this seems like a very trivial question.

darconeous commented 6 years ago

Hello @mralapete! I'm excited that you would like to help with testing.

What sort of errors are you getting when you try to compile?

Note that, unless you are using the full/master branch, you will need to run the bootstrap.sh script to get the autoconf build system set up. I would personally just go ahead and check out the full/master branch so that you can skip that step.

Aside from what is needed to run the bootstrap script (which you can avoid by just using full/master), the only required dependency is DBus. If you are using raspbian, you should be able to get that by running sudo apt-get install libdbus-1-dev.

Let me know if that helps. If not, let me know what errors you are seeing: I can't help you fix what I can't see.

darconeous commented 6 years ago

I've put together some instructions just for you. Let me know if that helps.

mralapete commented 6 years ago

I'm downloading the zip file from your github which I imagine when unzipped gives me the full master. I'm using the ./configure command but I'm getting cannot find directory.

darconeous commented 6 years ago

Make sure the ZIP you are downloading is from the full/master branch, otherwise it won't have the configure script. Specifically, use this one.

It would be helpful if you could copy and paste the errors you are seeing. I can't help fix what I can't see.

mralapete commented 6 years ago

Apologies, your last message crossed with mine. Perfect instructions.Everything compiled fine.I'd never got it compiled without them.I will report back here with my test results.Thanking you kindly

darconeous commented 6 years ago

How'd it go?

mralapete commented 6 years ago

I'll be back home on Tuesday so I will connect to the Concord 4 security panel and let you know my progress then. Looking forward to giving your daemon a testing on my system.

mralapete commented 6 years ago

Could you paste a copy of your concordd.conf file. I cannot get the daemon to connect to the security panel.The D Bus is running fine and I’m running concordctl in a separate Terminal. At what stage did you create the directories /var/run/concordd and /var/run/concordd/chroot

mralapete commented 6 years ago

Managed to make connection to the security panel with the following command

sudo /usr/local/bin/concordd -c /etc/concordd.conf -s /dev/ttyUSB0

The output from this as follows concordd[887]: Unable to open PID file "/var/run/concordd/concordd.pid". concordd[887]: Configuration file "/etc/concordd.conf" not found, will use defaults. concordd[887]: Starting concordd 0.01.00 (Jun 28 2018 22:27:56) . . . concordd[887]: BUILD_VERSION = dcc040a concordd[887]: Running as root without dropping privileges! concordd[887]: Ready. Using DBUS bus ":1.22" concordd[887]: [PANEL_TYPE] PT:0x14 HR:0x0701 SR:0x4092 SN:0x01479197 concordd[887]: [CLEAR_AUTOMATION_DYNAMIC_IMAGE] concordd[887]: [EQUIP_LIST_COMPLETE] concordd[887]: [PANEL_TYPE] PT:0x14 HR:0x0701 SR:0x4092 SN:0x01479197 concordd[887]: [ARM_LEVEL] PN:1 LEVEL:1 USER:SYSTEM/KEY-SWITCH concordd[887]: [ARM_LEVEL] PN:2 LEVEL:1 USER:SYSTEM/KEY-SWITCH concordd[887]: [ARM_LEVEL] PN:3 LEVEL:1 USER:SYSTEM/KEY-SWITCH concordd[887]: [ARM_LEVEL] PN:4 LEVEL:1 USER:SYSTEM/KEY-SWITCH concordd[887]: [ARM_LEVEL] PN:5 LEVEL:1 USER:SYSTEM/KEY-SWITCH concordd[887]: [ARM_LEVEL] PN:6 LEVEL:1 USER:SYSTEM/KEY-SWITCH

Ran concordctl in another Terminal but it is not reporting any info from the panel when I run the commands.

It might be easier if you post your concordd.conf so I can troubleshoot my setup.

mralapete commented 6 years ago

Looks like it was a permissions issue with concordctl. I ran sudo concordctl and everything is working now. I had to trip each sensor so the zone command in concordctl would recognise them.

Could you post your concordd.conf so I can compare it with mine.

darconeous commented 6 years ago

I'm glad you've gotten it working! Your experiences are helping me realize what stuff I haven't documented yet. Apparently there is a lot. :P

Comments below:

The output from this as follows

concordd[887]: Unable to open PID file "/var/run/concordd/concordd.pid".
concordd[887]: Configuration file "/etc/concordd.conf" not found, will use defaults.

This indicates to me that your copy of /etc/concordd.conf is missing. It also shows that having concordd.conf isn't an absolute requirement to get a working system. (But it is if you want to trigger scripts to execute based on events, more on that in a sec)

Looks like it was a permissions issue with concordctl. I ran sudo concordctl and everything is working now.

You can allow concordctl to be usable from non-root accounts by doing the following:

I had to trip each sensor so the zone command in concordctl would recognise them.

I think I've seen a similar bug recently. In any case, the refresh command should force concordd to refresh the entire state of the panel (although it should have done this automatically at startup).

Could you post your concordd.conf so I can compare it with mine.

Sure thing, but I don't know if it will help you any more than reading the example configuration file.

https://gist.github.com/darconeous/332acb0baa236df3987df728580c1ab2

As you can see, there isn't a lot to it. The example configuration file has better comments/documentation in it.

darconeous commented 6 years ago

I've updated the README accordingly.

One thing that would likely be helpful is if you used the following line in your /etc/concordd.conf file:

SyslogMask "all"

Note that this is different than the line in my concordd.conf, which is SyslogMask "all -debug". Setting SyslogMask to "all -debug" indicates that it will output all log messages except debug messages. Setting it to "all" will log the firehose, but with those logs I can better understand why the zones didn't appear immediately. There might be something different about your setup that is making it act differently.

If you aren't comfortable posting the logs publicly, you can email me the logs: darco@deepdarc.com

mralapete commented 6 years ago

Yes I can do both. It will help any other potential users to get things up and running quickly. I’ve just got things working so I’ll want to give it a full test.

One thing I did notice in the concordctl commands. Do you have a disarm command. Obviously it will need to be followed by a user code for it to be recognised.

Also you mention the interactive console will only be available if libreadline is available. As far as I know libreadline is available but I still have to enter the commands in concordctl individually.

darconeous commented 6 years ago

One thing I did notice in the concordctl commands. Do you have a disarm command.

There is an arm command that takes a single argument: the target arm level. This command will unconditionally change the arm level of the system to the indicated level:

It would be pretty easy to add a disarm command that is just a synonym for arm 1. I'll see if I can implement that, since I've got some spare time over the next few days.

By the way, all of the commands are self-documenting. You can get more information on them by typing concordctl help <command>. You can get a list of commands by just typing concordctl help. For example, the zone command can be used to bypass zones, etc. Lots of goodies in there.

Obviously it will need to be followed by a user code for it to be recognised.

The arm command does not need a user code. It arms/disarms the system directly. You can also arm/disarm the system using the keypad emulator, which you can access via the keypad command. The keypad emulator also displays the real-time zone status. (Pressing q will quit the keypad emulator. Pressing "enter" is interpreted as #)

Also you mention the interactive console will only be available if libreadline is available.

The configure script should have picked it up if it was installed. You need to make sure the development package is installed for the configure script to find it. Doing a sudo apt-get install libreadline-dev should install it (or tell you if it is already installed). I don't remember having to do anything special. Libreadline just gives you a dedicated shell that is convenient, along with command-completion. You can still use the interactive keypad emulator without libreadline.

Your experience has made me realize that it probably makes sense to create a deb package for concordd. That would make install and setup much easier, and things like libreadline dependencies could be baked-in. I'll look into doing that at some point.

mralapete commented 6 years ago

Were the following scripts referred to in your concordd.conf included in the installation or were they created by yourself separately

PartitionAlarmCommand /usr/local/bin/partition-alarm.sh

PartitionTroubleCommand /usr/local/bin/partition-alarm.sh

SystemTroubleCommand /usr/local/bin/partition-alarm.sh

ZoneChangedCommand /usr/local/bin/zone-changed.sh

LightChangedCommand /usr/local/bin/light-changed.sh

OutputChangedCommand /usr/local/bin/output-changed.sh

I tried adding the references to them in my concordd.conf but they are reported as not found.

concordd[822]: concordd_zone_info_changed_func: forked system hook concordd[822]: [ZONE] PN:1 ZONE:4 "LIVING ROOM MOTION SENSOR" STATUS:----- sh: 1: /usr/local/bin/zone-changed.sh: not found concordd[822]: concordd_zone_info_changed_func: forked system hook

darconeous commented 6 years ago

Yeah, those are my scripts for my house. I have an example script in the contrib folder for IFTTT webhooks. I use a variant of it for sending alerts to my phone when the alarm system goes off.

But for the most part, the scripts you write yourself.

I may at some point clean up the rest of my scripts and add them to the contrib folder.

mralapete commented 6 years ago

Yes the scripts would be very useful for Concord 4 alerts to the phone describing each alert as it happens.

mralapete commented 6 years ago

Got the Systemd daemon up and running so I just left the Raspberry Pi running as a headless server.

darconeous commented 6 years ago

Excellent! Since you are all up and running now, I'm closing this issue.