ELK M1 Interface

Yeah, with the next release, in theory you should be able to make changes to your Elk system and not have to restart HASS to see them (though it may take a minute for the changes to appear).

Well, at least if I can find a way to do so. Seems HASS currently has no way to dynamically add/remove devices? Might have to settle for simply notifying the end user that they need to restart HASS … at least the restarts should be much faster.

First, I’m new to Home Assistant but a long time dev, and have to say how great this integration is. Thank you!

I got the M1 talking to HA and now have tons of “Output 1, 2, 3, etc”, and “Task 1, 2, 3 etc” switches.

Questions:

  1. @BioSehnsucht What are they and how can they be used?
  2. @lmamakos I inherited my M1 (came w/ the house) but have gotten connected w/ ElkRP. Can you tell me how you got a physical switch on the keypad to trigger your switch.elk_task_009?
  3. How can I hide the unused Switches on the dashboard?

Thanks in advance.

Tasks can be used to trigger automation rules. Automation rules can also be triggered by things like an output or zone changing state, etc, but the cleanest way to trigger an automation rule (whether it is from a keypad or HASS) is using a task.

Outputs can be used to trigger various things (whether a device is directly connected or via a relay if it requires more juice than the Elk can provide). They’re also often used in automation rules to trigger or inhibit other rules, using unconnected outputs as a sort of boolean variable.

To hide unused “devices” (outputs, zones, lights, etc) you can exclude them in the elkm1 configuration, for example:

elkm1:
  host: ...
  ...
  x10:
    exclude: b5-p16
  output:
    exclude: 33-200
  ...

The devices that appear as switches in HASS can be either lighting devices (“x10” - may also be any other kind of lighting system that the Elk supports, but it treats them all as X-10 so that’s how they’re named), outputs (“output”), or tasks (“task”).

For more details on configuring the elkm1 component look at https://github.com/BioSehnsucht/home-assistant.github.io/blob/elk-m1/source/_components/elkm1.markdown

For general Elk related help / ideas, I recommend http://cocoontech.com/forums/ (both the Home Security and Home Automation forums, depending on what you need help with).

Okay! I’ll give that a shot. I appreciate the guidance.

I’m traveling on business now and can’t give you a detailed response… and it’s been probably 5 years since I set up the Elk, so bear with me. Using the Elk programming application, you can configure the F keys on the various keypads to do stuff. One option is to invoke an automation task defined in the Elk.

In my case, I had an automation task that would turn on a bunch of X10 lights for some period of time, and then arrange for them to be turned off. For your purposes, it could be as simple (or maybe even a null task) as you like. When the Elk runs the task, this results in a message being sent out the Elk serial port to the ethernet interface. I believe this is a TC message, which conveys the particular task that was run.

Also, according to the Elk serial API manual, it says:

Example: 0ATC001000D7 Task change – Task 1, changed to activated

This transmission update option transmits the updated status whenever it changes 
and is enabled by setting the location TRUE in the M1 Control Global Programming
Location 38. Example: “Xmit Task Chgs – ASCII” (Yes or No)

I really don’t remember what the default state of that setting is; you might need to enable that.

Anyway, the effect of all this is that there’s a HASS switch corresponding to the task that changes state from “off” to “on” that you can then trigger HASS automation with.

You can also change the state of the switch in HASS which will result in the task on the Elk being invoked. This is really useful for a few circumstances. For example, the Elk has the ability to “chirp” the alarm horn. Last I looked, there’s no serial protocol message available to do this. So instead, I have an Elk “task” defined that invoke the “chrip” function, and activate the task to do that.

I hope this helps some, and being away from home right now I can’t fire up the Elk software to provide more specific detail. Maybe this info will point you close to the right direction.

I’m pretty sure all the “must be set to true to send event” options are enabled by default, at least they were in our Elk we’re using at the office - at least, for everything PyElk / ha-elkm1 supports so far. I haven’t had to change any settings to get events to appear.

Of course, it’s possible they were turned off for some reason.

Is there a way to tell what version of PyElk I’m running? I recently switched home assistant to run on docker and noticed that the container doesn’t have PyElk installed. I have ha-elkm1 installed as a custom component in my config dir and can control Elk in HASS.

Each time I restart HA I get about 10 errors. They don’t seem to break anything but wanted to report them. If nothing else, they make it harder to find “real” error. :wink:

2017-12-05 08:52:27 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 399, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 247, in async_add_entity
    yield from entity.async_update_ha_state()
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 218, in async_update_ha_state
    device_attr = self.device_state_attributes
  File "/home/homeassistant/.homeassistant/custom_components/climate/elkm1.py", line 111, in device_state_attributes
    ATTR_CURRENT_TEMPERATURE: self._convert_for_display(self._device.temp),
AttributeError: 'ElkClimateDevice' object has no attribute '_convert_for_display'
2017-12-05 08:52:27 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/tasks.py", line 180, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 399, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 247, in async_add_entity
    yield from entity.async_update_ha_state()
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 218, in async_update_ha_state
    device_attr = self.device_state_attributes
  File "/home/homeassistant/.homeassistant/custom_components/climate/elkm1.py", line 111, in device_state_attributes
    ATTR_CURRENT_TEMPERATURE: self._convert_for_display(self._device.temp),
AttributeError: 'ElkClimateDevice' object has no attribute '_convert_for_display'

@vtracsd : The version of PyElk that is installed is the version required by ha-elkm1. It doesn’t get installed into the system (or in your case, docker) level Python set of modules, but gets installed separately by HASS automatically into a directory under the configuration directory. When I release the next update, the required version will get updated to a newer version, and HASS will automatically install that newer version.

@abe : Yeah, that bug should be fixed when I get the next version out. I didn’t have a real thermostat hooked to the Elk to test with until recently so I made a few goofs previously.

1 Like

Hi, Noob to Home Assistant and this interface. Ive tried to find a fix but can’t. The problem im having is when my alarm trips HA does not see the change in state. Maybe someone has had the same errors pop up and can help? I’m currently running HA on a PI3.
When Home Assistant first starts up I get this error:

2017-12-18 20:30:56 ERROR (Thread-15) [homeassistant.components.elkm1] Elk config : OrderedDict([(‘host’, ‘socket://192.168.0.178:2101’), (‘code’, ‘172839’), (‘area’, OrderedDict([(‘exclude’, [‘2-8’]), (‘autohide’, True), (‘include’, [‘1-8’]), (‘enabled’, True)])), (‘zone’, OrderedDict([(‘exclude’, [‘9-31’, ‘37-208’]), (‘autohide’, True), (‘include’, [‘1-208’]), (‘enabled’, True)])), (‘output’, OrderedDict([(‘exclude’, [‘1-208’]), (‘autohide’, True), (‘include’, [‘1-208’]), (‘enabled’, True)])), (‘task’, OrderedDict([(‘exclude’, [‘1-32’]), (‘autohide’, True), (‘include’, [‘1-32’]), (‘enabled’, True)])), (‘thermostat’, OrderedDict([(‘exclude’, [‘1-16’]), (‘autohide’, True), (‘include’, [‘1-16’]), (‘enabled’, True)])), (‘x10’, OrderedDict([(‘exclude’, [‘a1-p16’]), (‘autohide’, True), (‘include’, [‘a1-p16’]), (‘enabled’, True)])), (‘keypad’, OrderedDict([(‘exclude’, [‘3-16’]), (‘autohide’, True), (‘include’, [‘1-16’]), (‘enabled’, True)])), (‘counter’, {‘autohide’: True, ‘include’: [‘1-64’], ‘enabled’: True, ‘exclude’: []}), (‘value’, {‘autohide’: True, ‘include’: [‘1-20’], ‘enabled’: True, ‘exclude’: []})])

Everything still works fine that I can tell until my alarm gets tripped. Here is the error I get:

2017-12-18 20:41:14 ERROR (MainThread) [homeassistant.helpers.entity] Update for alarm_control_panel.elk_area_1 fails Traceback (most recent call last): File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 199, in async_update_ha_state yield from self.async_device_update() File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 306, in async_device_update yield from self.hass.async_add_job(self.update) File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter yield self # This tells Task to wait for completion. File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup future.result() File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result raise self._exception File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run result = self.fn(*self.args, **self.kwargs) File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/alarm_control_panel/elkm1.py”, line 118, in update self._state = self._device.STATE_ALARM_TRIGGERED AttributeError: ‘Area’ object has no attribute ‘STATE_ALARM_TRIGGERED’

Home Assistant fails to update the tripped alarm state.

This should be fixed on next update.

Sorry everyone that I haven’t gotten it out yet. It’s theoretically done but I haven’t had time to test it - work load has dropped off but I keep getting roped into holiday-related shenanigans. Realistically when I test it I’ll probably find a few more issues to fix, but once I get a chance to work on it probably won’t take long to kick out the next version. I’m off all next week so hopefully I can sneak a release out by end of the month.

I upgraded HASS to 0.60.1 and the PyElk doesn’t work any more. HASS shows me an invalid config card for the elkm1 component.

hello everyone, i’m a big fan of elk m1 and hassio. this is my first attempt installing elk m1 interface and unfortunate it comes at a time after i upgraded to latest hassio 0.60.1. Would love to know the fix so i can continue with the set up.

I had a problem with the climate control component a few released ago, and I just deleted that file… components/climate/elkm1.py I think it was. Not ideal, but got things running until @BioSehnsucht can find some time to merge together a bunch of work that he’s been up to.

I’m not sure if that’s the error that you’re seeing, but it was a quick workaround for me.

Note, I’m still running homeassistant 0.59, so perhaps there’s something different that you’re referring to…? I’m also not running hassio; I have an installation in a virtualenv on a macOS machine.

Does HASS start without Elk errors, and just the UI isn’t working? Or is this “invalid config card” error in the error log?

If you can post either a screenshot (if UI) or paste the error log (if error log) that would be helpful.

ok i’m not sure i should be the one replying since i’m new to hass io and how to import / implement new modules, but since i did email, let me update you. After re reading and going over everything I wouldn’t rule out this may be a noobie error. If so, I apologies in advance.

I pulled down “ha-elkm1-cd8ce9d0315d3ca1b4e35d0196f5c589acd24a18” and copied all into a directory which i created called “components”. so my set up looks like this via samba (mac os) smb://hassio/config/components/.

Under “components” contains the binaries included in “ha-elkm1-cd8ce9d0315d3ca1b4e35d0196f5c589acd24a18”.

I’m getting the

here is my logs:

2018-01-09 05:32:18 ERROR (MainThread) [homeassistant.loader] Unable to find component elkm1
2018-01-09 05:32:18 ERROR (MainThread) [homeassistant.setup] Setup failed for elkm1: Component not found.
2018-01-09 05:32:29 WARNING (MainThread) [homeassistant.setup] Setup of sensor is taking over 10 seconds.
2018-01-09 05:32:30 WARNING (MainThread) [homeassistant.setup] Setup of notify is taking over 10 seconds.
2018-01-09 05:32:30 WARNING (MainThread) [homeassistant.setup] Setup of device_tracker is taking over 10 seconds.
2018-01-09 05:32:37 WARNING (MainThread) [homeassistant.setup] Setup of tts is taking over 10 seconds.

not sure exactly how to post a screen shot. here it goes.
Screen Shot 2018-01-09 at 6.02.07 AM.png
sorry screen shot failed.

Just wanted to mentioned, i also pulled down “pyelk-master” but not sure if this needs to be copied into Hassio nor which directory it should be copied under (components)?

You would normally place additional components in /custom_components/ not /components/ but for various reasons this doesn’t work for ha-elkm1. You need to either place them in homeassistant/components/ (not sure where this is on hassio) or put them someplace else, then create symlinks in homeassistant/components/ to them. I haven’t used hassio, so I don’t know how/if you can do this easily.

You don’t need to do anything with PyElk directly, HASS will install whichever version corresponds to the version of ha-elkm1 you installed automatically.

Thank you for your time @BioSehnsucht .

Has anyone gotten ELK M1 working with Hass io? Can you share your installation techniques?

Its been a while since I set mine up, but I just took the elkm1.py and copied into the samba share “\Hassio\config\custom_components”. I then rebooted hassio and it detected the module and installed the remaining necessary items. It works good and I have been able to do all the configurations with lights and such. I even tied to my google home and google assistant on my phone so I can control the elk with voice. The only problem I have is that I have to restart hassio every 2-3 days because the switch status indicators stop updating status and just show off. I can turn lights on and the switch moves to on, but then jumps back to off and now I can’t remotely turn them off. The reboot fixes this. About every 2 weeks I have to unplug my RPi because hassio stops responding via the browser. I’ve been hoping as the module gets updated, these issues will resolve.