Home Assistant release Hassbian with Home-assistant 0.60.0
Component/platform: Antifurto365 iAlarm Control Panel
Hi, I'm using the new component introduced in HA 0.60.0. I have configured as described in the how-to inside the configuration.yaml file but the state is never updated.
When the update function that call the get_status() is called?
I have already tried to use the IAlarm function directly on python shell and I'm able to connect and receive the status using get_status()
The default update interval for the alarm_control_panel component is every 30 seconds.
Do you see any errors in the log? Also try to increase log level to debug for this platform. Then you should get a debug log on every update from the entity.
I change the verbosity of the component to debug and now I can see a call every 30 seconds as you said before but the status returned is always None.
Any idea of which can be the issue there?
2017-12-20 08:45:51 DEBUG (Thread-4) [homeassistant.components.alarm_control_panel.ialarm] iAlarm status: None
2017-12-20 08:46:21 DEBUG (Thread-3) [homeassistant.components.alarm_control_panel.ialarm] iAlarm status: None
2017-12-20 08:46:52 DEBUG (Thread-4) [homeassistant.components.alarm_control_panel.ialarm] iAlarm status: None
2017-12-20 08:47:23 DEBUG (Thread-4) [homeassistant.components.alarm_control_panel.ialarm] iAlarm status: None
2017-12-20 08:47:54 DEBUG (Thread-4) [homeassistant.components.alarm_control_panel.ialarm] iAlarm status: None
2017-12-20 08:48:25 DEBUG (Thread-4) [homeassistant.components.alarm_control_panel.ialarm] iAlarm status: None
According to https://github.com/RyuzakiKK/pyialarm/blob/master/pyialarm/pyialarm.py#L32-L43, there's two cases that returns None. Either due to a connection error or if no state_line was found.
When you tested IAlarm.get_status in a python interpreter, how did you do that? Please remove sensitive information before posting here.
I have downloaded the pyialarm.py on my pi user home folder and after that I have done the following:
>>> from pyialarm import IAlarm
>>> url = 'http://{}'.format('alarm_ip_address')
>>> client = IAlarm('my_alarm_username','my_alarm_password',url)
>>> client.get_status()
'1'
>>>
Please also post your config section for ialarm in configuration.yaml (without sensitive info).
Here my ialarm configuration in configuration.yaml:
alarm_control_panel:
- platform: ialarm
host: alarm_ip_address
username: my_alarm_username
password: my_alarm_password
@RyuzakiKK I can't see a check for an int. I don't think it matters if it returns a '1' or a 1. Both will be evaluated as True.
@MartinHjelmare yeah, but this should not be the problem, right?
I'm able to reproduce it, I'm trying to find where the issue is.
@MartinHjelmare I found the problem. In this type of alarms the password can only be composed of numbers, and if you write something like password: 123456 in the configuration.yaml it apparently doesn't work (maybe because the component expects a str?).
Do you think that I should change the password configuration variable to 'int' or write a more general message in the iAlarm page saying that if the password is only number you need to surround it with a double quote?
I have tried to change the configuration.yaml adding single quotes to the password and now the status is retrive successfully.
@RyuzakiKK IMO it is better to update the documentation or do a toString conversion of the password in order to avoid other users having the same problem.
The config validation already converts it to a string. But yaml will first convert a number to an integer I think. But I don't see how that would change the password.
Python 3.6.3 (default, Oct 4 2017, 02:55:45)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import yaml
In [2]: test = yaml.load("{'boolean': true, 'integer': 3, 'float': 3.14}")
In [3]: test
Out[3]: {'boolean': True, 'float': 3.14, 'integer': 3}
In [4]: type(test['integer'])
Out[4]: int
In [5]: type(test['float'])
Out[5]: float
In [6]: import homeassistant.helpers.config_validation as cv
In [7]: cv.string(test['integer'])
Out[7]: '3'
@MartinHjelmare I think I found something. The problem happen when the password has a leading zero.
For example if in the configuration.yaml you have something like password: 001020, in setup_platform the variable CONF_PASSWORD will be 528.
This may be due to a strange int to string conversion (that also removes the leading zeros).
It seems to be a pyyaml thing:
Python 3.6.3 (default, Oct 4 2017, 02:55:45)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import yaml
In [2]: test = yaml.load("{'boolean': true, 'integer': 001020, 'float': 3.14}")
In [3]: test
Out[3]: {'boolean': True, 'float': 3.14, 'integer': 528}
I suggest you add a note to the docs for the platform, to put the password within quotes.
Closing with docs updated.
Most helpful comment
@MartinHjelmare yeah, but this should not be the problem, right?
I'm able to reproduce it, I'm trying to find where the issue is.