ParadoxAlarmInterface / pai

Paradox Magellan, Spectra and EVO, with MQTT, Signal, Pushbullet, Pushover and others
https://gitter.im/paradox-alarm-interface
Eclipse Public License 2.0
347 stars 92 forks source link

Issue with MQTT and Homeassistant #135

Closed malliaso closed 4 years ago

malliaso commented 4 years ago

Alarm system

EVOHD latest version and ip150 v4.42

Environment

Raspberry Pi 3

Git branch

Question

Hi,

Once again thank you for your great work. I upgraded my EVO from EVO48 to new EVOHD and upgraded IP150 to version 4.42. I can now log in just fine on my panel via IP and panel serial number. I have got the mosquitto broker set up and using MQTT Explorer i can see the paradox topics being publish and refreshed just fine. However, i just dont seem to be able to get this working on homeassistant (it is running via docker-compose on the same raspberry pi as the mosquitto broker and the pai script). I followed the wiki instructions, but i always get the "Intergration has no devices" message under the MQTT integration. I have set up MQTT_HOMEASSISTANT_AUTODISCOVERY_ENABLE = True in pai.conf and added the instructed lines (i.e.under mqtt: the broker IP, username, pass and discovery true) in configuration.yaml. As mentioned via MQTT Explorer i can see that both "paradox" (with correct states/zones events etc) and "homeassistant" (with binary sensors etc) topics are being published and are correctly refreshing. I also did a test via homeassistant->developer tools->mqtt to publish something and i can successfully see it in MQTT Explorer. I can also publish something via MQTT Explorer and see it in homeassistant if i listen for the topic in developer tools (so homeassistant seems to successfully connect to mosquitto MQTT broker). Yet i keep getting the intergration has not devices message in homeassistant. I have restarted the server several times but no luck. Any idea why i cant see my paradox mqtt topic in homeassistant? Thank you again for all the excellent work!!

Logs (if required)

yozik04 commented 4 years ago

Please pull 2.0.2. Does problem persist?

malliaso commented 4 years ago

Thank you for your prompt reply.

I pulled all latest files. Unfortunately still the same issue. even after restarting homeassistant server. homeassistant does not seem to be able to get the topic and i get the no devices text. MQTT Explorer still sees the paradox and homeassistant topics and they are refreshing fine. I can also still publish from home assistant and see it in MQTT Explorer and vice versa. Do you think the issue may be that i am running mosquitto broker on same raspberry as the pai script and homeassistant? or that homeassistant runs via docker-compose?

Thank you again

On Fri, Feb 7, 2020 at 12:30 PM Jevgeni Kiski notifications@github.com wrote:

Please pull 2.0.2. Does problem persist?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ParadoxAlarmInterface/pai/issues/135?email_source=notifications&email_token=AMUEBANNJH3EDQ3GFZ62CNDRBUZ53A5CNFSM4KREOOCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELCOWJI#issuecomment-583330597, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMUEBAILMBNMGUDZQX7UYODRBUZ53ANCNFSM4KREOOCA .

malliaso commented 4 years ago

one additional piece of info which i am not sure it will help. If i pick a specific sub-topic published under the "Paradox" topic (using MQTT Explorer), for example i pick the topic that returns False of True if one specific paradox radar picks movement or not, and in homeassistant i go to developer tools->MQTT and start listening to that topic i can see the false and true messages coming in if i trigger or not the radar, whihc again indicates that homeassistant is connected to the MQTT broker and can receive messages. it is so weird that no device appears under the MQTT intergration (i even went to states in developer tools and nothing there too)

yozik04 commented 4 years ago

Please take a look in MQTT Explorer on this topic: homeassistant/alarm_control_panel/<panel_sn>/<partiton_name>/config

Does this config have device section filled?

malliaso commented 4 years ago

Yes..it does. See below the vale (put ** where my SN number is)

{"name": "HOME", "unique_id": "0**_partition_HOME", "command_topic": "Paradox/control/partitions/HOME", "state_topic": "Paradox/states/partitions/HOME/current_state", "availability_topic": "Paradox/interface/availability", "device": {"manufacturer": "Paradox", "model": "EVOHD", "identifiers": ["Paradox", "EVOHD", "0"], "name": "EVOHD", "sw_version": "7.20 build 5"}, "payload_disarm": "disarm", "payload_arm_home": "arm_stay", "payload_arm_away": "arm", "payload_arm_night": "arm_sleep"}

it is so strange that it does not appear in homeassistant. everything seems to work fine otherwise...by the way my homeassistant version is 0.103.0. and i run it as mentioned via docker-compose.

Thank you for the very quick reply

On Sat, Feb 8, 2020 at 9:29 AM Jevgeni Kiski notifications@github.com wrote:

Please take a look in MQTT Explorer on this topic: homeassistant/alarm_control_panel///config

Does this config have device section filled?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ParadoxAlarmInterface/pai/issues/135?email_source=notifications&email_token=AMUEBAJKQJNINJKEIGYU26TRBZNMDA5CNFSM4KREOOCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELFLZZY#issuecomment-583711975, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMUEBANGFWSPWNGLSHRCL7LRBZNMDANCNFSM4KREOOCA .

malliaso commented 4 years ago

Also..not sure whether it is related. but i noticed that after i run "./run.sh"', everything seems fine, connects and loads all panel data ok and last message is "'PAI.paradox.paradox - Connection OK"'..so all good up to here. I noticed that after a while it continues with the below error., however that does not seem to affect MQTT publishing ability..i.e. even after this error Paradox and other topics seem to refresh just fine in MQTT Explorer. so it does not seem to have an effect, but i am posting it here just in case

PAI.paradox.exceptions - Unhandled exceptio

n in async loop(<_UnixSelectorEventLoop running=True closed=False debug=False>): invalid state Traceback (most recent call last): File "/home/pi/homeassistant/paradox/paradox/lib/ps.py", line 58, in sendMessa ge return await asyncio.gather(*(l.call(msgData) for l in self.listeners[topi cName])) File "/home/pi/homeassistant/paradox/paradox/lib/ps.py", line 28, in call result = self.callback(kwargs2) File "/home/pi/homeassistant/paradox/paradox/interfaces/mqtt/basic.py", line 2 12, in _handle_panel_labels self.labels_future.set_result(data) asyncio.base_futures.InvalidStateError: invalid state Task exception was never retrieved future: <Task finished coro=<PubSub.sendMessage() done, defined at /home/pi/home assistant/paradox/paradox/lib/ps.py:57> exception=InvalidStateError('invalid sta

te')> Traceback (most recent call last): File "/home/pi/homeassistant/paradox/paradox/lib/ps.py", line 58, in sendMessa ge return await asyncio.gather(*(l.call(msgData) for l in self.listeners[topi cName])) File "/home/pi/homeassistant/paradox/paradox/lib/ps.py", line 28, in call result = self.callback(kwargs2) File "/home/pi/homeassistant/paradox/paradox/interfaces/mqtt/basic.py", line 2 12, in _handle_panel_labels self.labels_future.set_result(data) asyncio.base_futures.InvalidStateError: invalid state

On Sat, Feb 8, 2020 at 12:29 PM Sotiris Malliaros malliaso@gmail.com wrote:

Yes..it does. See below the vale (put ** where my SN number is)

{"name": "HOME", "unique_id": "0**_partition_HOME", "command_topic": "Paradox/control/partitions/HOME", "state_topic": "Paradox/states/partitions/HOME/current_state", "availability_topic": "Paradox/interface/availability", "device": {"manufacturer": "Paradox", "model": "EVOHD", "identifiers": ["Paradox", "EVOHD", "0"], "name": "EVOHD", "sw_version": "7.20 build 5"}, "payload_disarm": "disarm", "payload_arm_home": "arm_stay", "payload_arm_away": "arm", "payload_arm_night": "arm_sleep"}

it is so strange that it does not appear in homeassistant. everything seems to work fine otherwise...by the way my homeassistant version is 0.103.0. and i run it as mentioned via docker-compose.

Thank you for the very quick reply

On Sat, Feb 8, 2020 at 9:29 AM Jevgeni Kiski notifications@github.com wrote:

Please take a look in MQTT Explorer on this topic: homeassistant/alarm_control_panel///config

Does this config have device section filled?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ParadoxAlarmInterface/pai/issues/135?email_source=notifications&email_token=AMUEBAJKQJNINJKEIGYU26TRBZNMDA5CNFSM4KREOOCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELFLZZY#issuecomment-583711975, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMUEBANGFWSPWNGLSHRCL7LRBZNMDANCNFSM4KREOOCA .

yozik04 commented 4 years ago

Looks fine. You can try to remove MQTT integration and readd it in homeassistant. The problem on homeassistant side. You need to dig your configuration there.

Thanks for the Exception trace. Will fix that today.

malliaso commented 4 years ago

Hi,

Thanks for your help. I actually managed to get it working. After alot of trial and error, what seemed to work is to delete the MQTT integration in homeassistant as well the mqtt lines from configuration.yaml, then restart homeassistant and then re-add the MQTT intergration via the homeassistant interface (i.e. not via configuration.yaml)..and that did the trick. only thing remaining now is to figure out how to run ./run.sh every time raspberry starts or as a service. thank again.

On Sat, Feb 8, 2020 at 12:39 PM Jevgeni Kiski notifications@github.com wrote:

Looks fine. You can try to remove MQTT integration and readd it in homeassistant. The problem on homeassistant side. You need to dig your configuration there.

Thanks for the Exception trace. Will fix that today.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ParadoxAlarmInterface/pai/issues/135?email_source=notifications&email_token=AMUEBAIKDZ7MOGKTRVJD46LRB2DVFA5CNFSM4KREOOCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELFO5KQ#issuecomment-583724714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMUEBAKDXC7W5GTT3XKK4L3RB2DVFANCNFSM4KREOOCA .

yozik04 commented 4 years ago

@malliaso Answer is here: https://github.com/ParadoxAlarmInterface/pai/blob/master/config/systemd/pai.service You can read about systemd on the net.

Issue solved, closing.

yozik04 commented 4 years ago

@malliaso I've added systemd setup to wiki https://github.com/ParadoxAlarmInterface/pai/wiki/Manual#autostart-on-system-boot-using-systemd