I’ve flashed some smart plugs with tasmota.
Now I am trying to control them with openhab.
I followed this guide →
the guide is very useful and understandable.
My problem is, that my tasmota smart plug is not reacting to my commands.
The log shows: 2021-04-11 03:06:04.405 [ome.event.ItemCommandEvent] - Item 'sBrilliantSwitch' received command ON 2021-04-11 03:06:04.411 [nt.ItemStatePredictedEvent] - sBrilliantSwitch predicted to become NULL 2021-04-11 03:06:05.793 [ome.event.ItemCommandEvent] - Item 'sBrilliantSwitch' received command OFF 2021-04-11 03:06:05.797 [nt.ItemStatePredictedEvent] - sBrilliantSwitch predicted to become NULL
I’ve then started to check the broker.
Inside of the PaperUI, the broker is marked as “online”.
Also, I tried to see the connection with putty with the command: mosquitto_sub -d -t +/Steckdose01/#
When I change the item nothing happens…
I think it is not a problem with my configuration (.things and .items)
I think it’s a problem with my phoscon CONBEE USB Stick…
Cause when I open the webpage from my RPI-IP I get directed to the main page of that USB-Stick (CONBEE II)
After I refreshed the webpage I can see a PINGREQ at Putty while I am tracing the Broker…
My question:
Will, it possible to change the MYQTT Broker IP while it’s running on the same Raspberry with Openhab and the CONBEE Stick for DeconZ ?
Or am I wrong and my configuration is just faulty?
.thing: Bridge MQTT:broker:myMQTTBroker "My only one and best MQTT server" [ host="192.168.178.XX", username="TEST", password="TEST", clientID="OpenHAB2" ]
(XX and TEST is not the original code… I’ve edited for here)
which ports do you use ?
In case you the browser and you do not end up on the page that you wanted to see it sounds like the same port is being used for two things ( in meaning of services ).
So what webpage did you intend to open when you were redircted to the main page of CONBEE ?
@rossko57
yes, I got an update problem with the .thing.
I fixed this now the Item is receiving the command “on” and “off” for example 2021-04-11 12:27:56.629 [ome.event.ItemCommandEvent] - Item 'sPorchLight' received command OFF 2021-04-11 12:27:56.636 [nt.ItemStatePredictedEvent] - sPorchLight predicted to become OFF 2021-04-11 12:27:56.675 [vent.ItemStateChangedEvent] - sPorchLight changed from ON to OFF 2021-04-11 12:28:05.495 [ome.event.ItemCommandEvent] - Item 'sPorchLight' received command ON
I’ve named it differently from my first try because I followed the guide again.
Now, this is correctly set, it won’t work again :<
@Wolfgang_S
When I open my Raspberry IP address inside a browser I get Error: Connection failed
I must say, I’ve unplugged the CONBEE II Stick → when I plug it in, I get directly to the MainPage of the CONBEE II.
To my shame, I don’t really know which ports I use, cause I don’t have much knowledge about port handling.
I know that I use :8080 for my openhab side but I think, that’s not that info u want
The Bridge for the deconz Binding has no port specified in the code. I just have to put the IP and the unic apikey in it.
@denominator
yeah, I tried to unplug it and reboot it, unfortunately, it does not work
summarized, the .thing should work correctly now as I can see in the logs.
I don’t get directed to a Webpage when I open my IP from the raspi.
Should under my IP the MQTT Broker open inside a web browser?
Cause I really don’t see it… I don’t know it at all.
Have a look at Port (computer networking) - Wikipedia it describes what a port in computer networking means.
In case you use an URL in a browser that starts with http and there is no specific port number is mentioned it uses port 80. In case you use https in an URL and do not mention a specific port number it is port 443.
To get an overview which ports are used by your services you may run
sudo netstat -tulpn | more
in a shell. This will show them. Those which have LISTEN in the report are the listening ports.
In case you do not specify a specific port in the browser and you are redirected to the CONBEE page it looks like your CONBEE stick is listening at port 80. You should be able to see that by using the above command. In my case my CONBEE stick is running at port 8090. This also needs to be mentioned in the bridge definition.
What did you expect to see in the browser when you entered you raspis IP address ?
i tried your command after I started the deconz binding and plug the conbee again.
I can see, that as you say the deCONZ ist running under Port 80.
The Mosquitto is running under 1883.
When I understand it correctly, that should not be a problem then.
And both services should run parallel on the raspberry… correct ?
Now I understand why the default port from my tasmota smart plug is 1883.
So this Is correct I think.
mhh what did I expect, I think nothing
Cause I don’t know if the mosquito service has an webpage or something like that.
I just tried to figure out why the tasmota smart plug wont react.
Cause inside the MQTT settings the host is my IP Address from the raspberry.
And I thought that this could be a problem with the conbee.
But when the ports are correct that should work parallel when I understand it correctly.
Then is the next question, why the smart plug isn’t reacting… while the mqtt and smartplug thing is “online”.
this is my bridge now: Bridge mqtt:broker:myMQTTBroker "MQTT Broker" [ host="192.168.178.myip", port=1883, username="myuser", password="mypassword", clientID="OpenHAB2" ]
used to obfuscate the real ip or did you literally use it ? If the later is the case you need to replace myip with the real / correct part of the ip address.
hm, i tried different forum posts and I come to that point, there are plenty of .things or .items styles… sometimes it uses JSONPATH inside the .item, and sometimes not… I choose the option as you can see above… but I tried it all actually…
i didnt know it…
thats why i ask, I thought there will be a problem with the IP.
Cause under my localhost IP I only get directed to the CONBEE webpage… i didn’t know if that makes any trouble while the localhost IP from the MQTT is also the same…
but I learned, that should not affect each other cause there are using different ports.
IP is in where on the network the computer resides/is. Port is like window in a ship each service has its own port that you connect through.
I can’t see what you don’t post can you share the logs?
Can you use code fences when putting code into forum post just click on </> preformatted text and replace the text “type or paste code here”
Mosquitto is a MQTT broker service it dose not have a webpage console so you can’t point a browser to it. Use the MQTT Explorer I linked above. It will be your window into what is going on.
System integration is the hardest thing to do in IT you are doing great.
I think you are suffering from information overload or forum craziness.
Can you describe how you are doing thinks e.g.
I run openhab2 on a RPI 3 and connect to it from my windows 10 machine. I use VScode with the openHAB extension to edit my config files which has a LSP for making sure things work. It looks like
now it’s getting hard for me, I connected to MQTTE.
as you can see, I am able to see 3 “things” dont know why but for a first try okay.
All “things” are offline.
I think here is my problem.
I tried a lot, but I am not able to get it “online”.
under the point “tasmota” → discovery is this my device ?
cause the log of the tasmota device says connection failed
that confuses me a bit.
I’m having trouble clearly following all this, but it looks like you’re having a fundamental issue connecting reliably to your MQTT broker - this needs to be sorted out first.
Again: what broker are you running? What version is it? Mosquitto has had a very recent update which requires existing configurations to be modified, but I don’t know if that’s the case for a fresh install.
I would at least remove the username and password from your broker to reduce the amount of things that can go wrong at this stage.
I was so obsessed with all that information around the forums that I didn’t understand, that I was not saving my password for MQTT at the Tasmota device…
That was a hard process…
Okay, I am getting over it…
That’s why my device on the screenshots is “offline”… well when I save the correct password it works… what a miracle… shame on me
Well the MQTT Explorer is so helpful for me, that helps a lot.
Back to the question I am running mosquito 1.5.7.
My first Smart Plug works fine.
I can control it via MQTTE and also via Openhab.
.things
Channels:
Type switch : ch1 "AN/AUS" [ stateTopic="stat/Steckdose_01/POWER", commandTopic="cmnd/Steckdose_01/POWER", on="ON", off="OFF" ]
Type number : ch1PowerTotal "Energie Total" [ stateTopic="tele/Steckdose_01/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Total" ]
Type number : ch1Power "Leistung" [ stateTopic="tele/Steckdose_01/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power" ]
Type number : ch1Voltage "Spannung" [ stateTopic="tele/Steckdose_01/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage" ]
Type number : ch1Current "Strom" [ stateTopic="tele/Steckdose_01/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current" ]
I’ve tried to type the Status into the console of the tastmota device.
Status 8 should be the one I need for Updating current-voltage etc.
Console Tasmota Device
15:29:20.045 CMD: status 8
15:29:20.055 MQT: stat/Steckdose_01/STATUS8 = {"StatusSNS":{"Time":"2021-04-12T15:29:20","ENERGY":{"TotalStartTime":"2021-04-10T20:30:28","Total":0.054,"Yesterday":0.000,"Today":0.054,"Power":0,"ApparentPower":0,"ReactivePower":0,"Factor":0.00,"Voltage":0,"Current":0.000}}}
My rule looks like this:
rule "TEST"
when
Time cron "0 0/1 * 1/1 * ? *"
then
val mqttActions = getActions("mqtt","mqtt:broker:myMQTTBroker")
mqttActions.publishMQTT("cmnd/Steckdose_01/status","8")
logInfo("Tasmota.rules", "TASMOTA Update")
end
It triggers every minute (just for testing) but anyways, the items are not getting updated in OH.
The rule is getting triggered, I just see the loginfo which I build into
I can also see via the MQTTE that the Status fields are getting updated with that rule → in MQTTE the Status fields are “lighten” up when it refreshes.