Hello Wysiwyg, hello Bill,
Thank you for the hints. I used the framework for my ESP8266 from Wysiwyg. 
That is well suited. For the test run, I deactivated all sensors and the 
deep sleep function. I use the AM2320 for temperature and humidity. In the 
loop, I send the data to the broker. Unfortunately wewx has problems with 
the data. I convert float to char in the ESP (see code example) or manually 
text like "39.5" returns the same error message. It takes a lot of patience 
...
As a control, I use MQTT.fx on a Mac. Works perfectly. All data is 
displayed. In the configuration of MQTT.fx I entered the client ID 
(a020a60cc73b) of the ESP. Could this be a cause for the little problem? 
According to Bill, all location data has been deleted (see weewx.conf). 
Nevertheless problems.
Many thanks for the help!!!
Franz

ESP8266
----------------
void loop() {
// not used due to deepsleep
//
char tmp[20];   // String temp
char dtmpst[20];
float temp;
//
//
char tmh[20];   // String temp
char dthust[20];
float humi;

temp = am2320.readTemperature();
dtostrf(temp, 2, 2, dtmpst);   //float in str

humi = am2320.readHumidity();
dtostrf(humi, 2, 2, dthust);




if ((temp > -40) && (temp < 80)) {
 //  outTemp_pub.publish(dtmpst);
 outTemp_pub.publish("39.5");      //TEST manuell
 //  Serial.println(dtmpst);       // Normal
   delay(2000);
}



//if ( humi >= 0 && humi <= 100 ) {
//   outHumidity_pub.publish(dthust);
//   Serial.println(dthust);
//   delay(2000);
//}


  }



mosquitto -log
------------------
pi@raspberrypi ~ $ sudo tail -f /var/log/mosquitto/mosquitto.log
1527169098: mosquitto version 1.4.15 terminating
1527169103: mosquitto version 1.4.15 (build date Sat, 07 Apr 2018 11:13:41 
+0100) starting
1527169103: Config loaded from /etc/mosquitto/mosquitto.conf.
1527169105: Opening ipv4 listen socket on port 1883.
1527169105: Opening ipv6 listen socket on port 1883.
1527169178: New connection from ::1 on port 1883.
1527169178: New client connected from ::1 as mosqsub|1092-raspberryp (c1, 
k60, u'AX700').
1527169191: New connection from 192.168.1.20 on port 1883.
1527169191: New client connected from 192.168.1.20 as 
b825d276-27a1-4692-9fe3-0c3db0f850ca (c1, k300, u'AX700').
1527169216: New connection from 192.168.1.30 on port 1883.
1527169216: New client connected from 192.168.1.30 as weewx_mqttc (c1, k60, 
u'AX700').
1527169216: Socket error on client weewx_mqttc, disconnecting.
1527169471: New connection from 192.168.1.30 on port 1883.

weewx- log
---------------------
pi@raspberrypi ~ $ tail -f /var/log/syslog
May 24 15:40:16 raspberrypi weewx[1196]:     ****      engine = 
engine_class(config_dict)
May 24 15:40:16 raspberrypi weewx[1196]:     ****    File 
"/home/weewx/bin/weewx/engine.py", line 74, in __init__
May 24 15:40:16 raspberrypi weewx[1196]:     ****      
self.preLoadServices(config_dict)
May 24 15:40:16 raspberrypi weewx[1196]:     ****    File 
"/home/weewx/bin/weewx/engine.py", line 115, in preLoadServices
May 24 15:40:16 raspberrypi weewx[1196]:     ****      self.stn_info = 
weewx.station.StationInfo(self.console, **config_dict['Station'])
May 24 15:40:16 raspberrypi weewx[1196]:     ****    File 
"/home/weewx/bin/weewx/station.py", line 35, in __init__
May 24 15:40:16 raspberrypi weewx[1196]:     ****      self.altitude_vt = 
weewx.units.ValueTuple(float(altitude_t[0]), altitude_t[1], 
"group_altitude")
May 24 15:40:16 raspberrypi weewx[1196]:     ****  TypeError: float() 
argument must be a string or a number
May 24 15:40:16 raspberrypi weewx[1196]:     ****  Exiting.
May 24 15:41:35 raspberrypi rsyslogd-2007: action 'action 17' suspended, 
next retry is Thu May 24 15:42:05 2018 [try http://www.rsyslog.com/e/2007 ]
May 24 15:43:26 raspberrypi wpa_supplicant[461]: wlan0: WPA: Group rekeying 
completed with 6c:70:9f:e2:fe:56 [GTK=CCMP]
May 24 15:43:26 raspberrypi rsyslogd-2007: action 'action 17' suspended, 
next retry is Thu May 24 15:43:56 2018 [try http://www.rsyslog.com/e/2007 ]
May 24 15:44:21 raspberrypi rsyslogd-2007: action 'action 17' suspended, 
next retry is Thu May 24 15:44:51 2018 [try http://www.rsyslog.com/e/2007 ]
May 24 15:44:21 raspberrypi systemd[1]: Stopping LSB: weewx weather 
system...
May 24 15:44:21 raspberrypi weewx[1291]: Stopping weewx weather system: 
weewx not running....
May 24 15:44:21 raspberrypi systemd[1]: Stopped LSB: weewx weather system.
May 24 15:44:30 raspberrypi systemd[1]: Starting LSB: weewx weather 
system...
May 24 15:44:31 raspberrypi weewx[1354]: engine: Initializing weewx version 
3.8.0
May 24 15:44:31 raspberrypi weewx[1354]: engine: Using Python 2.7.9 
(default, Sep 17 2016, 20:26:04) #012[GCC 4.9.2]
May 24 15:44:31 raspberrypi weewx[1354]: engine: Platform 
Linux-4.1.7-v7+-armv7l-with-debian-8.0
May 24 15:44:31 raspberrypi weewx[1354]: engine: Locale is 'de_DE.UTF-8'
May 24 15:44:31 raspberrypi weewx[1354]: engine: pid file is 
/var/run/weewx.pid
May 24 15:44:31 raspberrypi weewx[1358]: engine: Using configuration file 
/home/weewx/weewx.conf
May 24 15:44:31 raspberrypi weewx[1358]: engine: debug is 1
May 24 15:44:31 raspberrypi weewx[1358]: engine: Initializing engine
May 24 15:44:31 raspberrypi weewx[1358]: engine: Loading station type 
wxMesh (user.wxMesh)
May 24 15:44:31 raspberrypi systemd[1]: Started LSB: weewx weather system.
May 24 15:44:31 raspberrypi weewx[1344]: Starting weewx weather system: 
weewx.
May 24 15:44:31 raspberrypi weewx[1358]: wxMesh: host is 192.168.1.30
May 24 15:44:31 raspberrypi weewx[1358]: wxMesh: topic is weewx//#
May 24 15:44:31 raspberrypi weewx[1358]: wxMesh: polling interval is 3.0
May 24 15:44:31 raspberrypi weewx[1358]: wxMesh: label map is {'HUMT': 
'outTemp'}
May 24 15:44:31 raspberrypi weewx[1358]: engine: Caught unrecoverable 
exception in engine:
May 24 15:44:31 raspberrypi weewx[1358]:     ****  float() argument must be 
a string or a number
May 24 15:44:31 raspberrypi weewx[1358]:     ****  Traceback (most recent 
call last):
May 24 15:44:31 raspberrypi weewx[1358]:     ****    File 
"/home/weewx/bin/weewx/engine.py", line 865, in main
May 24 15:44:31 raspberrypi weewx[1358]:     ****      engine = 
engine_class(config_dict)
May 24 15:44:31 raspberrypi weewx[1358]:     ****    File 
"/home/weewx/bin/weewx/engine.py", line 74, in __init__
May 24 15:44:31 raspberrypi weewx[1358]:     ****      
self.preLoadServices(config_dict)
May 24 15:44:31 raspberrypi weewx[1358]:     ****    File 
"/home/weewx/bin/weewx/engine.py", line 115, in preLoadServices
May 24 15:44:31 raspberrypi weewx[1358]:     ****      self.stn_info = 
weewx.station.StationInfo(self.console, **config_dict['Station'])
May 24 15:44:31 raspberrypi weewx[1358]:     ****    File 
"/home/weewx/bin/weewx/station.py", line 35, in __init__
May 24 15:44:31 raspberrypi weewx[1358]:     ****      self.altitude_vt = 
weewx.units.ValueTuple(float(altitude_t[0]), altitude_t[1], 
"group_altitude")
May 24 15:44:31 raspberrypi weewx[1358]:     ****  TypeError: float() 
argument must be a string or a number
May 24 15:44:31 raspberrypi weewx[1358]:     ****  Exiting.
May 24 15:44:42 raspberrypi wpa_supplicant[461]: wlan0: WPA: Group rekeying 
completed with 6c:70:9f:e2:fe:56 [GTK=CCMP]
May 24 15:47:27 raspberrypi rsyslogd-2007: action 'action 17' suspended, 
next retry is Thu May 24 15:47:57 2018 [try http://www.rsyslog.com/e/2007 ]
May 24 15:47:56 raspberrypi wpa_supplicant[461]: CTRL_IFACE: Detach monitor 
/tmp/libdhcpcd-wpa-933.1\x00 that cannot receive messages

mosquitto
------------------------
pi@raspberrypi ~ $ mosquitto_sub -d -u AX700 -P 84N7601 -t "weewx/#" -v
Client mosqsub|1398-raspberryp sending CONNECT
Client mosqsub|1398-raspberryp received CONNACK
Client mosqsub|1398-raspberryp sending SUBSCRIBE (Mid: 1, Topic: weewx/#, 
QoS: 0)
Client mosqsub|1398-raspberryp received SUBACK
Subscribed (mid: 1): 0
Client mosqsub|1398-raspberryp received PUBLISH (d0, q0, r0, m0, 
'weewx/outTemp', ... (4 bytes))
weewx/outTemp 39.5
Client mosqsub|1398-raspberryp received PUBLISH (d0, q0, r0, m0, 
'weewx/outTemp', ... (4 bytes))
weewx/outTemp 39.5

weewx.conf
-------------------
# WEEWX CONFIGURATION FILE
#
# Copyright (c) 2009-2015 Tom Keffer <[email protected]>
# See the file LICENSE.txt for your rights.

##############################################################################

# This section is for general configuration information.

# Set to 1 for extra debug info, otherwise comment it out or set to zero
debug = 1

# Root directory of the weewx data file hierarchy for this station
WEEWX_ROOT = /home/weewx

# How long to wait before timing out a socket (FTP, HTTP) connection
socket_timeout = 20

# Do not modify this. It is used when installing and updating weewx.
version = 3.8.0

##############################################################################

#   This section is for information about the station.
[Station]
   station_type = wxMesh

[wxMesh]
    host = 192.168.1.30
    username = AX700
    password = 84N7601
    topic = weewx/
    driver = user.wxMesh
    poll_interval = 3
    loop_on_init = true

    [[label_map]]
       HUMT = outTemp
      # RHUM = outHumidity

    #Description of the station location
    #location = Wetter Rheinbach Voreifel
    #
    #Latitude and longitude in decimal degrees
    #latitude = 50.3552
    #longitude = 6.5346
    
    # Altitude of the station, with unit it is in. This is downloaded from
    # from the station if the hardware supports it.
    # altitude = 270, meter    # Choose 'foot' or 'meter' for unit
    
    # Set to type of station hardware. There must be a corresponding stanza
    # in this file with a 'driver' parameter indicating the driver to be 
used.
    # station_type = Simulator
    
    # If you have a website, you may specify an URL
    #station_url = http://www.example.com
    
    # The start of the rain year (1=January; 10=October, etc.). This is
    # downloaded from the station if the hardware supports it.
    # rain_year_start = 1
    
    # Start of week (0=Monday, 6=Sunday)
    # week_start = 6

##############################################################################

[Simulator]
    # This section is for the weewx weather station simulator
    
    # The time (in seconds) between LOOP packets.
    loop_interval = 2.5
    
    # The simulator mode can be either 'simulator' or 'generator'.
    # Real-time simulator. Sleep between each LOOP packet.
    mode = simulator
    # Generator.  Emit LOOP packets as fast as possible (useful for 
testing).
    #mode = generator
    
    # The start time. Format is YYYY-mm-ddTHH:MM. If not specified, the 
default 
    # is to use the present time.
    #start = 2011-01-01T00:00
    
    # The driver to use:
    # driver = weewx.drivers.simulator

##############################################################################

#   This section is for uploading data to Internet sites

[StdRESTful]
    
  [[MQTT]]
       topic = weewx
       append_units_label = True
       retain = False
       aggregation = individual
       unit_system = METRIC
       binding = loop
  
  [[StationRegistry]]
        # To register this weather station with weewx, set this to true
        register_this_station = false
    

Am Mittwoch, 23. Mai 2018 14:22:31 UTC+2 schrieb Wysiwyg:
>
> Hi There!
>
> Sorry for confusion between wxMQTT.py & wxMesh.py.
>
>  wxMesh.py => Original naming from Bill's driver.
> When I discussed with Bill and modified his driver for my own use, Bill 
> mention the name should be updated.
> I named it wxMQTT.py, but I didnt finalized the job correctly  :-(
> I shall change the name in weewx.conf and also I think there are some 
> mention in the python code.
> Anyway, if all is name wxMesh. it shall work.
>
>
>
> regarding "float".
> My arduino/ESP8266 code also publish some float. you can see here: 
> https://github.com/bonjour81/station_meteo/blob/master/sensors/MQTT_TH_UV_rain/src/main.cpp
> .
> The values are truncated at 2 digit after dot.
> I also added a bit of checks in my arduino code to confirm validity of 
> values before publishing
>
> You can use an other subscriber to check the content of your messages in 
> parallel to weewx (like mosquitto_sub), but for more comfortable use, you 
> can try mqtt dash on android. ( 
> https://play.google.com/store/apps/details?id=net.routix.mqttdash&hl=fr ).
> You just have to setup your mqtt server once, and you can define some 
> tiles for each topic.
> I use "text" tiles for my weewx topics (ex: weewx/outTemp). 
> It also display since how much time last publish was received.
> it's pretty nice for debugging.
>
>
> in parallel to 
> tail -f /var/log/syslog
> you may also try:
> tail -f /var/log/mosquitto/mosquitto.conf
>
>
>
>
>
>
> Le mercredi 23 mai 2018 13:32:29 UTC+2, Bill Morrow a écrit :
>>
>> Hi Franz, progress! It looks like you have fixed the file corruption 
>> issue.
>>
>> Some comments below...
>>
>> On Wednesday, 23 May 2018 08:17:13 UTC-3, Franz wrote:
>>>
>>> Hello Vince,
>>> with wget https: // ... copied the file wxMQTT.py. Checksum is ok.
>>> Are the wxMesh.py and wxMQTT.py files the same?
>>>
>>
>> I think you have configuration in weewx.conf such that your file should 
>> be named wxMesh.py. Namely these configuration parameters::
>>
>>     station_type = wxMesh
>> ...
>> [wxMesh]
>>     driver = user.wxMesh
>>
>>
>> The error messages have changed (see log file). I suspect it's because of 
>>> the MQTT data. MQTT sends float values with me. I have to change the 
>>> Arduino program. Many thanks for the help. I'm probably a little further.
>>>
>>
>> Consider editing your weewx.conf file and changing the debug setting from
>>
>> # Set to 1 for extra debug info, otherwise comment it out or set to zero.
>> debug = 0
>>
>> to
>>
>> # Set to 1 for extra debug info, otherwise comment it out or set to zero.
>> debug =1
>>
>> and then restart weewx. Watch the log file with
>>
>> tail -f /var/log/syslog
>>
>> This should give more information on how the driver is attempting to turn 
>> some part of the MQTT payload to a floating point number. 
>>
>>
>> ---
>>> pi@raspberrypi /home/weewx/bin/user $ ls
>>> extensions.py   __init__.py   installer  wxMesh.pyc
>>> extensions.pyc  __init__.pyc  wxMesh.py
>>> pi@raspberrypi /home/weewx/bin/user $ sudo sha1sum wxMesh.py
>>> 826d007e040b540cb5c6092842667c9966852db9  wxMesh.py
>>> pi@raspberrypi /home/weewx/bin/user $ 
>>> ----
>>> pi@raspberrypi ~ $ sudo /etc/init.d/weewx start
>>> [ ok ] Starting weewx (via systemctl): weewx.service.
>>> pi@raspberrypi ~ $ sudo /etc/init.d/weewx status -l
>>> ● weewx.service - LSB: weewx weather system
>>>    Loaded: loaded (/etc/init.d/weewx)
>>>    Active: active (exited) since Mi 2018-05-23 11:52:38 CEST; 6s ago
>>>   Process: 1396 ExecStop=/etc/init.d/weewx stop (code=exited, 
>>> status=0/SUCCESS)
>>>   Process: 1591 ExecStart=/etc/init.d/weewx start (code=exited, 
>>> status=0/SUCCESS)
>>>
>>> Mai 23 11:52:38 raspberrypi weewx[1605]: ****    File 
>>> "/home/weewx/bin/weewx/engine.py", line 865, in main
>>> Mai 23 11:52:38 raspberrypi weewx[1605]: ****      engine = 
>>> engine_class(config_dict)
>>> Mai 23 11:52:38 raspberrypi weewx[1605]: ****    File 
>>> "/home/weewx/bin/weewx/engine.py", line 74, in __init__
>>> Mai 23 11:52:38 raspberrypi weewx[1605]: ****      
>>> self.preLoadServices(config_dict)
>>> Mai 23 11:52:38 raspberrypi weewx[1605]: ****    File 
>>> "/home/weewx/bin/weewx/engine.py", line 115, in ...ices
>>> Mai 23 11:52:38 raspberrypi weewx[1605]: ****      self.stn_info = 
>>> weewx.station.StationInfo(self.cons...n'])
>>> Mai 23 11:52:38 raspberrypi weewx[1605]: ****    File 
>>> "/home/weewx/bin/weewx/station.py", line 35, in ...it__
>>> Mai 23 11:52:38 raspberrypi weewx[1605]: ****      self.altitude_vt = 
>>> weewx.units.ValueTuple(float(alt...de")
>>> Mai 23 11:52:38 raspberrypi weewx[1605]: ****  TypeError: float() 
>>> argument must be a string or a number
>>> Mai 23 11:52:38 raspberrypi weewx[1605]: ****  Exiting.
>>> Hint: Some lines were ellipsized, use -l to show in full.
>>> pi@raspberrypi ~ $ 
>>> -----------
>>>
>>>
>>> Am Dienstag, 22. Mai 2018 21:42:24 UTC+2 schrieb Vince Skahan:
>>>>
>>>> On Tuesday, May 22, 2018 at 10:45:58 AM UTC-7, Bill Morrow wrote:
>>>>>
>>>>>
>>>>> Try going in to your bin/user/ directory and run these commands at 
>>>>> your shell prompt
>>>>>
>>>>> wget https://
>>>>> raw.githubusercontent.com/bonjour81/ESP8266-MQTT-WEEWX/master/weewx/wxMQTT.py
>>>>> mv wxMQTT.py wxMesh.py
>>>>>
>>>>
>>>>
>>>> You might also check the checksums on the file to verify it's the same 
>>>> as the master copy.
>>>> Mine looks like:
>>>>
>>>> pi@pi3:/tmp $ sha1sum wxMQTT.py
>>>> 826d007e040b540cb5c6092842667c9966852db9  wxMQTT.py
>>>>
>>>>
>>>> pi@pi3:/tmp $ sha256sum wxMQTT.py
>>>> e99e86a15f3315eb1dd0db38f4ce759c4af2cb4965f71e031000a380c087d32b 
>>>>  wxMQTT.py
>>>>
>>>>
>>>>
>>>>

Reply via email to