Adding multiple command line sensors disable web ui

Hi,

I wrote a python script that reads ruuvitag (http://ruu.vi) transmissions and returns desired values to command line.

I am able to add single command line sensor and everything works fine. But as soon as I add another (same ruuvitag but humidity or pressure for example, or whole another ruuvitag), web interface does not work. Connections are not accepted. Only error in logfile is 10 sec timeout or similar.

Any ideas?

Alternatively I tired to do it with this:

but got always error with my configuration at the row where it reads "sensors: " and was unable to find reason why. Got following error:
mapping values are not allowed in this context at line
What did I get wrong with this?

I am more than happy to share python files and similar through github as soon as I get my own setup working.

See the link on how to add multiple command line sensors.

https://github.com/SilvrrGIT/HomeAssistant/blob/master/sensors.yaml#L30

Im guessing you are just having a formatting issue which is causing the issue.

Note that it helps to put the command in quotes to avoid it being read improperly or special characters from being interpreted incorrectly

Thanks for the reference, that helped a lot when tracking down possible issues.

It seems that calling same command multiple times causes the issue. Or then my script just does not work as supposed to when it is running multiple instances at the same time.

The logic for it is following: you call for specific sensor by MAC and either specify measurements you want
ruuvi-hass.py AA:BB:CC:DD:EE:FF temp
And output:
12.0
Temperature in degrees
Or
ruuvi-hass.py AA:BB:CC:DD:EE:FF
And output:
12.0:1005:54
Temp:pressure:humidity %

So if I poll same sensor with two separate queries or two different sensors, something breaks down and web interface can not be accessed.

sensor:

  • platform: command_line
    name: outside
    command: “/home/homeassistant/ruuvi-hass/ruuvi-hass.py AA:BB:CC:DD:EE:FF temp”
    unit_of_measurement: “°C”
  • platform: command_line
    name: sisalla
    command: “/home/homeassistant/ruuvi-hass2.py FF:EE:DD:CC:BB:AA temp” ← this works
    command: “/home/homeassistant/ruuvi-hass/ruuvi-hass.py FF:EE:DD:CC:BB:AA temp” ← this not
    unit_of_measurement: “°C”

If I make a copy of the python script and put it elsewhere and access other sensor through it, web interface works again.

Edit: link to github now that I found a workaround:
https://github.com/peltsippi/ruuvi-hass

I got finally that split setting working and now single commmand line executable returns all possible sensor values to single sensor and its content is split to specific sensors.

Or it might do that, not sure because web ui does not open.

So no matter how I do it. Either by multiple instances of same command (each calls for listening different bt MAC broadcast) or dump all values to single sensor and use templates to separate desired values to new sensors. Web UI gets disabled anyway.

No errors at error log. Based on hass outputs, all seems to work.

Script is working fine. Data format: s1temp:s1humidity:s1pressure:s2temp:s2humidity:s2pressure:

Apr 19 22:54:04 raspberrypi hass[813]: 2018-04-19 22:54:04 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.ruuvitags, old_state=None, new_state=<state sensor.ruuvitags=5.0:58.0:1010.0:23.0:40.0:1009.0:; friendly_name=ruuvitags @ 2018-04-19T22:54:04.727841+03:00>>

When I try to access web ui:

This site can’t be reached
192.168.x.xx refused to connect.
Search Google for 192 168 xxxx
ERR_CONNECTION_REFUSED

And logfile, did multiple restarts for hass

homeassistant@raspberrypi:~/.homeassistant $ cat home-assistant.log
2018-04-19 22:53:55 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=54 from 2018-04-19 19:30:19.955594)

How should I try to backtrack this?

Edit:

homeassistant@raspberrypi:/srv/homeassistant/bin $ ./hass --script check_config
Testing configuration at /home/homeassistant/.homeassistant
homeassistant@raspberrypi:/srv/homeassistant/bin $

Even when the setup started to work eventually, it is still frustrating.

Could this be delay to web ui starting later on?

Yesterday evening it did not work. This morning it did not work. But there was power outage during the day and now everything is working like it is supposed to. I am pretty confused what is causing this seemingly random misbehaviour.

It seems that based on my testing it was not command line sensor or any of that stuff that caused this issue. It was Ikea Trådfri.

Had following rows at config:

tradfri:
host: 192.168.1.100

Removing them did the trick. Web interface starts almost immediately after restart.