jeroenterheerdt / python-egardia

Python library to interface with Egardia / Woonveilig alarm
11 stars 10 forks source link

Enhancement Device Status #9

Closed ufulu closed 6 years ago

ufulu commented 7 years ago

Hi, is it possible to read and the state of the egardia devices, linke if a given window or door is currently open or closed, see screenshot and send this information to home assistant? sc3

Daehnie commented 7 years ago

Not ask to update? You mean your python-egardia package? I don't know... I have an hassbian-installation...I still update only home-assistant. This is 0.55.1 and python-egardia is 1.0.22.

Daehnie commented 7 years ago

Hmm, is the test.py necessary? I hadn't it configured... I thought it was an test file. By the way, it's configured now and if I run it the output was correct: 'DISARM'! It's also correct if my status is 'unknown' in homeassistant.

jeroenterheerdt commented 7 years ago

Hmm, OK, thanks for testing. At least there is no bug in the code in the python-egardia package. I will investigate a little further.

jeroenterheerdt commented 7 years ago

@fabaff do you know what might be going on here?

fabaff commented 7 years ago

If the state is shown as UNKNOWN in the frontend then the state in Home Assistant was set as None. Often this means that HA was not able to retrieve the state.

jeroenterheerdt commented 7 years ago

@fabaff thanks - in what cases might HA not be able to retrieve the state?

@Daehnie you should have an info entry in the HA log (you will need to set the logging level of HA to include info) showing the status. Could you have a look and post the lines that say 'Egardia alarm status: X'? This will help us troubleshoot. Thanks.

Daehnie commented 7 years ago

@jeroenterheerdt This one? 2017-11-12 13:11:10 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.egardia, old_state=<state sensor.egardia=unknown; friendly_name=Egardia Alarmanlage @ 2017-11-12T13:11:07.315511+01:00>, new_state=<state sensor.egardia=; icon=, friendly_name=Egardia Alarmanlage @ 2017-11-12T13:11:10.699689+01:00>>

jeroenterheerdt commented 7 years ago

No, you should see exactly the text above if you set logging to info.

Daehnie commented 7 years ago

2017-11-12 13:11:08 INFO (Thread-5) [pythonegardia.egardiadevice] Egardia alarm status: Disarm

jeroenterheerdt commented 7 years ago

This does not add up to the status shown as unknown in HA. Are you sure you saw this in the log when the alarm was shown as status unknown?

Daehnie commented 7 years ago

Yes, I'm sure... I'll send you a logfile after a fresh restart of HA.

home-assistant.log

Daehnie commented 7 years ago

@jeroenterheerdt Any news here?

jeroenterheerdt commented 7 years ago

Sorry really busy. Will try to have a look tomorrow.

jeroenterheerdt commented 7 years ago

I tried but I cannot reproduce the issue with the status set to unknown. The log seems identical to what I have in my development environment and the status of the Egardia alarm is shown as disarm directly after restarting. I cannot help here, there seems to be something off in your config.

Daehnie commented 7 years ago

Thats weird... Even an fresh installed Hassbian with only Egardia in the configuration doesn‘t work!

jeroenterheerdt commented 7 years ago

If you call the device status directly using postman what do you get then?

Daehnie commented 7 years ago

puh...I've installed postman now. Next I've to try to get the status of my Panel with postman. It's the first time that I use postman.

Daehnie commented 7 years ago

Ok. If I get the status of http://192.168.178.35/action/panelCondGet I became an unexpected error (JSON). My Raw-Values are: /-secure- { updates : { mode_a1 : "Disarm", mode_a2 : "Disarm", battery : "Normal", tamper : "Close", interference : "Normal", ac_activation : "Normal", rssi : "16", sig_gsm : "N/A" }, forms : { pcondform1 : { mode : "4", f_arm : "0" }, pcondform2 : { mode : "4", f_arm : "0" } } } /

Daehnie commented 7 years ago

Hmm...After reading the status with Postman I restarted my Egardia Panel. In Home Assistant my Device switched from 'Disarm' to 'unknown'... weird

jeroenterheerdt commented 7 years ago

Unfortunately I am not able to check it right now as I am working remotely. I will get back to you end of this week or during this weekend. Can you tell me the firmware version of your alarm panel?

Daehnie commented 7 years ago

FW: CTC-1718 1.1.8 1718D0EG04J

jeroenterheerdt commented 7 years ago

@Daehnie working through the support of the sensors I found a situation where I can reproduce you error, I might have found something. Will keep you posted.

Daehnie commented 7 years ago

Great news!!!

jeroenterheerdt commented 6 years ago

@Daehnie the new release of ha includes the fix. Please test it and let me know.

Daehnie commented 6 years ago

Yes, its fixed! Now I‘ve a status after restart!

jeroenterheerdt commented 6 years ago

@ufulu @Daehnie @MartinHjelmare and I have made changes to the egardia component so we do not need a separate egardiaserver any longer. Stay tuned for the new version of the component to make it your way through a HA update. Let me know if you run into any issues.

ufulu commented 6 years ago

That is great news! Good job! Looking forward to it! Thank you.

Daehnie commented 6 years ago

Wow! Nice Job!!

jeroenterheerdt commented 6 years ago

@Daehnie @ufulu the new version is out - please stop and disable the egardiaserver using systemctl before updating home assistant.

Daehnie commented 6 years ago

@jeroenterheerdt Works out of the box with Gate-01!

jeroenterheerdt commented 6 years ago

I am making some progress with the support for sensors as you requested - problem is that also I have been getting rid of the separate egardiaserver and adding GATE-03 support.... a little too much at once. Anyway, I am getting closer to adding sensor support :)

ufulu commented 6 years ago

Hi @jeroenterheerdt, in the mean time this is my workaround to get the sensor info into HA: I use the following jsonrest custom component: and then this sensor Setup:

 - platform: jsonrest
    resource: http://192.168.39.37/action/deviceListGet
    name: egardia_json
    username: Redacted
    password: !secret egardia
    authentication: basic
    verify_ssl: false
  - platform: template
    sensors:
      fenster_bad_mitte:
        value_template: '{{ states.sensor.egardia_json.attributes.senrows[2]["status"].title() }}'
        friendly_name: 'Badfenster Mitte'
      fenster_terrassentuer_mitte:
        value_template: '{{ states.sensor.egardia_json.attributes.senrows[0]["status"].title() }}'
        friendly_name: 'Terrassentür Mitte'
      fenster_terrassentuer_rechts:
        value_template: '{{ states.sensor.egardia_json.attributes.senrows[3]["status"].title() }}'
        friendly_name: 'Terrassentür Rechts'         
      fenster_terrassentuer_rechts_seite:
        value_template: '{{ states.sensor.egardia_json.attributes.senrows[1]["status"].title() }}'
        friendly_name: 'Terrassentür Seite Rechts' 
jeroenterheerdt commented 6 years ago

@ufulu thanks - I am curious to understand: does this reflect changes in real-time? So let's say you opened the Badfenster, does it show in HASS as Open?

ufulu commented 6 years ago

Yes it does!

jeroenterheerdt commented 6 years ago

All, the PR for the changes have been approved, we should see the support for door contacts show up in HASS soon. Note that there will be a breaking change for this, so please re-read the docs carefully!

ufulu commented 6 years ago

Yes! 0.65 is out! Can‘t wait to test it! Thanks everybody and especially you @jeroenterheerdt for all the work you put into this!

jeroenterheerdt commented 6 years ago

Enjoy and thanks