Home Automation - Smartkit

InternetLuddite

Expert Member
Joined
Feb 23, 2016
Messages
1,445
This morning ... without changing anything since my post last night ... the switch appeared on the main hass.io dashboard - I saw it and then immediately I got this ... and can't recover from it. :crying:

EDIT: Another restart of Hass.io ... and home page loads again with the swtich showing and the the switch works. :love: Thanks @SauRoNZA and @ebendl :thumbsup::thumbsup:

But on another point, is hass.io really this unstable or is it just me - considering config files or nothing else was changed but rebooting hass.io a few times.


{19BF025F-74E0-4B9F-A68A-C214AF999561}.png.jpg
 
Last edited:

SauRoNZA

Honorary Master
Joined
Jul 6, 2010
Messages
37,104
I am giving up for this week. I will wait for your sonoff SV config.

Here is what the pertinent stuff looks like. It just doesn't appear on the homepage of HASS.IO even after reboots. Also note, I installed TasAdmin today and it discovered the gatemotor and with that I can control the gate. So I think it could be hass.io config issue and not a mqtt issue?

YAML:
[configuration.yaml]
mqtt:
broker: 192.168.2.2

switch: !include switches.yaml

[Switches.yaml]
- platform: mqtt
name: "FrontGate"
icon: mdi:radiator
state_topic: "stat/SNOFF_FrontGate/POWER"
command_topic: "cmnd/SNOFF_FrontGate/POWER"
availability_topic: "tele/SNOFF_FrontGate/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"


[B][FROM SONOFF GATE MOTOR CONSOLE][/B]
20:59:30 MQT: stat/SNOFF_FrontGate/STATUS6 = {"StatusMQT":{"MqttHost":"192.168.2.2","MqttPort":1883,"MqttClientMask":"SNOFF_FrontGate","MqttClient":"SNOFF_FrontGate","MqttUser":"mosquitobroker","MqttType":1,"MAX_PACKET_SIZE":1000,"KEEPALIVE":15}}
20:59:30 MQT: stat/SNOFF_FrontGate/STATUS7 = {"StatusTIM":{"UTC":"Thu Dec 20 19:59:30 2018","Local":"Thu Dec 20 20:59:30 2018","StartDST":"Sun Mar 25 02:00:00 2018","EndDST":"Sun Oct 28 03:00:00 2018","Timezone":1,"Sunrise":"08:40","Sunset":"16:55"}}
20:59:30 MQT: stat/SNOFF_FrontGate/STATUS10 = {"StatusSNS":{"Time":"2018-12-20T20:59:30","Switch2":"OFF"}}
20:59:30 MQT: stat/SNOFF_FrontGate/STATUS11 = {"StatusSTS":{"Time":"2018-12-20T20:59:30","Uptime":"0T00:14:35","Vcc":3.190,"POWER":"OFF","Wifi":{"AP":1,"SSId":"iOT","BSSId":"CC:33:BB:DA:91:42","Channel":6,"RSSI":68}}}
21:00:20 MQT: tele/SNOFF_FrontGate/STATE = {"Time":"2018-12-20T21:00:20","Uptime":"0T00:15:25","Vcc":3.190,"POWER":"OFF","Wifi":{"AP":1,"SSId":"iOT","BSSId":"CC:33:BB:DA:91:42","Channel":6,"RSSI":62}}
21:00:20 MQT: tele/SNOFF_FrontGate/SENSOR = {"Time":"2018-12-20T21:00:20","Switch2":"OFF"}
21:02:00 MQT: tele/SNOFF_FrontGate/UPTIME = {"Time":"2018-12-20T21:02:00","Uptime":"0T00:17:05"}


[B][FROM Mosquito Broker Addin][/B]

[B][CONFIGURATION OF MQTT Broker][/B]
{
"logins": [
{
"username": "mosquitobroker",
"password": "xxxxx"
}
],
"anonymous": true,
"customize": {
"active": false,
"folder": "mosquitto"
},
"certfile": "fullchain.pem",
"keyfile": "privkey.pem"
}

[B][LOGFILE OF MOSQUITO BROKER ADDIN][/B]

[INFO] Setup mosquitto configuration
[INFO] Found local users inside config
[INFO] Initialize Hass.io Add-on services
[INFO] Initialize Home Assistant discovery
[INFO] Start Mosquitto daemon
1545334298: mosquitto version 1.4.15 (build date 2018-03-04 15:35:59+0000) starting
1545334298: Config loaded from /etc/mosquitto.conf.
1545334298: *** auth-plug: startup
1545334298: ** Configured order: http
1545334298: Opening ipv4 listen socket on port 1883.
1545334298: Opening ipv6 listen socket on port 1883.
1545334298: Opening websockets listen socket on port 1884.
1545334298: Opening ipv4 listen socket on port 8883.
1545334298: Opening ipv6 listen socket on port 8883.
1545334298: Opening websockets listen socket on port 8884.
1545334298: Warning: Mosquitto should not be run as root/administrator.
1545334305: New connection from 192.168.2.51 on port 1883.
[INFO] found mosquitobroker on local database
1545334305: New client connected from 192.168.2.51 as SNOFF_FrontGate (c1, k10, u'mosquitobroker').
1545335108: Client SNOFF_FrontGate has exceeded timeout, disconnecting.
1545335108: Socket error on client SNOFF_FrontGate, disconnecting.
1545335112: New connection from 192.168.2.51 on port 1883.
[INFO] found mosquitobroker on local database
1545335112: New client connected from 192.168.2.51 as SNOFF_FrontGate (c1, k10, u'mosquitobroker').
1545335976: New connection from 172.30.32.1 on port 1883.
[INFO] found homeassistant on local database
1545335976: New client connected from 172.30.32.1 as 5b16f736-3ee3-4123-bf3e-10d427cc8559 (c1, k60, u'homeassistant').
1545336098: Saving in-memory database to /data/mosquitto.db.
One interesting point:-
The device connecting with IP 172.30.32.1 - appears to be Hass.io connecting to the broker. It only appeared after I added the mqtt broker IP in the configuration.yaml file (as per the website) ... the IP doesn't make sense to me though. I have not used that network anywhere - don't know how hass.io is using that IP?
IP is possibly from a Docker setup? Has.io uses multiple Dockers and that seems like the typical IP range.

What does your HA log say? Did the configuration pass?
 
Last edited:

SauRoNZA

Honorary Master
Joined
Jul 6, 2010
Messages
37,104
This morning ... without changing anything since my post last night ... the switch appeared on the main hass.io dashboard - I saw it and then immediately I got this ... and can't recover from it. :crying:

EDIT: Another restart of Hass.io ... and home page loads again with the swtich showing and the the switch works. :love: Thanks @SauRoNZA and @ebendl :thumbsup::thumbsup:

But on another point, is hass.io really this unstable or is it just me - considering config files or nothing else was changed but rebooting hass.io a few times.


View attachment 595288
Did you reboot HA after you made the change the first time and checked that the configuration is approved?

HA isn’t unstable at all but if you didn’t get a cleared configuration and just left it I would imagine it would fall over at some point.

It is very particular about the config. I was under the impression Hass.io makes this easier with a GUI but have never used it so don’t know.

Glad you got it working though. It is a bit of a learning curve at first but once you’ve done any one single configuration of a type it gets simpler and in time can do stuff more reliably.
 

InternetLuddite

Expert Member
Joined
Feb 23, 2016
Messages
1,445
Did you reboot HA after you made the change the first time and checked that the configuration is approved?

HA isn’t unstable at all but if you didn’t get a cleared configuration and just left it I would imagine it would fall over at some point.

It is very particular about the config. I was under the impression Hass.io makes this easier with a GUI but have never used it so don’t know.

Glad you got it working though. It is a bit of a learning curve at first but once you’ve done any one single configuration of a type it gets simpler and in time can do stuff more reliably.
I think I leant something in that in the GUI, when you say restart home assistant, it does not do a full reboot ( pretty retarded) which I what I thought it did, cos that what the label for the button says , 'restart home assistant from within home assistant' .

The only way to do a full reboot is what I am doing now, ssh in and then reboot in the terminal. It could also explain why I was having issues earlier using the configs with groups, etc as posted on Dr zzs video.

Anyway, thanks to you wonderful folks, starting simple and I have learnt more - the best kind of learning from

Today, will also connect my garage motor and then my one geyser.
 

SauRoNZA

Honorary Master
Joined
Jul 6, 2010
Messages
37,104
Weird I only use the GUI to restart for configuration changes.

But I run HA in a Docker so maybe it’s a bit different with Hass.io.

It even has a few buttons for only restarting certain sections, but I always just do the full restart.

 

patrick123

Expert Member
Joined
Apr 10, 2005
Messages
2,871
I think I leant something in that in the GUI, when you say restart home assistant, it does not do a full reboot ( pretty retarded) which I what I thought it did, cos that what the label for the button says , 'restart home assistant from within home assistant' .

The only way to do a full reboot is what I am doing now, ssh in and then reboot in the terminal. It could also explain why I was having issues earlier using the configs with groups, etc as posted on Dr zzs video.

Anyway, thanks to you wonderful folks, starting simple and I have learnt more - the best kind of learning from

Today, will also connect my garage motor and then my one geyser.
You are able to do a full reboot from within HA as well.
rboot.PNG
 

ebendl

Expert Member
Joined
Sep 27, 2004
Messages
3,657
Glad you got it working.

I use Hass.io and very seldom use the full system reboot from Hass.io. I usually just use the Restart Home Assistant button.

I did notice that recently (when I moved my HA from ResinOS to HassOS and from a 16Gb SD card to a 64 and from a Pi 3b to 3b+) that it gives an error when I restart. I had to click restart again.

Easiest way to confirm restart is to add an automation that notifies you when HA shuts down and another one when it boots up. That way you know that it did restart and you know when the GUI should be available again.
 

SauRoNZA

Honorary Master
Joined
Jul 6, 2010
Messages
37,104
After much fighting in the air with the garage motor, after testing it 100% on the ground it turns out the motherfucking bread board pins were being useless so I just soldered up the whole lot.

1545419424816.png

Tomorrow I will tackle the front gate which should be identical and then the alarm which should be simple enough but I want to see if I can get it more advanced with the PGM output.

Basically this off the top of my head...

Sonoff

Flash to Tasmota and then set configuration to Sonoff SV. Reboot and then set GPIO 14 to "10 Switch 2".

Go go console and do the following...
Code:
Switchretain 1
Powerretain 1
switchtopic2 garagestate
switchmode1 0
switchmode2 2
PulseTime1 5
Home Assistant

I was confused at first by DrZzs' use of the "cover" naming conversion until I figured out it's actually a component specifically for OpenGarage...

https://www.home-assistant.io/components/cover.opengarage/

And that's where the icons and template comes from for the up/stop/down arrows.

So therefore I needed the following...

configuration.yaml

Code:
cover: !include cover.yaml
cover.yaml

Code:
  - platform: mqtt
    name: "Garage Door"
    state_topic: "cmnd/garagestate/POWER2"
    command_topic: "cmnd/garage/POWER"
    payload_open: "ON"
    payload_close: "ON"
    payload_stop: "ON"
    state_open: "ON"
    state_closed: "OFF"
    optimistic: false

groups.yaml


Code:
Garage:
    name: Garage
    view: no
    control: hidden
    icon: mdi:garage
    entities:
      - cover.garage_door
customize.yaml

Code:
cover.garage_door:
  device_class: garage
  friendly_name: Garage Door

And that should do the job.

Now to dig into the iOS and Homekit part of it.
 

SauRoNZA

Honorary Master
Joined
Jul 6, 2010
Messages
37,104
So my front gate motor has an LED Status output which is seemingly quite accurate because if it's doing anything other than being closed it's pulsating the whole time.

Could I use that as an input on GPIO14 and simply use it as a status without the magnetic switch?

If so how? Which option? I'm reluctant to experiment because obviously I could fry the board if it takes too high a voltage (or if it can manage any at all) although it should be super low.
 

ebendl

Expert Member
Joined
Sep 27, 2004
Messages
3,657
So my front gate motor has an LED Status output which is seemingly quite accurate because if it's doing anything other than being closed it's pulsating the whole time.

Could I use that as an input on GPIO14 and simply use it as a status without the magnetic switch?

If so how? Which option? I'm reluctant to experiment because obviously I could fry the board if it takes too high a voltage (or if it can manage any at all) although it should be super low.
In principle you could but the LED is probably not the same voltage as you need on the GPIO14 pin.

If you have a multimeter you can measure it.

You're also going to have to do some coding or magic to figure out pulsing/flashing means open, but is probably doable.

Personally I'd be hesitant to try this.
 

SauRoNZA

Honorary Master
Joined
Jul 6, 2010
Messages
37,104
In principle you could but the LED is probably not the same voltage as you need on the GPIO14 pin.

If you have a multimeter you can measure it.

You're also going to have to do some coding or magic to figure out pulsing/flashing means open, but is probably doable.

Personally I'd be hesitant to try this.
I doubt it’s going to be very high voltage. Would be surprised if it even does 5v.

And I suspect it might not even be that complicated to do pulsing and such as it shouldn’t be anything more than no voltage vs some voltage.

Isn’t this pretty much exactly how all the binary sensors work anyway?

****

Besides thinking about it when people use the GPIO14 connected to a normal wall switch aren’t they passing the full input voltage through there?
 

Tinuva

The Magician
Joined
Feb 10, 2005
Messages
9,174
A reed switch just closes a loop, doesn't send through any voltage.
You correct led voltage would be low, but we still don't know what it would do to the closed loop.

I think I would opt for a voltage sensor, and just add a delay. If no voltage spike for more than 10 seconds, we can assume gate is in closed position.
 

SauRoNZA

Honorary Master
Joined
Jul 6, 2010
Messages
37,104
A reed switch just closes a loop, doesn't send through any voltage.
You correct led voltage would be low, but we still don't know what it would do to the closed loop.

I think I would opt for a voltage sensor, and just add a delay. If no voltage spike for more than 10 seconds, we can assume gate is in closed position.
Was referring to the temp sensors rather than the reed switch.

Pretty sure those are voltage based?

But I have the reed switch already so will just use that if all else fails rather than go buy more stuff. Just figured there should be a way for Tasmota to pick up a voltage spike.

Googling it is quite tricky but all indicators are that GPIO can handle anything up to 3.3v.
 

patrick123

Expert Member
Joined
Apr 10, 2005
Messages
2,871
Was referring to the temp sensors rather than the reed switch.

Pretty sure those are voltage based?

But I have the reed switch already so will just use that if all else fails rather than go buy more stuff. Just figured there should be a way for Tasmota to pick up a voltage spike.

Googling it is quite tricky but all indicators are that GPIO can handle anything up to 3.3v.
Yes you are correct, you are only dealing with voltages up to 3.3v. However to activate GPIO 14, you would short this to ground, not bring it up to 3.3v.

The temperature sensors that can used with it send a digital signal (ID and then value) not a variable voltage.
A variable voltage could require an analog to digital converter.
I would suggest rather the reed switch, or if you wanted to go the LED status route, either an optocoupler or a small relay appropriate for the voltage that is output by the LED status connection.
 

SauRoNZA

Honorary Master
Joined
Jul 6, 2010
Messages
37,104
Yes you are correct, you are only dealing with voltages up to 3.3v. However to activate GPIO 14, you would short this to ground, not bring it up to 3.3v.

The temperature sensors that can used with it send a digital signal (ID and then value) not a variable voltage.
A variable voltage could require an analog to digital converter.
I would suggest rather the reed switch, or if you wanted to go the LED status route, either an optocoupler or a small relay appropriate for the voltage that is output by the LED status connection.
Yeah I see the analog input is also limited to 1V so can’t even risk that without a volt meter.

Still would have been nice to keep it all in the box without winning wiring external.

What’s the worst that could happen shorting 3.3v to ground? Sparks and fire I would imagine.

I assume the same applies for all the other GPIOs?
 

InternetLuddite

Expert Member
Joined
Feb 23, 2016
Messages
1,445
All this talk makes me very happy that I just got the open garage device.
As a newbie to this, and having had some issues not with the controller (Sonoff SV) but the programming side (because I am newbie), I am quite happy that I now appear to have a reliable iot device for under 200 bucks. Never heard of the open garage stuff. Does it just work with motors, etc. What cost ? If you tell me 200.00 then, I would cry
 

SauRoNZA

Honorary Master
Joined
Jul 6, 2010
Messages
37,104
All this talk makes me very happy that I just got the open garage device.
Don’t see how much the device would really change in the equation.

Unless I’m missing something it needs all the same additional hardware or connections for much more money.

My question were around trying to find a different way than the norm to do things.
 

Slip

Well-Known Member
Joined
May 16, 2005
Messages
338
Hi. Can anyone in JHB assist me with flashing a Sonoff Pow R2 with Tasmota. Thanks.

All sorted. Ended up using an old raspberry pi and esptool with external 3.3v power supply.
 
Last edited:
Top