Jump to content

Using MQTT Plugin for Non-Sonoff


EVictory

Recommended Posts

Posted

I had posted last week but later figured out how to get my old PG1 NodeLink node server working, so I cancelled my request for help.  NodeLink provides 1-wire data and GenMon data to EISY.  I am posting again because I would like to learn more about your MQTT plugin for applications other than sonoff devices.  Since my earlier post, I have found out how to access files on the EISY using SFTP.  I am now able to use 'devfile' to control the MQTT plugin.

I would like to use the MQTT plugin to replace the old NodeLink as the latter creates a lot of traffic on EISY.  I also have future RPi projects in mind where I can have an RPi post data to a MQTT broker.  I need a MQTT plugin that can receive the MQTT data and make it available to EISY.  

I have an RPi running the OWFS (one-wire file system) for a series of 1-wire devices (humidity & temperature sensors and a counter).  This RPi also runs the NodeLink (PG1 era) node server mentioned above.  On this RPi, I added a python script to read the 1-wire values from the OWFS system and post them to my MQTT Broker as 'strings'.  Below is a screen shot from MQTT Explorer showing my 1-wire sensors.  My script only posts the string values representing the numeric data for each sensor.  

owfs-mqtt.jpg.ad5a47fd0558eb6dde87b9e0ee624154.jpg

DEVFILE Example:  For testing, I created a .yaml file containing the lines below for just one temperature sensor.

devices:
- id: "Outside_18B20"
  sensor_id: "outside-18b20"
  type: "Temp"
  status_topic: "owfs/temp/outside_18b20"
  cmd_topic: "owfs/temp/POWER"

PG3:  PG3 shows two nodes.  The first is the MQTT and the second is the Outside_18B20.

PG3pic.thumb.jpg.fe675aa580ffa81fa03088a07e8b989a.jpg

The EISY shows the Outside_18B20 device but it has a value of 0.

EISYNode.thumb.jpg.cda6d628c05279d6a3500d462b66508f.jpg

Here are my questions:

1. Is my example yaml correct?  If not, what do I have wrong?

2. I think the type of 'Temp' is probably incorrect as it appears to apply to a particular sonoff 18B20 temperature sensor and not my simple string in my MQTT broker.  Does your MQTT plugin have a way to display my simple string data shown in MQTT Explorer above?

3. Another way to do this is for me to change my python script to publish additional data so as to mimic what the 'Temp' type is expecting.  Is there an example of the MQTT data needed by the Temp type?

4. What are the requirements for the Analog and Raw types?

5. This is not a question but a comment.  I continue to receive the following two notices in PG3.  My MQTT broker runs on a RPi and does not use a username and password.  So, those fields are blank in your MQTT plugin configuration page.

MQTTNotices.thumb.jpg.58d5860827172885f9405c726aaccd70.jpg 

Sincerely,
Emile Victory

Posted
5 minutes ago, EVictory said:

I had posted last week but later figured out how to get my old PG1 NodeLink node server working, so I cancelled my request for help.  NodeLink provides 1-wire data and GenMon data to EISY.  I am posting again because I would like to learn more about your MQTT plugin for applications other than sonoff devices.  Since my earlier post, I have found out how to access files on the EISY using SFTP.  I am now able to use 'devfile' to control the MQTT plugin.

I would like to use the MQTT plugin to replace the old NodeLink as the latter creates a lot of traffic on EISY.  I also have future RPi projects in mind where I can have an RPi post data to a MQTT broker.  I need a MQTT plugin that can receive the MQTT data and make it available to EISY.  

I have an RPi running the OWFS (one-wire file system) for a series of 1-wire devices (humidity & temperature sensors and a counter).  This RPi also runs the NodeLink (PG1 era) node server mentioned above.  On this RPi, I added a python script to read the 1-wire values from the OWFS system and post them to my MQTT Broker as 'strings'.  Below is a screen shot from MQTT Explorer showing my 1-wire sensors.  My script only posts the string values representing the numeric data for each sensor.  

owfs-mqtt.jpg.ad5a47fd0558eb6dde87b9e0ee624154.jpg

DEVFILE Example:  For testing, I created a .yaml file containing the lines below for just one temperature sensor.

devices:
- id: "Outside_18B20"
  sensor_id: "outside-18b20"
  type: "Temp"
  status_topic: "owfs/temp/outside_18b20"
  cmd_topic: "owfs/temp/POWER"

PG3:  PG3 shows two nodes.  The first is the MQTT and the second is the Outside_18B20.

PG3pic.thumb.jpg.fe675aa580ffa81fa03088a07e8b989a.jpg

The EISY shows the Outside_18B20 device but it has a value of 0.

EISYNode.thumb.jpg.cda6d628c05279d6a3500d462b66508f.jpg

Here are my questions:

1. Is my example yaml correct?  If not, what do I have wrong?

2. I think the type of 'Temp' is probably incorrect as it appears to apply to a particular sonoff 18B20 temperature sensor and not my simple string in my MQTT broker.  Does your MQTT plugin have a way to display my simple string data shown in MQTT Explorer above?

3. Another way to do this is for me to change my python script to publish additional data so as to mimic what the 'Temp' type is expecting.  Is there an example of the MQTT data needed by the Temp type?

4. What are the requirements for the Analog and Raw types?

5. This is not a question but a comment.  I continue to receive the following two notices in PG3.  My MQTT broker runs on a RPi and does not use a username and password.  So, those fields are blank in your MQTT plugin configuration page.

MQTTNotices.thumb.jpg.58d5860827172885f9405c726aaccd70.jpg 

Sincerely,
Emile Victory

Hello @EVictory,

I'm away from my computer for a few days, so won't be able to respond in detail.

From memory, please have a look at how you configure your .yaml. I seem to recall that for sensors it's not 'status_topic' but something like 'sensor_topic'. Like I said, from memory.

You also might want to look at configuring it like an 'analog' device instead of 'Temp' which is very Tasmota/Sonoff..., also try 'temphumid' (look for correct spelling). 

I'll try to get back to you next week.

Sorry again for the delay.

Cheers.

Posted
35 minutes ago, EVictory said:

Here are my questions:

1. Is my example yaml correct?  If not, what do I have wrong?

2. I think the type of 'Temp' is probably incorrect as it appears to apply to a particular sonoff 18B20 temperature sensor and not my simple string in my MQTT broker.  Does your MQTT plugin have a way to display my simple string data shown in MQTT Explorer above?

3. Another way to do this is for me to change my python script to publish additional data so as to mimic what the 'Temp' type is expecting.  Is there an example of the MQTT data needed by the Temp type?

4. What are the requirements for the Analog and Raw types?

5. This is not a question but a comment.  I continue to receive the following two notices in PG3.  My MQTT broker runs on a RPi and does not use a username and password.  So, those fields are blank in your MQTT plugin configuration page.

MQTTNotices.thumb.jpg.58d5860827172885f9405c726aaccd70.jpg 

Sincerely,
Emile Victory

Hi Emile,  since @TriLife is travelling I will jump in,

You are close, you data is just not where the node is looking for it.

Attaching a link to the relevant node and a screenshot of the part of the program which is relevant (I wrote this device a long time ago to get the temp for a fish tank and the lake)

https://github.com/sejgit/udi-mqtt-pg3x/blob/main/nodes/MQds.py

image.thumb.png.44d04d6a764019d7d9ab924f42453363.png

If you look at the topics its getting the data, its under the sensor id topic and under that you need the Temperature variable.  So basically just add another layer.  I know this seems odd for this device but many of the other devices have Humidity, heartbeat, etc.

Temp is fine as the device choice.  Many of the devices added were not Sonoff as that was my original use case when I added them to the original plugin, @TriLife has brought the focus back to Sonoff as that is his use case.

If you want to learn more about the different devices like raw and Analog, take a look in the python scripts of the devices in the plugin from the github link above.  You mention you are programming in python so shouldn't be much of a stretch to figure out what they are doing.

Hope this helps

 

  • Thanks 1
Posted

SJenkins,

Thanks for your help.  Are you suggesting that I restructure the way I publish the 1-wire data to the MQTT broker so that it is similar to below?

▼ owfs
    timestamp = 2025-07-23 05:24:22 AM
    ▼ outside_ds18b20
         temperature = 78.8125
         humidity = 80.7931
    ▼ garage_ds18b20
         temperature = 86.4525
         humidity = 60.4421
     ▼ bporch_ds18b20
         temperature = 77.9  

In the above, I listed other sensor data such as humidity.  The 1-wire board I use for most locations includes a DS18B20 (or DS18S20) temperature sensor and for humidity it uses a HIH4021-004 humidity sensor and a DS24382 1-wire device to send humidity over 1-wire.  The author of NodeLink (io_guy) found the DS24382 also had a built-in temperature sensor.  Later versions of his OWLink and NodeLink captured this second temperature as well.  This is why my MQTT has two temperature devices listed for the some locations (Example: garage_18s20 and garage_combo).

Is the following the correct way to setup the yaml to read the above?

devices:
- id: "Outside_ds18b20"
   sensor_id: "outside_ds18b20"
   type: "Temp"
   status_topic: "owfs/outside_ds18b20/temperature"
   cmd_topic: "owfs/outside_ds18b20/POWER"
- id: "Outside_ds18b20"
   sensor_id: "outside_ds18b20"
   type: "TempHumid"
   status_topic: "owfs/outside_ds18b20/humidity"
   cmd_topic: "owfs/outside_ds18b20/POWER"

TriLife mentioned that I may need to use 'sensor_topic' instead of 'status_topic'.  I have not seen sensor_topic mentioned on the PG3 configuration page or the github repository.  Is there a place that documents each 'type' and their corresponding requirements?  I would think the different types would each have different requirements.

Sincerely,
Emile Victory

 

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...