Hi all am trying to use RPIEasy to operate some relays for a sprinkler system on a raspberry pi3.
The problem am having is when trying to publish a message with mqtt to trigger a relay. I want to remotely toggle a relay on/off using MQTT commands
I tried to use MQTT Explorer, I can see the topics but I can't seem to PUBLISH messages to trigger a relay on and off,
How can I Publish messages in RPIEasy on a raspberry.
I can publish messages on a esp8266 but not on a raspberry.
Publish MQTT mwessages to toggle relay on/off
Moderators: grovkillen, Stuntteam, TD-er, enesbcs
Publish MQTT mwessages to toggle relay on/off
Last edited by roystervi on 13 May 2021, 20:39, edited 1 time in total.
Re: Publish MQTT mwessages
Please be a little more specific.
Do you want to send an mqtt message FROM rpieasy to a sprinkler system, or do you want to RECEIVE mqtt messages and change a GPIO state according it?
If you want to receive, you can add a Generic MQTT controller, and can send generic ESPEasy commands: "<MQTT subscribe template>/cmd" like gpio,12,1 ...
But you can also add P029 Output helper plugins which can be controlled from mqtt like "<MQTT subscribe template>/set" with payload 0/1
Template has to be set inside controller settings, it is unitname/taskname/valuename as default.
Or if you are using Domoticz, the DomoticzMQTT controller works simply. After you added a P029 Output helper, set the IDX to a valid Domoticz switch device, the gpio which assigned to the specific task can be controlled immediately without playing templates.
Re: Publish MQTT mwessages
Have you ever use MQTT explorer to monitor your MQTT host ?
YEs I like to use my home automation sys to control a relay on my Raspberry pi that has rpieasy install ON IT via mqtt... am using Generic MQTT controller and gpio is set to output
here is an example whereby if I use a esp8266 this code below work fine
but when I use rpieasy on a raspberry pi this code does not work. only the topic I can see but the relay does not toggle
Am using home assistant
What is the "P029 Output helper plugins" and where can I fine it?
switch:
- platform: mqtt
name: "driveway relay"
state_topic: "garageesp/drivewaysw/Switch"
command_topic: "garageesp/gpio/15"
payload_on: "1"
payload_off: "0"
optimistic: true
retain: true
qos: 0
YEs I like to use my home automation sys to control a relay on my Raspberry pi that has rpieasy install ON IT via mqtt... am using Generic MQTT controller and gpio is set to output
here is an example whereby if I use a esp8266 this code below work fine
but when I use rpieasy on a raspberry pi this code does not work. only the topic I can see but the relay does not toggle
Am using home assistant
What is the "P029 Output helper plugins" and where can I fine it?
switch:
- platform: mqtt
name: "driveway relay"
state_topic: "garageesp/drivewaysw/Switch"
command_topic: "garageesp/gpio/15"
payload_on: "1"
payload_off: "0"
optimistic: true
retain: true
qos: 0
Re: Publish MQTT mwessages
Not sure why i want to do that.
Well, I am a Domoticz user.
The same place where every plugin exists: in Devices tab
^
There are no such thing in RPIEasy. RPIEasy is not ESPEasy. You can use direct commands (compatible) or tasks/devices (preferred way) to manipulate GPIOs remotely.
^
This accepts 0/1 payload as i wrote previously. This is how it works since 2018.
Although you can alter template at controller and name a P029 task as "gpio" and a value like "15" if you prefer this naming scheme...
This is also working since 2018 in RPIEasy and in ESPEasy: (compatible mode)
<MQTT subscribe template>/cmd with payload: <command>
https://www.letscontrolit.com/wiki/inde ... _Reference
Re: SLOVED:
SLOVED:
If anyone using HA and and need to send MQTT commands from HA to RPIEasy on a rspberry pi
1st I went into Controllers and use "Generic MQTT" then enter in my HA MQTT host info
2nd I went into DEVICES and choose "Output - Output Helper" -- Give it a "name", select the "gpio" -- select "Send to Controller" and saved.
3rd In HARDWARE go to "Pinout&Ports" The gpio you use in the 2nd step in the dropdown menu make that gpio an "outout" if you using a relay.
4th Getting the Topic and Publish command. the Topic and Publish command is the same and it goes like this. %sysname%/Name/Values/set
My example: state_topic: "RPIEasy/zone2/State/set" and command_topic: "RPIEasy/zone2/State/set"
Also you can use MQTT explorer to test publish send and receive before using the code in your Yaml file
switch:
- platform: mqtt
name: "testing rpieasy"
state_topic: "RPIEasy/zone2/State/set"
command_topic: "RPIEasy/zone2/State/set"
payload_on: "1"
payload_off: "0"
optimistic: true
retain: true
qos: 0
NOTE: This instructions is for HA users.
If you don't know what HA is, this instructions is not for you.
I got mines to work so I thought I share with fellow HA users.
See you in the FB forum.
any question its "Bobby Walters" in "DR Zzzzzz"" or the Hookups"
If anyone using HA and and need to send MQTT commands from HA to RPIEasy on a rspberry pi
1st I went into Controllers and use "Generic MQTT" then enter in my HA MQTT host info
2nd I went into DEVICES and choose "Output - Output Helper" -- Give it a "name", select the "gpio" -- select "Send to Controller" and saved.
3rd In HARDWARE go to "Pinout&Ports" The gpio you use in the 2nd step in the dropdown menu make that gpio an "outout" if you using a relay.
4th Getting the Topic and Publish command. the Topic and Publish command is the same and it goes like this. %sysname%/Name/Values/set
My example: state_topic: "RPIEasy/zone2/State/set" and command_topic: "RPIEasy/zone2/State/set"
Also you can use MQTT explorer to test publish send and receive before using the code in your Yaml file
switch:
- platform: mqtt
name: "testing rpieasy"
state_topic: "RPIEasy/zone2/State/set"
command_topic: "RPIEasy/zone2/State/set"
payload_on: "1"
payload_off: "0"
optimistic: true
retain: true
qos: 0
NOTE: This instructions is for HA users.
If you don't know what HA is, this instructions is not for you.
I got mines to work so I thought I share with fellow HA users.
See you in the FB forum.
any question its "Bobby Walters" in "DR Zzzzzz"" or the Hookups"
Re: Publish MQTT mwessages to toggle relay on/off
Yes, I prefer to utilize my home automation system to operate a relay on my Raspberry Pi using MQTT, which has been installed... I'm using a Generic MQTT controller with a set to output. Here's an example where the code below works great when I use an esp8266, but not when I use it super mario bros
Who is online
Users browsing this forum: No registered users and 1 guest