User Tools

Site Tools


iot:aws:config:webhmi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
iot:aws:config:webhmi [2020/06/11 13:36] – created atolstoviot:aws:config:webhmi [2020/06/19 09:02] (current) – ↷ Links adapted because of a move operation atolstov
Line 1: Line 1:
 ===== Configure WebHMI =====  ===== Configure WebHMI ===== 
  
-There is a [[iot#webhmi_as_mqtt_publisher_client|WebHMI as MQTT Client]] considered [[iot|here]]. The only difference is the Broker's settings, that time you need to connect to AWS and identification is related to certificates also.  +There is a [[iot:tutorial:mqtt#webhmi_as_mqtt_publisher_client|WebHMI as MQTT Client]] considered [[:iot|here]]. The only difference is the Broker's settings, that time you need to connect to AWS and identification is related to certificates also.  
-Be sure that your bunch of certificate files are valid and binded to your Thing in AWS, to [[aws-integration#test_connection_via_pc_client|test it using MQTT.fx]] is highly recommended. +Be sure that your bunch of certificate files are valid and binded to your Thing in AWS, to [[iot:tutorial:aws-integration#test_connection_via_pc_client|test it using MQTT.fx]] is highly recommended. 
  
 The first thing is to create connection to AWS MQTT Broker. Click at "New connection". The first thing is to create connection to AWS MQTT Broker. Click at "New connection".
-{{ :wiki:iot:aws:wh:wh_no_reg_no_connections.png?direct |}}+{{ iot:aws:wh:wh_no_reg_no_connections.png?direct |}}
 Firstly select the "Device model: MQTT". Firstly select the "Device model: MQTT".
 Fill in the "Device address" from IoT Core [[http://docs.webhmi.com.ua/_media/wiki:iot:aws:shadow:aws_console_iot_interact_topics.png|Interact]] menu and 8883 port accoiding to [[https://docs.aws.amazon.com/iot/latest/developerguide/protocols.html|AWS Developer Guide]] Fill in the "Device address" from IoT Core [[http://docs.webhmi.com.ua/_media/wiki:iot:aws:shadow:aws_console_iot_interact_topics.png|Interact]] menu and 8883 port accoiding to [[https://docs.aws.amazon.com/iot/latest/developerguide/protocols.html|AWS Developer Guide]]
-{{ :wiki:iot:aws:wh:wh_connection_settings.png?direct |}}+{{ iot:aws:wh:wh_connection_settings.png?direct |}}
 Go to MQTT tab to copypaste certificates to WebHMI connection settings.  Go to MQTT tab to copypaste certificates to WebHMI connection settings. 
 At the moment you should configure MQTT.fx to work with AWS IoT Core Thing's Shadow. So, you have all files downloaded such as .pem and .crt.  At the moment you should configure MQTT.fx to work with AWS IoT Core Thing's Shadow. So, you have all files downloaded such as .pem and .crt. 
Line 18: Line 18:
  
 Pick the **TSL version v1.2** at the final. Pick the **TSL version v1.2** at the final.
-{{ :wiki:iot:aws:wh:wh_connection_settings_mqtt_tab.png?direct |}}+{{ iot:aws:wh:wh_connection_settings_mqtt_tab.png?direct |}}
 Now, there is a connection configured. Let's create a register which would correspond to MQTT topic. \\  Now, there is a connection configured. Let's create a register which would correspond to MQTT topic. \\ 
 Create a register. Create a register.
-{{ :wiki:iot:aws:wh:wh_no_reg_aws.png?direct |}}+{{ iot:aws:wh:wh_no_reg_aws.png?direct |}}
 Select the pre-created connection. Select the pre-created connection.
 Fill in the Topic name in the Address field. Fill in the Topic name in the Address field.
-{{ :wiki:iot:aws:wh:wh_reg_settings_main.png?direct |}}+{{ iot:aws:wh:wh_reg_settings_main.png?direct |}}
 Also, it is important to switch the value type to String. Also, it is important to switch the value type to String.
-{{ :wiki:iot:aws:wh:wh_reg_settings_value.png?direct |}} +{{ iot:aws:wh:wh_reg_settings_value.png?direct |}} 
-So to test the connection, let's act WebHMI as subscriber and act MQTT.fx as publisher and vice versa to see the both of clients works well. +So to test the connection, let's act WebHMI as subscriber and act MQTT.fx as publisher or vice versa to see the both of clients works well.  
-{{ :wiki:iot:aws:wh:wh_test_via_mqttfx_connections.png?direct |}}+To demostrate let's WebHMI act as Subscriber
 +{{ iot:aws:wh:wh_test_via_mqttfx_connections.png?direct |}}
  
-For know, it is WebHMI can post the data from real devices to various AWS Things, visualise with QuickSight tool and store this data in DynamoDB with possibility to import as .csv file to S3 bucket for example.+For now, it is WebHMI can post the data from real devices to various AWS Things, visualise with QuickSight tool and store this data in DynamoDB with possibility to import as .csv file to S3 bucket for example.
  
  
  
-==== JSON formatted payload ==== 
-It is widely used MQTT payload format JSON. 
-Let’s write a small script which will use inbuild library to encode any WebHMI register values to JSON formatted strings. 
-Here is the code example to encode a string type message with Amazon Web Services (AWS) [[https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-document-syntax.html|Thing Report Shadow]] JSON format. 
- 
-<code lua - AWS_thing_report.lua> 
-function main (userId) 
-    local decoded =  
-    { 
-    state =  
-        { 
-        reported = 
-            {  
-            timestamp         os.date("%Y-%m-%dT%H:%M:%S", os.time() - 3 * 60 * 60), 
-            message           "Hello, WebHMI!"             
-            } 
-        } 
-    } 
-    encoded = cjson.encode( decoded ) 
-                                        DEBUG(encoded) 
-    WriteReg("mqtt_publish", encoded); -- Test Publish (iot-test@MQTT WebHMI Client) 
-end 
- 
-</code> 
- 
-To check the result of script work let’s check “iot-test” subscribed topic in MQTT.fx. 
- 
-{{ ::wiki:mqtt:client:json:протокол_связи_mqtt_на_webhmi_json_encode_test.png?direct |}} 
- 
-//Hint: There is drop-down list with MQTT payload format selector in the lower right corner.// 
iot/aws/config/webhmi.1591882579.txt.gz · Last modified: 2020/06/11 13:36 by atolstov

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki