Well, I have tried to work my way through your explanations. As I understand it:
When I switch on the In pool light (fibaro_system_fgs213_switch_switch_4) in hassbian 2 it sends a topic “hassbian2/switch/fibaro_system_fgs213_switch_switch_4/state” with the value “on”. This is picked up by hassbian1 and shows the “on” state for fibaro_system_fgs213_switch_switch_4 on it’s front page.
When I toggle the fibaro_system_fgs213_switch_switch_4 button on the front page of hassbian1, hassbian1 sends a topic “hassbian2/switch/fibaro_system_fgs213_switch_switch_4/set” with the value “off”. This is picked up by hassbian2 and triggers the fibaro_system_fgs213_switch_switch_4 to turn off.
On hassbian1 I have:
Removed mqtt_eventstream from configuration.yaml
Added in configuration.yaml:
mqtt_statestream:
base_topic: hassbian2
publish_attributes: true
publish_timestamps: true
include:
entities:
- switch.fibaro_system_fgs213_switch_switch_2
- switch.fibaro_system_fgs213_switch_switch_4
On hassbian2 I have:
Removed mqtt_eventstream from configuration.yaml
Added in configuration.yaml:
mqtt_statestream:
base_topic: hassbian2
publish_attributes: true
publish_timestamps: true
include:
entities:
- switch.fibaro_system_fgs213_switch_switch_2
- switch.fibaro_system_fgs213_switch_switch_4
Added in automations.yaml (of hassbian2):
automation mqtt_config_entity_creator_switch
automation mqtt_command_switch:
I changed the topics from “homeassistant/…” to “hassbian2/…” I hope that was correct.
In the hassbian2 log I can see:
Apr 24 23:13:43 hassbian2 hass[21249]: 2019-04-24 23:13:43 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on hassbian2/switch/fibaro_system_fgs213_switch_switch_4/state: off
Apr 24 23:13:43 hassbian2 hass[21249]: 2019-04-24 23:13:43 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on hassbian2/switch/fibaro_system_fgs213_switch_switch_4/state: b’off’
I don’t know if the “b” in "state: b’off’ is important.
I have also seen:
Apr 24 23:33:27 hassbian2 hass[22842]: 2019-04-24 23:33:27 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on hassbian2/switch/fibaro_system_fgs213_switch_switch_4/config: b’{“name”: “Fibaro System Fgs213 Switch Switch 4”, “device_class”: “off”, “pl_off”:“off”, “pl_on”:“on”, “command_topic”: “hassbian2/switch/fibaro_system_fgs213_switch_switch_4/set” }
So I assume the MQTT messages are working.
However, I cannot see on the States page of hassbian1 any sign of the Fibaro switches that exist on hassbian2. Do I need to add to hassbian1’s configuration.yaml something like:
switch:
- platform: mqtt
state_topic: "hassbian2/switch.fibaro_system_fgs213_switch_switch_4"
command_topic: "hassbian2/switch.fibaro_system_fgs213_switch_switch_4/set"
name: "In pool light"
payload_on: "on"
payload_off: "off"
Also I have noticed the following line in the log:
Apr 24 23:33:17 hassbian2 hass[22842]: 2019-04-24 23:33:17 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to homeassistant/#
I think this is because I have “default_config:” in configuration.yaml of both hassbians. Do I need to turn this off?
Thank you very much for your support with this.