home assistant slaves
I found only https://home-assistant.io/developers/multiple_instances/ with pretty simple python script, but after spending hours of finding and trying different solutions, i still cannot get hass up and running with sharing states. Problem was when community rewrite all core components to python 3 asyncio. Here is my woring example of slave's code:
#! /Users/michaelkuty/projects/hass/bin/python3 import logging import homeassistant.bootstrap as bootstrap import homeassistant.config as config import homeassistant.remote as remote from homeassistant.const import EVENT_HOMEASSISTANT_START # setup logging logging.basicConfig(level=logging.DEBUG) # Location of the Master API: host, password, port. # Password and port are optional. remote_api = remote.API("localhost", port=8124) # Initialize slave hass = remote.HomeAssistant(remote_api) hass.config.config_dir = "/Users/michaelkuty/projects/hass/.config" myconfig = config.load_yaml_config_file( "/Users/michaelkuty/projects/hass/conf.yaml") # To add an interface to the slave on localhost:8123 #bootstrap.setup_component(hass, 'frontend', myconfig) def setup_platforms(event): """Setup platforms.""" bootstrap.setup_component(hass, 'api', myconfig) bootstrap.setup_component(hass, 'http', myconfig) bootstrap.setup_component(hass, 'switch', myconfig) bootstrap.setup_component(hass, 'sensor', myconfig) hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, setup_platforms) hass.start()
and config: http: server_port: 8124 switch: platform: command_line switches: garage_door: command_on: switch_command on kitchen command_off: switch_command off kitchen command_state: query_command kitchen value_template: '{{ value == "online" }}' friendly_name: Kitchen switch sensor: - platform: command_line command: date name: Command sensor 22222 unit_of_measurement: "h" value_template: '10'