Successfully installed hass.io on rpi2, would it be possible to

Ok so I installed it and can successfully log in. Im doing this on an rpi2, because my home automation stuff is currently on an rpi3. That rpi3 simply runs a python script at an interval and checks time and decides whether or not to send toggle commands to a ble relay board its connected to via bluepy. But I plan to add quite a few more things to the home automation so I wanted to get a home assistant to help me with it all.

Some things I wish to do are:

  1. homebridge - got interested in this because i have an iphone and appletv (old version). But aside from making the lights go on and off automatically which are controlled by 1/4 relays, I have relays 2 & 3 which I would like to activate manually via iphone or mobile device in general. I just thought apple’s home kit looks nice. Actually I wanted to just install homebridge on my rpi2 and discovered ha and fell in love with it. So do I just install homebridge and configure it to discover/recognize/connect to my ble-relay board directly, skipping over the rpi3 completely?

  2. google api.ai - got interested in this because ive used a google action (spoken to google home device) created in api.ai with a webhook referencing my rpi-nginx server to run a py script on my rpi to toggle the relay via ble. But I believe with home assistant I can do this without requiring the api.ai-internet connectivity, I can simply talk to my local home assistant, right? One more thing, even using the google api.ai, could I have spoken to my google assistant on my phone as if it were my google home device and have had it toggle the lights? That would be handy when not at home but while at home Id rather use the local ha to toggle my lights and stuff.

  3. esp8266-emoncms - currently i use an esp8266 to log data to emoncms (a content management system that graphs data and stores data in mysql nicely). Would it be possible to view that data from hass.io?

  4. Is this hass.io install on my rpi2 referred to as hassbian? What exactly is it, some extremely light *nix flavor? Can I have it run python scripts as well as on raspbian?

  5. What are the usual next steps before I get into my customized configuration? I read I have to secure it, does that refer to the login password?

Thanks

Hello and welcome to the wonderful world of Home Assistant.

  1. No idea but there are plenty of threads about this.
  2. Google Assistant is possibly what you want https://www.home-assistant.io/components/google_assistant/
  3. https://www.home-assistant.io/components/sensor.emoncms/
  4. No. https://www.home-assistant.io/faq/#home-assistant-vs-hassio
  5. https://www.home-assistant.io/docs/configuration/securing/

Home asssistant is well documented. Please do read the docs. All of your questions would have been asked if you’d done some reading.

I can’t really help with 1 - 3 since I 1. don’t use any Apple stuff, 2. don’t use Google Home stuff, 3 don’t have any idea what emoncms is or how to interface with it.

That leads us to 4.

HassOS and Hassbian are kind of the same in that they both install an instance of Home Assistant and ultimately use the same style of configuration (mostly yaml in text files but there is some movement toward GUI configuration). But they are installed onto completely different base operating systems.

Hassbian is an instance of Home Assistant (HA) installed in a virtual environment on a base Linux OS. It is a downloadable image that can be burned directly onto an SD card and when inserted to your Raspberry Pi (which needs to be connected the the internet) will download and install the rest of the operating files for HA.

Hassio is runs on an (almost) competely different OS made specifically to run HA. Once you burn Hassio onto your SD card you can’t run any other programs along side it other than what can be downloaded and installed from the add-on repository.

Here is some more info on HassOS:

then there are a couple of other versions of HA that can be installed (but I guess they can’t properly be referred to as “versions” since they all lead to the same end result):

You can manually install HA in a virtual environment on any Debian based Linux OS (that is what you seemed to be trying to do in your other thread on this subject - apparently you were successful?). That allows you to run any other Linux app along side HA just like on any other program. This is ultimately what you get when you install Hassbian on a RPi. It’s just that all of the installation work is done for you in the image. After that you get the same end result as this.

You can run HA in a container installed in docker.

And there are other various ways to install HA on other different platforms.

But, again, ultimately you get a very similar end user experience any way you decide to install HA.

  1. Usually people install HA then decide on the first types of hardware they want to control with it and see if there is a pre-integrated component available in the “component” section of the website. If there is then things are good. Otherwise, things get hairy unless you can learn to write your on custom components. Or you have a buddy who can do it or can bribe someone to do it. :wink:

So now I guess I need to ask - did you install Hassio or did you install non-hassio in a virtual environment?

Thanks. Since I had a rpi2 to mess with, I did Hass.io on am sd card as the os.

So now I understand from a doc linked by weekday you mentioned that I can’t run anything else on my rpi2 now? So I can’t run python scripts?

I dont think I tried Homeassistant directly onto rpi2, I tried homebridge and failed because I couldn’t get python 3.5.3 onto my rpi2 for some reason. So I took out the SD card and plopped in the Hass.io one. Ill try to see if I can run python scripts on it because I use them to access gpio pins etc.

So revisiting my questions although I know nick answered them:

  1. Ok I’ll look for those articles about homebridge add-ons. My question was not so much how to install the add-ons but more a matter of am I thinking right when I assume I would use homebridge add-on to skip over rpu2 and connect directly to the BLE device.

  2. I know there is a Google assistant add-on but what I mean is, can I skip using the Google assistant since I believe it uses internet connectivity for the api.ai, and use a local voice command add on to control devices when I’m at home? But I’ll find out when I look into it.

  3. Emoncms addon, Check!

  4. Ok Hass.io and Hassbian are not the same. I sorta understand how different they are but IL still unclear about running python scripts.

  5. I ran into an issue configuring ha as per the instructions because when it tells me to add the yaml code to add the configurator to the sidebar, I’m not sure where the yaml code goes. That’s what my other post was about.

Well Ive got some studying to do…thanks a mil!

If you want to run scripts that aren’t in core hassio or one of the many add-ons, then you should use hassbian. Or add home assistant to your existing pi.

Ok ive got:

  1. homebridge - working on it, i cant find it in the addon store, but I found this:HomeKit Bridge - Home Assistant
  2. google assistant - may replace with or complement with snips
  3. emoncms - installed
  4. hass.io - installed
  5. config error - figured it out

As for hass.io, since ive got it running on rpi2, because rpi2 might not be powerful enough to run rasp.stretch with ha running over it, eventually i might want to move it over to rpi3 running stretch and ha.

In either case:

With rpi2 i normally access my ble relay board via a ble-hm10 module connected to its gpio pins and i send commands from a python script via the serial port.

With rpi3 i normally access my ble relay board via rpi3’s built in ble using bluepy in a python script to send commands to the ble-relay board.

Since I cant run python scripts on hass.io, the other way would be to access the ble-relay board directly via ble, right? Again I couldnt find the bluetooth addon so thru the conf.yaml I added:

# Example configuration.yaml entry
device_tracker:
  - platform: bluetooth_le_tracker

but when i validated the config and restarted ha, nothing new shows up. I thought it was somehow going to scan and discover ble devices nearby.

I just found this:

Error setting up platform bluetooth_le_tracker
9:25 PM components/device_tracker/init.py (ERROR)
No Bluetooth LE devices to track!
9:25 PM components/device_tracker/bluetooth_le_tracker.py (WARNING)
Unable to load /config/known_devices.yaml: Config file not found: /config/known_devices.yaml
9:25 PM components/device_tracker/init.py (ERROR)
Unable to load /config/known_devices.yaml: Config file not found: /config/known_devices.yaml
9:25 PM components/device_tracker/init.py (ERROR)

I think it wont work because rpi2 doesnt have onboard ble, and the module really works with serial comm. So I either write a script to send commands to the hm10 module at the gpio pins, or I get a dongle, right?

Dongle is too easy, does anyone know of a serial comm way to do it?

Fiity’s answer it the best.

4 & 5 - It sounds like you are going about installing Home Assistant the hard way. Like I did about 6-months ago.

I just download the SD card image from Installation - Home Assistant then start modifying the configuration.yaml file.

Home Assistant is well documented, but like any open-sourced system, you need to know what to look for. So, don’t be offended when someone answers your question with a link.

You really only need to secure Home Assistant if you expose it to the web. Mine is internal only on my local network, so I use minimal security.

If you already have something working on another Pi, just use MQTT messaging to pass the control or data between Pi’s or esp8266 nodes. I have several esp8266 nodes around the house including Sonoff Basic and Sonoff Touch switches. I also have some esp8266-01 nodes with temperature sensors in several rooms. There’s also a few Raspberry Pi Zero’s. They all communicate with Home Assistant over MQTT messaging.

I couldn’t have gotten this far without the support from the more experienced people on this forum. I only recently felt like I could answer some newbie questions with the caution that I am likely wrong.

Thanks Steve Ann,

I did use Hass.io image.

I don’t mind links to places. Like you said it’s well documented but you have to know what to look for. I didn’t know you could install some add-ons from the store but others you could just edit the yaml file. I didn’t know where the yaml file was, heck I didn’t know OS file structure was visible and there for me to browse, which leads me to believe I could get away with running py scripts because I found out there is an addon for the command line or something. That would let me run my scripts to send commands over serial-ble.

But back to your idea of mqtt, we’ll I don’t know what it is so I’ll take a peek. I guess I would need to find out if the BLE devices I have can communicate over mqtt by somehow implementing it over ble?

COMMAND LINE SWITCH OPTION
Ok I looked into this and found: https://www.home-assistant.io/components/switch.command_line/

I understand the format is:

# Example configuration.yaml entry
switch:
  platform: command_line
  switches:
    arest_pin_four:
      command_on: "/usr/bin/curl -X GET http://192.168.1.10/digital/4/1"
      command_off: "/usr/bin/curl -X GET http://192.168.1.10/digital/4/0"
      command_state: "/usr/bin/curl -X GET http://192.168.1.10/digital/4"
      value_template: '{{ value == "1" }}'
      friendly_name: Kitchen Lightswitch

I guess I would replace those command_X: statement values with my py scripts. But I dont know how I would create those py scripts. I created a python script that prints out the datetime thru the configurator, in the config folder. Not the best place I guess but I didnt know where else to put it. So how do I have it run?

BLE - MQTT OPTION

I installed the mqtt but I cant figure out how to use it to connect to my ble device? Although Ive read that ble is not a desired protocol to interface with mqtt, so my other option would be to interface from this rpi2 with hass.io to my rpi3 in order to have IT run the py script.

So my two current options: command line switch vs mqtt-option out of which the second seems more feasible. I would need to install mosquito mqtt on the receiving rpi3 as well, correct?

yes. And set the broker of your RPi3 to the IP of your hassio RPi.

Then you just publish to the correct topic on your hassio and that gets picked up by your RPi3 that’s subscribed to the same broker.

Ok thanks, Im still just a bit confused. Im reading this article:

#1 So I run this on the rpi3:

sudo apt-get install -y mosquitto mosquitto-clients

which will install mosquito on the rpi3.

#2 I then need to install this on rpi3 as well:

sudo pip install paho-mqtt

in order to run a script that listens for mqtt messages on the rpi3?

#3 And then I set up the publishing end from home assistant thru automations, or thru scripts or thru configuration.yaml code?

I don’t know about #2 since I don’t use the method you are referring to for MQTT comms between Pi’s. I don’t use paho-mosquitto.

But #1 & #3 are definitely correct.

The only thing that I don’t know how you do is to subscribe to the broker on the Pi2. It looks like that’s what the article is telling you but without more investigating I can’t be sure of that.

the best I can tell you is give it a try and see if it works.

BUT Make sure you make a back up of your Pi3 SD card first in case things go south!

Do both rpis have to be on the same wifi network? I guess so huh?

Ok, I had my rpi3(192.168.1.113) with installed mosquitto running (checked systemctl status mosquitto.service) and I ran the terminal command:

mosquitto_sub -h localhost -v -t test_channel

and I downloaded an mqtt app on my iphone and connected to the same network with host 192.168.1.113 and no username or pwd because i didnt know which. Then I sent a “hola caracola” test message to the “test_channel” and got it in the rpi3. Im giddy!

A few doubts:

  1. This means I can now have mqtt on hass.io somehow send messages to that test_channel via an automation? Ive gone into automation and looked around. If I want to test sending a message to rpi3 from hass.io, what kind of trigger would I use if i just want to send a test message for example?

  2. I need to run a script to wait for messages FROM the hass.io TO the rpi3, ON the rpi3 itself. From the article mentioned above that would be the mqtt_subscriber.py. So do I just leave that py script running? I guess I could run it in the same tmux session as the original python script I run at present? So if I do, and I figure out how to publish the message from the hass.io, I would have to go into that tmux session to view the message received, right?

  1. you could create an input_boolean that will create a dummy “switch” in HA that you can turn on and off that you can then use as your trigger for the automation.

  2. No idea. Way above my paygrade. :slightly_smiling_face:

Thanks I did the following:

In my configuration.yaml file I added this:

input_boolean:
      notify_home:
        name: Publish MQTT msg
           initial: off
           icon: mdi:car

then in automations I did this:


And I set up my rpi3 running mqtt to listen to this ip address (192.168.1.106 & test_channel) via a python script that I tried and succeeded from this very ha instance via the services>mqtt.publish link. I get this in the main dashboard:

But neither toggle switch sends the mqtt msg as nothing shows up in the mqtt-listening-rpi3.

OOOOHHhhhhh…I seem to have inter-messed them up :slight_smile:

The mqtt msg is sent only if i click on Automation toggle first and then on the input boolean second. How do I fix this and do I need both of those panels?

I did post the code correctly but there’s a bug when you do so inside a numbered list

Please look at the panel at the top of each and every forum page about how to post your code correctly and readably.

Also, please don’t post screenshots of stuff like the automation error. What counts is the code it generates, which you should find in automations.yaml.

I did post the code properly but the code tags fail when I side a numbered list.

Also I didn’t post screenshots of any error. I posted screenshots of how I set up my Automation.

Sorry your code looked wrong before, looks fine now.

In relation to your automation, you would be better to post the generated code (from automations.yaml) than to post the gui, it is easier to make sense of.

Now the automation toggle simply turns the automation code on or off. If it is off it will never trigger. So, yes, you need to turn that toggle on before the automation will work.

Yes thanks, I did fix it, but to do so I had to remove the number bullets. Anyway here is the configuration.yaml code for the boolean:

# Example configuration.yaml entry
input_boolean:
  notify_home:
    name: Publish MQTT msg
    initial: off
    icon: mdi:car

And here is the automations.yaml:

- id: '1540843414270'
  alias: MQTT T1R1
  trigger:
  - entity_id: input_boolean.notify_home
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      payload: holacaracola
      topic: test_channel
    service: mqtt.publish

So i need both toggle switches on the dashboard? It seems cumbersome in case i want many more switches, but maybe because Im still not clear how these things all fit together. But if I understood correctly, you say I do need both?