Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95513

Why won't this switch?

$
0
0

@Ydraiggoch wrote:

Hi. I’m hoping someone could look at my config and tell me if I’ve missed something?

Basically, I have 2 switches (One Sonoff Mini & one Sonoff Basic). All I want to do is to be able to switch either one of them from the Overview page, which seems simple enough. But if I’m honest, I seem to be struggling.

Heres my config

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

mqtt:
  broker: 192.168.1.91
  port: 1883
  username: "Ydraiggoch"
  password: "Password"

switch:
  - platform: mqtt
    name: "Balcony"
    command_topic: "cmd/sonoff01/power"
    state_topic: "stat/sonoff01/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
    
  - platform: mqtt
    name: "Fish"
    command_topic: "cmd/sonoff02/power"
    state_topic: "stat/sonoff02/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

I have the switches visible on the Overview page;

image

But when I try to switch one of them on, it toggles on for about 5 seconds before turning off again automatically.

I suspect this is something to do with the MQTT, but not sure what.

I have the Mosquitto Add On installed and each sonoff is connected (according to the Log & Console in Tasmota.
Here is a snip from the MQTT Log;

1575211104: New connection from 192.168.1.86 on port 1883.
[INFO] found Ydraiggoch on local database
1575211105: New client connected from 192.168.1.86 as DVES_A76427 (p2, c1, k30, u’Ydraiggoch’).
1575211334: Saving in-memory database to /data/mosquitto.db.
1575213135: Saving in-memory database to /data/mosquitto.db.
1575214936: Saving in-memory database to /data/mosquitto.db.
1575216737: Saving in-memory database to /data/mosquitto.db.
1575218538: Saving in-memory database to /data/mosquitto.db.
1575220339: Saving in-memory database to /data/mosquitto.db.
1575222140: Saving in-memory database to /data/mosquitto.db.
1575223941: Saving in-memory database to /data/mosquitto.db.
1575225742: Saving in-memory database to /data/mosquitto.db.
1575227543: Saving in-memory database to /data/mosquitto.db.
1575229344: Saving in-memory database to /data/mosquitto.db.
1575231145: Saving in-memory database to /data/mosquitto.db.
1575232647: Client auto-6265ECCA-A22F-9C79-5C11-D775021797B9 disconnected.
1575232668: New connection from 192.168.1.91 on port 1883.
[INFO] found Ydraiggoch on local database
1575232669: New client connected from 192.168.1.91 as auto-FBF6F6AA-DA5F-52A9-B2CF-4A719AB40635 (p2, c1, k60, u’Ydraiggoch’).
1575232946: Saving in-memory database to /data/mosquitto.db.

191.168.1.86 is one of the switches and 191.168.1.91 is the Home Assistant (Py) and MQTT

Could this have anything to do with both the MQTT and HAS starting at the same time (on the same IP address?

Thanks for any suggestions

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>