Page 1 of 1

strings.ini and posting data using ECOWITTEXTRA

Posted: Fri 21 Oct 2022 3:04 pm
by watsonm
Hi,

Yet again I am confusing myself over the strings.ini file and posting data from an third party airquality sensor to cumulusmx.

My undestanding is that strings.ini just allows you to rename the appropriate entries on the external sensors page of CMX.
I do not use the (dead ) console so have python code reading sensors and shipping the data to CMX via the ECOWITT protocol

The appropriate section of my strings.ini is:

Code: Select all

[SoilMoistureCaptions]
Sensor1=SoilHum1
Sensor2=Sensor 2
Sensor3=Sensor 3
Sensor4=Sensor 4
Sensor5=Sensor 5
Sensor6=Sensor 6
Sensor7=Sensor 7
Sensor8=Sensor 8
.............
............
[AirQualityCaptions]
Sensor1=voc
Sensor2=Sensor 2
Sensor3=Sensor 3
Sensor4=Sensor 4
SensorAvg1=voc 24hr Avg
SensorAvg2=Sensor Avg 2
SensorAvg3=Sensor Avg 3
SensorAvg4=Sensor Avg 4

I successfully send my soil humidity from my WH51 by issuing the following (in a try/catch expression)

Code: Select all

  soil_data={  'SoilMoisture1'      : int(soil_moisture),     }
  
         x = requests.post( CMX_url+"extra" , soil_data, timeout = 5)
                  
  where:        CMX_url  = "http://localhost:8998/station/ecowitt"
       
 
In the air quality section I want to send the24hr average but cannot find the file which describes the command word (like SoilMoisture1) .
I have tried various options all to now avail.

Any pointers apprecaited.....

Re: strings.ini and posting data using ECOWITTEXTRA

Posted: Fri 21 Oct 2022 3:35 pm
by HansR
Mike,

Tbh I do not fully understand what you are doing, but these values can be fetched using the API as follows (this is the URL as I would give in the browser, you should adjust it probably for your purpose) :

Code: Select all

http://localhost:8998/api/tags/process.json?AirQuality1&AirQualityAvg1
Otherwise I really havo no clue what your code would be doing.
For the soilmoisture:

Code: Select all

http://localhost:8998/api/tags/process.json?SoilMoisture1
The Webtags are described in the wiki on the Full list of Webtags
The API is described on the Local API page.

This all has nothing to do with strings.ini. Are you confused with Cutils?

Re: strings.ini and posting data using ECOWITTEXTRA

Posted: Sat 22 Oct 2022 10:29 am
by watsonm
Hans,
I wanted to send/write those parameters to CMX from my python script using the ecowitt http protocol. When writing the values , if I use AirQuality1 and AirQualityAvg1 I do not get the data into CMX. However writing to SoilMoisture1 does work!

Any way after many hours I have resolved the issue and I am using the following to write SoilMosture, AirQuality and AirQuality 24hr Average :

Code: Select all

    soil_data =  {   'SoilMoisture1'         : int(soil_moisture),       \
          'pm25_ch1'              : int(voc),       \
          'pm25_avg_24h_ch1'      : int(voctwenty),   }
          
        x = requests.post( CMX_url+"extra" , soil_data, timeout = 5)
I was puzzled as I could not find anywhere what these parameters should be. I had sort of presumed theye were in Extrafileheader.txt or the left hand column of strings.ini . Also search the source but I am non the wiser!! :roll:
Eventually found the one I needed on the WXForum by chance but if I need others in the future .... :(

Sorry to have confused you (and myself!!)

Re: strings.ini and posting data using ECOWITTEXTRA

Posted: Sat 22 Oct 2022 10:50 am
by HansR
Writing values to CMX :!:
Did not know that was possible :o :clap:

Re: strings.ini and posting data using ECOWITTEXTRA

Posted: Sat 22 Oct 2022 12:23 pm
by watsonm
Hans,

No hacking, a legitimate call to /station/ecowittextra as noted in
Settings-> extra sensor settings -> use a http station for extra sensors->Ecowitt.

Code: Select all

In WS View configure the Custom Server to use:-
Protocol: Ecowitt
Server: CMX IP Address
Path: /station/ecowittextra
Port: 8998
Interval: 20 

Re: strings.ini and posting data using ECOWITTEXTRA

Posted: Sat 22 Oct 2022 1:36 pm
by philpugh
It can be done but you need to define an Ecowitt station in CMX then send the correctly formatted string to this 'station'. I have done this to transfer data from a SKY/AIR Weatherflow system to CMX - but it isn't trivial.

This is the http string that I use to transfer data from a meteobridge station to CMX.
http://nnn.nnn.nnn.nnn:pppp/station/ecowitt?PASSKEY=someasciistring&stationtype=weatherflow_gwy&runtime=9696&dateutc=[YYYY]-[MM]-[DD]+[Uhh]:[Umm]:[Uss]&tempinf=[thb0temp-act=F.1]&humidityin=[thb0hum-act]&baromrelin=[thb0press-act=inHg.3]&baromabsin=[thb0seapress-act=inHg.3]&tempf=[th0temp-act=F.1]&humidity=[th0hum-act]&winddir=[wind0dir-act]&windspeedmph=[wind0wind-act=mph.2]&windgustmph=[wind0wind-max10.1:0=mph.2]&maxdailygust=[wind0wind-dmax=mph.2]&solarradiation=[sol0rad-act:--]&uv=[uv0index-act:--]&rainratein=[rain0rate-act=in.2]&dailyrainin=[rain0total-daysum=in.2]&monthlyrainin=[rain0total-monthsum=in.2]&yearlyrainin=[rain0total-yearsum=in.2]&model=MBridge
You would need to look at the Ecowitt API to determine the string for air quality.

Good luck!

Re: strings.ini and posting data using ECOWITTEXTRA

Posted: Sat 22 Oct 2022 2:25 pm
by SamiS
philpugh wrote: Sat 22 Oct 2022 1:36 pm It can be done but you need to define an Ecowitt station in CMX then send the correctly formatted string to this 'station'. I have done this to transfer data from a SKY/AIR Weatherflow system to CMX - but it isn't trivial.
As watsonm states in the previous post, you can enable ecowitt http api for extra sensors in CMX via Settings -> Extra Sensors -> Use a HTTP Station for extra sensors. This does not restrict ones ability to use something else as the main station. But yes, the correct call should be formatted as Ecowitt api defines. I’m not sure if Ecowitt has published its api regarding how the station communicates with the cloud, or only how to read data from their cloud. But there you can find something:

https://doc.ecowitt.net/web/#/

Best regards,

Sami

Re: strings.ini and posting data using ECOWITTEXTRA

Posted: Sat 22 Oct 2022 3:19 pm
by watsonm
Thanks Phil and Sami.

Happy to say all working OK now but yes a full description of the API would have been helpful....

Phil) The code you have quoted is similar to my basic weather station data which is posted to "http://localhost:8998/station/ecowitt"

Code: Select all

             weather_data={'dateutc' : EW_time , 'solarradiation' :  LuxW, 'uv' : UV , \
             'tempf' : tempfahr  ,'tempinf' : tempfahrinf  ,'humidity' : humidity_send, 'baromrelin' : pressureinc , \
             'windspeedmph' : wind_avg_mph , 'windgustmph' : wind_gust_mph  ,'winddir' : wind_dir_EW, 'humidityin'  :  in_humidity, \
             'yearlyrainin'  : rain_inch ,'rainratein'  :  rainratein , 'yearlyrainmm'  :  rain, 'totalrainin'  : rain_inch}

What I was looking for was the extra sensor params to send to "http://localhost:8998/station/ecowittextra"

Code: Select all

 extra_sensor_data =  { 'SoilMoisture1' : int(soil_moisture), 'pm25_ch1' : int(voc), 'pm25_avg_24h_ch1' : int(voctwenty),   }

Re: strings.ini and posting data using ECOWITTEXTRA

Posted: Tue 06 Dec 2022 1:48 pm
by watsonm
To update the list :

Code: Select all

        Soil Moisture using WH51
        {'SoilMoisture1'    :  int(soil_ch1.value) }
        {'SoilMoisture2'    :  int(soil_ch2.value) }

        Voc - Volatile Organic Compounds  using   SGP40
        {'pm25_avg_24h_ch1' :  int(voctwenty) }   
        {'pm25_ch1'         :  int(voc) } 

        Air Quality using PMS5003
        {'pm25_co2'         :  pmg2p5 }
        {'pm25_24h_co2'     :  pmg25twenty }
        {'pm10_co2'         :  pmg10 }
        {'pm10_24h_co2'     :  pmg10twenty }