Ok, so thinking about this. I'm an outside person, and I cannot reach your 
192.168.0.4 from the outside world. This is a problem because I need to 
reach that in order to get MQTT data on your website. 

You need to port forward 9001 to 192.168.0.4 so I can reach it from the 
outside 

On Thursday, December 27, 2018 at 8:11:12 PM UTC-5, Scott Grayban wrote:
>
> 192.168.0.4 is a local IP that has the weewx installed and data pulled 
> from the station but the website itself is served to the public with a 
> outside IP 63.230.134.161 via a reverse proxy
>
> see http://www.nettletondistrict.com/Nettleton/ it works fine doing a 
> reverse proxy for everything but the MQTT so far.
>
> On Thursday, December 27, 2018 at 5:03:34 PM UTC-8, Pat wrote:
>>
>> I'm not sure what is causing that. Might be best to start from the basics 
>> again. Check out my article to compare your settings, read the descriptions 
>> again, and also check out the skin options to make sure you're not missing 
>> something. 
>>
>> Is your broker or weewx available to the public?
>>
>>
>> On Thursday, December 27, 2018 at 7:56:44 PM UTC-5, Scott Grayban wrote:
>>>
>>> Shit.....mosquitto.log is showing Socket error on client <unknown>, 
>>> disconnecting.
>>>
>>> 1545958518: New connection from 192.168.0.4 on port 1883.
>>> 1545958518: New client connected from 192.168.0.4 as 
>>> d413f626-b78b-4bca-8e99-43861d26dc6a (c1, k60, u'weewx').
>>> 1545958518: Client d413f626-b78b-4bca-8e99-43861d26dc6a disconnected.
>>> 1545958520: New connection from 63.230.134.161 on port 1883.
>>> 1545958520: *Socket error on client <unknown>, disconnecting.*
>>> 1545958533: New connection from 192.168.0.4 on port 1883.
>>>
>>>
>>> On Thursday, December 27, 2018 at 4:52:22 PM UTC-8, Pat wrote:
>>>>
>>>> Looks good
>>>>
>>>> On Thursday, December 27, 2018 at 7:50:49 PM UTC-5, Scott Grayban wrote:
>>>>>
>>>>> Is my /etc/mosquitto/acl correct ? Or do I need to change those values 
>>>>> ?
>>>>>
>>>>> # Allow anonymous access to the sys
>>>>> topic read $SYS/#
>>>>> # Allow anonymous to read weather
>>>>> topic read weather/#
>>>>> # weewx readwrite to the loop
>>>>> user weewx
>>>>> topic weather/#
>>>>>
>>>>>
>>>>> On Thursday, December 27, 2018 at 4:43:02 PM UTC-8, Pat wrote:
>>>>>>
>>>>>> Ok, there's a few more things not quite right. 
>>>>>>
>>>>>> 1. MQTT is very picky about it's config file. Change your 
>>>>>> myconfig.conf so that there is no space between listener 1883 and 
>>>>>> protocol 
>>>>>> mqtt. See my post from last night above a few. 
>>>>>>
>>>>>> listener 1883
>>>>>> protocol mqtt
>>>>>>
>>>>>> Restart your mosquitto - or to be safe, restart your MQTT server. 
>>>>>>
>>>>>> 2. Once it's back up and weewx says it's posting, can you verify from 
>>>>>> your computer that MQTT is wokring? You can use a program like MQTT 
>>>>>> Spy 
>>>>>> <https://github.com/eclipse/paho.mqtt-spy/releases/download/1.0.0/mqtt-spy-1.0.0.jar>
>>>>>>  on 
>>>>>> Windows if you have Java installed. 
>>>>>>
>>>>>> 3. In MQTT, the # is only used for debugging. You really don't want 
>>>>>> to publish or subscribe to this special topic. 
>>>>>>
>>>>>> Under [[MQTT]] change
>>>>>>
>>>>>> topic = weather/weewx
>>>>>>
>>>>>> Under Belchertown [[[Extras]]] change
>>>>>>
>>>>>> mqtt_topic = weather/weewx/loop
>>>>>>
>>>>>> Restart weewx
>>>>>>
>>>>>>
>>>>>> On Thursday, December 27, 2018 at 7:36:18 PM UTC-5, Scott Grayban 
>>>>>> wrote:
>>>>>>
>>>>>>> Ok getting close.....
>>>>>>>
>>>>>>> in EXTRAS I have
>>>>>>>
>>>>>>>             mqtt_enabled = 1
>>>>>>>             mqtt_host = 192.168.0.4
>>>>>>>             mqtt_topic = weather/#
>>>>>>>             mqtt_port = 1883
>>>>>>>             mqtt_ssl = 0
>>>>>>>             disconnect_live_website_visitor = 1800000
>>>>>>>
>>>>>>>
>>>>>>> which now is giving *Failed connecting to the weather station. 
>>>>>>> Please try again later!*
>>>>>>>
>>>>>>> I am pretty sure I have MQTT right
>>>>>>>
>>>>>>> On Thursday, December 27, 2018 at 4:24:08 PM UTC-8, Pat wrote:
>>>>>>>>
>>>>>>>> Under [[[Extras]]] you don't have any of the skin specific MQTT 
>>>>>>>> settings 
>>>>>>>> <https://github.com/poblabs/weewx-belchertown#mqtt-for-real-time-streaming-options>.
>>>>>>>>  
>>>>>>>> At a minimum you need mqtt_enabled, which you have, but also mqtt_host 
>>>>>>>> and mqtt_topic.
>>>>>>>>
>>>>>>>> As mentioned previously, weewx is posting to your MQTT broker using 
>>>>>>>> [[MQTT]], the skin also needs to know where the broker is so it can 
>>>>>>>> get 
>>>>>>>> that data too and that's done in [[Belchertown]] [[[Extras]]]. 
>>>>>>>>
>>>>>>>> On Thursday, December 27, 2018 at 7:21:33 PM UTC-5, Scott Grayban 
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>     [[Belchertown]]
>>>>>>>>>         HTML_ROOT = /home/weewx/public_html/Nettleton
>>>>>>>>>         skin = Nettleton
>>>>>>>>>         [[[Extras]]]
>>>>>>>>>             belchertown_root_url = http://
>>>>>>>>> www.nettletondistrict.com/Nettleton
>>>>>>>>>             logo_image = http://
>>>>>>>>> www.nettletondistrict.com/Nettleton/images/map_of_spokane_wa.jpg
>>>>>>>>>             site_title = Nettleton District Weather Station
>>>>>>>>>             footer_copyright_text = "Nettleton District Weather 
>>>>>>>>> Station, Spokane, Washington"
>>>>>>>>>             radar_html = "<img src='
>>>>>>>>> http://radar.weather.gov/lite/N0R/OTX_loop.gif'>"
>>>>>>>>>             mqtt_enabled = 1
>>>>>>>>>             show_apptemp = 1
>>>>>>>>>             show_windrun = 1
>>>>>>>>>             highcharts_show_apptemp = 1
>>>>>>>>>             forecast_enabled = 1
>>>>>>>>>             darksky_secret_key = XXXXXX
>>>>>>>>>             earthquake_enabled = 1
>>>>>>>>>             facebook_enabled = 1
>>>>>>>>>             twitter_enabled = 1
>>>>>>>>>             graphs_page_header = "Weather Observation Graphs"
>>>>>>>>>             records_page_header = "Weather Observation Records"
>>>>>>>>>             reports_page_header = "Weather Observation Reports"
>>>>>>>>>             about_page_header = "About This Weather Station"
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Thursday, December 27, 2018 at 4:15:22 PM UTC-8, Pat wrote:
>>>>>>>>>>
>>>>>>>>>> Please post your Belchertown skin settings.
>>>>>>>>>>
>>>>>>>>>> On Thursday, December 27, 2018 at 7:00:21 PM UTC-5, Scott Grayban 
>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Ok so my weewx.conf looks like this now....
>>>>>>>>>>>     [[MQTT]]
>>>>>>>>>>>         server_url = mqtt://
>>>>>>>>>>> weewx:passwordXXXXX@192.168.0.4:1883/
>>>>>>>>>>>         topic = weather/#
>>>>>>>>>>>         unit_system = US
>>>>>>>>>>>         binding = archive, loop
>>>>>>>>>>>         aggregation = aggregate
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> My /etc/mosquitto/conf.d/myconfig.conf looks like this
>>>>>>>>>>> persistence false
>>>>>>>>>>> allow_anonymous true
>>>>>>>>>>> password_file /etc/mosquitto/passwd
>>>>>>>>>>> acl_file /etc/mosquitto/acl
>>>>>>>>>>>
>>>>>>>>>>> listener 1883
>>>>>>>>>>> protocol mqtt
>>>>>>>>>>>
>>>>>>>>>>> # websockets
>>>>>>>>>>> listener 9001
>>>>>>>>>>> protocol websockets
>>>>>>>>>>>
>>>>>>>>>>> Still not connecting..... I wonder if thats do to the reverse 
>>>>>>>>>>> proxy with apache ?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Thursday, December 27, 2018 at 5:31:22 AM UTC-8, Pat wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> This is because your MQTT is isolated to localhost only. Local 
>>>>>>>>>>>> host in this case would be your weewx server, which you must have 
>>>>>>>>>>>> installed 
>>>>>>>>>>>> MQTT on as well. Which works for weewx ==> MQTT since they are on 
>>>>>>>>>>>> the same 
>>>>>>>>>>>> system, but nothing else
>>>>>>>>>>>>
>>>>>>>>>>>> First, change your MQTT to listen on 1883 for external 
>>>>>>>>>>>> connections. Since you're not using SSL, you can remove the 8883, 
>>>>>>>>>>>> update 
>>>>>>>>>>>> your myconfig.conf with this. 
>>>>>>>>>>>>
>>>>>>>>>>>> listener 1883
>>>>>>>>>>>> protocol mqtt
>>>>>>>>>>>>
>>>>>>>>>>>> With this change it'll open port 1883 to external connections 
>>>>>>>>>>>> like your laptop. 
>>>>>>>>>>>>
>>>>>>>>>>>> You can leave your weewx.conf [[MQTT]] config alone since they 
>>>>>>>>>>>> are on the same machine, localhost will work here like it already 
>>>>>>>>>>>> is. 
>>>>>>>>>>>>
>>>>>>>>>>>> I don't see your skin options so I think you haven't done that. 
>>>>>>>>>>>> You're posting to MQTT with [[MQTT]], but now you need to retrieve 
>>>>>>>>>>>> - that's 
>>>>>>>>>>>> what the skin does. 
>>>>>>>>>>>>
>>>>>>>>>>>> In weewx.conf you need to specify the Belchertown skin options 
>>>>>>>>>>>> for MQTT such as enabling it, hostname, topic, etc. 
>>>>>>>>>>>> <https://github.com/poblabs/weewx-belchertown#mqtt-for-real-time-streaming-options>
>>>>>>>>>>>>  You 
>>>>>>>>>>>> cannot use localhost here for mqtt_host, you need to specify 
>>>>>>>>>>>> the IP of the server hosting your MQTT. By saying 127.0.0.1 or 
>>>>>>>>>>>> localhost 
>>>>>>>>>>>> that means Chrome is going to try to connect to YOUR PC for MQTT 
>>>>>>>>>>>> data which 
>>>>>>>>>>>> probably doesn't exist. You need to specify the IP of the MQTT 
>>>>>>>>>>>> broker, like 
>>>>>>>>>>>> 192.168.1.100 or whatever. This is where having a static IP or a 
>>>>>>>>>>>> DHCP 
>>>>>>>>>>>> reservation is important so the IP of your internal broker doesn't 
>>>>>>>>>>>> change.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Thursday, December 27, 2018 at 2:38:06 AM UTC-5, Scott 
>>>>>>>>>>>> Grayban wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Pat
>>>>>>>>>>>>>
>>>>>>>>>>>>> I seem to have missed something in setting up MQTT for the 
>>>>>>>>>>>>> skin... I followed 
>>>>>>>>>>>>> https://obrienlabs.net/how-to-setup-your-own-mqtt-broker/ 
>>>>>>>>>>>>> except the SLL stuff since I wouldn't need it.
>>>>>>>>>>>>>
>>>>>>>>>>>>> weewx.conf
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>     [[MQTT]]
>>>>>>>>>>>>>         server_url = mqtt://weewx:xxxxxx@127.0.0.1:1883/
>>>>>>>>>>>>>         topic = weather/#
>>>>>>>>>>>>>         unit_system = US
>>>>>>>>>>>>>         binding = archive, loop
>>>>>>>>>>>>>         aggregation = aggregate
>>>>>>>>>>>>>
>>>>>>>>>>>>> and
>>>>>>>>>>>>>
>>>>>>>>>>>>> # cat /etc/mosquitto/conf.d/myconfig.conf
>>>>>>>>>>>>> persistence false
>>>>>>>>>>>>>  
>>>>>>>>>>>>> allow_anonymous true
>>>>>>>>>>>>> password_file /etc/mosquitto/passwd
>>>>>>>>>>>>>  
>>>>>>>>>>>>> acl_file /etc/mosquitto/acl
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> listener 1883 localhost
>>>>>>>>>>>>> listener 8883
>>>>>>>>>>>>> protocol mqtt
>>>>>>>>>>>>>  
>>>>>>>>>>>>> # websockets
>>>>>>>>>>>>> listener 9001
>>>>>>>>>>>>> protocol websockets
>>>>>>>>>>>>>
>>>>>>>>>>>>> # cat /etc/mosquitto/acl
>>>>>>>>>>>>> # Allow anonymous access to the sys
>>>>>>>>>>>>> topic read $SYS/#
>>>>>>>>>>>>>  
>>>>>>>>>>>>> # Allow anonymous to read weather
>>>>>>>>>>>>> topic read weather/#
>>>>>>>>>>>>>  
>>>>>>>>>>>>> # weewx readwrite to the loop
>>>>>>>>>>>>> user weewx
>>>>>>>>>>>>> topic weather/#
>>>>>>>>>>>>>
>>>>>>>>>>>>> This test line works
>>>>>>>>>>>>>
>>>>>>>>>>>>> mosquitto_pub -h localhost -t "weather/test" -m "hello world. 
>>>>>>>>>>>>> this is to the weather topic with authentication" -u weewx -P 
>>>>>>>>>>>>> xxxxxx
>>>>>>>>>>>>>
>>>>>>>>>>>>> But index page is showing *Connecting to weather station real 
>>>>>>>>>>>>> time data.*
>>>>>>>>>>>>>
>>>>>>>>>>>>> MQTT is posting.....
>>>>>>>>>>>>>
>>>>>>>>>>>>> Dec 26 23:19:39 raspberrypi weewx[6544]: restx: MQTT: 
>>>>>>>>>>>>> Published record 2018-12-26 23:19:39 PST (1545895179)
>>>>>>>>>>>>> Dec 26 23:19:45 raspberrypi weewx[6544]: restx: MQTT: 
>>>>>>>>>>>>> Published record 2018-12-26 23:19:45 PST (1545895185)
>>>>>>>>>>>>>
>>>>>>>>>>>>> So I don't know what I did worng. I restraced all steps and I 
>>>>>>>>>>>>> did it correctly.
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Friday, December 7, 2018 at 2:12:23 PM UTC-8, Pat wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> The last thread was getting a bit long. So I've started a new 
>>>>>>>>>>>>>> one. 
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Belchertown Skin 0.8.1 has been released which fixes a couple 
>>>>>>>>>>>>>> of bugs. See the release notes, and install instructions here:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> https://github.com/poblabs/weewx-belchertown/releases
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to