Hi @crondk,
I have your custom component working and sensor.astext is able to get events for my 3 extensions; however, the extension status on the Home Assistant front end seems to default to “unknown”. If I call an extension, “Ringing” is correctly displayed. Once the call ends, “Idle” is shown for just a brief instant before all the extensions revert back to “unknown” as their status. I’m not sure what exactly is happening or where else to start looking. Any suggestions would be appreciated!
Here is a section of my log showing the important bits:
##### My phone call to test Home Assistant:
Jan 23 09:41:45 home hass[6996]: 2018-01-23 09:41:45 INFO (Thread-3) [custom_components.sensor.astext] Got asterisk event for extension 101: Ringing
Jan 23 09:41:45 home hass[6996]: 2018-01-23 09:41:45 INFO (Thread-3) [custom_components.sensor.astext] Got asterisk event for extension 102: Ringing
Jan 23 09:41:45 home hass[6996]: 2018-01-23 09:41:45 INFO (Thread-3) [custom_components.sensor.astext] Got asterisk event for extension 103: Ringing
Jan 23 09:41:45 home hass[6996]: 2018-01-23 09:41:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_101, old_state=<state sensor.asterisk_extension_101=unknown; friendly_name=Asterisk Extension 101 @ 2018-01-23T09:39:28.179585-05:00>, new_state=<state sensor.asterisk_extension_101=Ringing; friendly_name=Asterisk Extension 101 @ 2018-01-23T09:41:45.604166-05:00>>
Jan 23 09:41:45 home hass[6996]: 2018-01-23 09:41:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_102, old_state=<state sensor.asterisk_extension_102=unknown; friendly_name=Asterisk Extension 102 @ 2018-01-23T09:39:28.199007-05:00>, new_state=<state sensor.asterisk_extension_102=Ringing; friendly_name=Asterisk Extension 102 @ 2018-01-23T09:41:45.630810-05:00>>
Jan 23 09:41:45 home hass[6996]: 2018-01-23 09:41:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_103, old_state=<state sensor.asterisk_extension_103=unknown; friendly_name=Asterisk Extension 103 @ 2018-01-23T09:39:28.157228-05:00>, new_state=<state sensor.asterisk_extension_103=Ringing; friendly_name=Asterisk Extension 103 @ 2018-01-23T09:41:45.636880-05:00>>
Jan 23 09:42:01 home hass[6996]: 2018-01-23 09:42:01 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_103, old_state=<state sensor.asterisk_extension_103=Ringing; friendly_name=Asterisk Extension 103 @ 2018-01-23T09:41:45.636880-05:00>, new_state=<state sensor.asterisk_extension_103=unknown; friendly_name=Asterisk Extension 103 @ 2018-01-23T09:42:01.298801-05:00>>
Jan 23 09:42:01 home hass[6996]: 2018-01-23 09:42:01 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_101, old_state=<state sensor.asterisk_extension_101=Ringing; friendly_name=Asterisk Extension 101 @ 2018-01-23T09:41:45.604166-05:00>, new_state=<state sensor.asterisk_extension_101=unknown; friendly_name=Asterisk Extension 101 @ 2018-01-23T09:42:01.367620-05:00>>
Jan 23 09:42:01 home hass[6996]: 2018-01-23 09:42:01 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_102, old_state=<state sensor.asterisk_extension_102=Ringing; friendly_name=Asterisk Extension 102 @ 2018-01-23T09:41:45.630810-05:00>, new_state=<state sensor.asterisk_extension_102=unknown; friendly_name=Asterisk Extension 102 @ 2018-01-23T09:42:01.488849-05:00>>
Jan 23 09:42:03 home hass[6996]: 2018-01-23 09:42:03 INFO (Thread-3) [custom_components.sensor.astext] Got asterisk event for extension 101: Idle
Jan 23 09:42:03 home hass[6996]: 2018-01-23 09:42:03 INFO (Thread-3) [custom_components.sensor.astext] Got asterisk event for extension 102: Idle
Jan 23 09:42:03 home hass[6996]: 2018-01-23 09:42:03 INFO (Thread-3) [custom_components.sensor.astext] Got asterisk event for extension 103: Idle
Jan 23 09:42:03 home hass[6996]: 2018-01-23 09:42:03 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_101, old_state=<state sensor.asterisk_extension_101=unknown; friendly_name=Asterisk Extension 101 @ 2018-01-23T09:42:01.367620-05:00>, new_state=<state sensor.asterisk_extension_101=Idle; friendly_name=Asterisk Extension 101 @ 2018-01-23T09:42:03.833621-05:00>>
Jan 23 09:42:04 home hass[6996]: 2018-01-23 09:42:04 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_102, old_state=<state sensor.asterisk_extension_102=unknown; friendly_name=Asterisk Extension 102 @ 2018-01-23T09:42:01.488849-05:00>, new_state=<state sensor.asterisk_extension_102=Idle; friendly_name=Asterisk Extension 102 @ 2018-01-23T09:42:04.532485-05:00>>
Jan 23 09:42:04 home hass[6996]: 2018-01-23 09:42:04 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_103, old_state=<state sensor.asterisk_extension_103=unknown; friendly_name=Asterisk Extension 103 @ 2018-01-23T09:42:01.298801-05:00>, new_state=<state sensor.asterisk_extension_103=Idle; friendly_name=Asterisk Extension 103 @ 2018-01-23T09:42:04.537009-05:00>>
Jan 23 09:42:31 home hass[6996]: 2018-01-23 09:42:31 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_103, old_state=<state sensor.asterisk_extension_103=Idle; friendly_name=Asterisk Extension 103 @ 2018-01-23T09:42:04.537009-05:00>, new_state=<state sensor.asterisk_extension_103=unknown; friendly_name=Asterisk Extension 103 @ 2018-01-23T09:42:31.446875-05:00>>
Jan 23 09:42:31 home hass[6996]: 2018-01-23 09:42:31 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_101, old_state=<state sensor.asterisk_extension_101=Idle; friendly_name=Asterisk Extension 101 @ 2018-01-23T09:42:03.833621-05:00>, new_state=<state sensor.asterisk_extension_101=unknown; friendly_name=Asterisk Extension 101 @ 2018-01-23T09:42:31.500716-05:00>>
Jan 23 09:42:31 home hass[6996]: 2018-01-23 09:42:31 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.asterisk_extension_102, old_state=<state sensor.asterisk_extension_102=Idle; friendly_name=Asterisk Extension 102 @ 2018-01-23T09:42:04.532485-05:00>, new_state=<state sensor.asterisk_extension_102=unknown; friendly_name=Asterisk Extension 102 @ 2018-01-23T09:42:31.559659-05:00>>
I have pasted a more complete portion of the log with things unrelated to asterisk removed here:
https://pastebin.com/SmCPDk98
Here are a few more config items:
configuration.yaml
# Asterisk Component
asterisk:
host: 10.99.99.201
port: 5038
username: !secret
password: !secret
sensors.yaml
- platform: astext
extension: 101
- platform: astext
extension: 102
- platform: astext
extension: 103
Home Assistant Version: 0.61.0
Regards,
Scott