# Https post hubaction

**URL:** <https://community.smartthings.com/t/https-post-hubaction/146603>\
**Category:** General Discussion\
**Tags:** developers\
**Created:** [December 16, 2018, 7:58pm UTC](https://community.smartthings.com/t/https-post-hubaction/146603 "2018-12-16T19:58:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrmrmrmr](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@mrmrmrmr](https://community.smartthings.com/u/mrmrmrmr)\
**Post date:** [December 16, 2018, 7:58pm UTC](https://community.smartthings.com/t/https-post-hubaction/146603/1 "2018-12-16T19:58:40Z")

</div>

hi,

I need t send hubaction command with HTTPS POST method.

I 've modified one of my working codes to https as following. But I see no packets going out from the Hub to the destination.  
What am I missing ?

```
	def host = "192.168.254.44:443"
    def method = "POST"
    def path = "/v1/say_text"   
    def headers = [:] 
    headers.put("HOST", "$host")
    headers.put("content-type", "application/json")
    headers.put("Authorization", "Bearer $state.token")
    try {
    def body="""{"text": "Pizza","use_vector_voice": true,"duration_scalar": 1.0}"""

    def hubAction = new physicalgraph.device.HubAction(
    	method: method,
    	path: path,
    	headers: headers,
        body: body
        )
    hubAction
    }
    catch (Exception e) {
    	log.debug "Hit Exception $e on $hubAction"
    }

```

thanks.

---

<div class="post-metadata">

**Author:** ![TonyFleisher](https://avatars.discourse-cdn.com/v4/letter/t/d26b3c/32.png) [@TonyFleisher](https://community.smartthings.com/u/TonyFleisher)\
**Post date:** [December 16, 2018, 9:03pm UTC](https://community.smartthings.com/t/https-post-hubaction/146603/2 "2018-12-16T21:03:05Z")

</div>

is the destination on the same network as the hub?

---

<div class="post-metadata">

**Author:** ![mrmrmrmr](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@mrmrmrmr](https://community.smartthings.com/u/mrmrmrmr)\
**Post date:** [December 16, 2018, 9:38pm UTC](https://community.smartthings.com/t/https-post-hubaction/146603/3 "2018-12-16T21:38:16Z")

</div>

yes. destination is 192.168.254.44 and the hub is 192.168.254.241

---

<div class="post-metadata">

**Author:** ![Ryan780](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/ryan780/32/103505_2.png) [@Ryan780](https://community.smartthings.com/u/Ryan780)\
**Post date:** [December 16, 2018, 9:46pm UTC](https://community.smartthings.com/t/https-post-hubaction/146603/4 "2018-12-16T21:46:00Z")

</div>

I don’t believe that it supports HTTPS requests. Where is it going to get the certificate?

> [@httpGet with https and self-signed certificate](https://community.smartthings.com/t/httpget-with-https-and-self-signed-certificate/434):
>
> I have an IP device with a web service that I’m trying to get to (actually, it’s on my LAN and I’m forwarding a port), and the service is accessible via HTTPS. I’m trying to send an httpGet request; however, the console gives an error and reads “peer not authenticated”. The IP device is using a self-signed certificate. Is there currently a way to trust self-signed certificates using httpGet with the https protocol? If so, can someone please post a code sample? Thanks!

---

<div class="post-metadata">

**Author:** ![mrmrmrmr](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@mrmrmrmr](https://community.smartthings.com/u/mrmrmrmr)\
**Post date:** [December 16, 2018, 9:47pm UTC](https://community.smartthings.com/t/https-post-hubaction/146603/5 "2018-12-16T21:47:35Z")

</div>

what do you mean by “it” ?  
Hub ?  
I’ve seen examples of Hubaction command to port 443  
so if it is not https , why port 443 ?  
besides, I don’t want to use any client side certificates.

---

<div class="post-metadata">

**Author:** ![Ryan780](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/ryan780/32/103505_2.png) [@Ryan780](https://community.smartthings.com/u/Ryan780)\
**Post date:** [December 16, 2018, 9:50pm UTC](https://community.smartthings.com/t/https-post-hubaction/146603/6 "2018-12-16T21:50:54Z")

</div>

All I know is that they aren’t supported, as you can see by the other thread i linked to. Maybe try searching the forum for HTTPS, there are a lot of threads on it.

---

<div class="post-metadata">

**Author:** ![mrmrmrmr](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@mrmrmrmr](https://community.smartthings.com/u/mrmrmrmr)\
**Post date:** [December 16, 2018, 9:55pm UTC](https://community.smartthings.com/t/https-post-hubaction/146603/7 "2018-12-16T21:55:05Z")

</div>

well, I really don’t understand.  
because when I use a httppost command to an external REST API with https , I receive the correct answer.  
so , we can call https for external calls.

now, I also need to send a call to internal IP from the HUB.  
if you say that HUB can not handle https, I can understand it.

but currently I am not able to see packet to the https server with the code sample I’ve written.  
first, I have to figure out what’s missing there , and see that the packet is going to the correct destination.  
then, if it does not support https , I will be stuck.

---

<div class="post-metadata">

**Author:** ![ritchierich](https://avatars.discourse-cdn.com/v4/letter/r/a4c791/32.png) [@ritchierich](https://community.smartthings.com/u/ritchierich)\
**Post date:** [December 17, 2018, 3:04am UTC](https://community.smartthings.com/t/https-post-hubaction/146603/8 "2018-12-17T03:04:57Z")

</div>

You new to convert the ip and port to Hex. See this doc for examples:  
[https://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/building-lan-connected-device-types/building-the-device-type.html](https://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/building-lan-connected-device-types/building-the-device-type.html)

---

<div class="post-metadata">

**Author:** ![orangebucket](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/orangebucket/32/81590_2.png) [@orangebucket](https://community.smartthings.com/u/orangebucket)\
**Post date:** [December 17, 2018, 7:15am UTC](https://community.smartthings.com/t/https-post-hubaction/146603/9 "2018-12-17T07:15:18Z")

</div>

I don’t see a `sendHubCommand()` to actually run the HubAction you defined. Is the `hubAction` line effectively the last line of a command method and so acting like a `return hubAction` to get Smart things to run it for you?

---

<div class="post-metadata">

**Author:** ![orangebucket](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/orangebucket/32/81590_2.png) [@orangebucket](https://community.smartthings.com/u/orangebucket)\
**Post date:** [December 17, 2018, 7:27am UTC](https://community.smartthings.com/t/https-post-hubaction/146603/10 "2018-12-17T07:27:59Z")

</div>

> [@ritchierich](#):
>
> You new to convert the ip and port to Hex. See this doc for examples:  
> [https://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/building-lan-connected-device-types/building-the-device-type.html](https://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/building-lan-connected-device-types/building-the-device-type.html)

You can send it in hex if you like but you don’t have to.

What the document doesn’t tell you is that they allow for you already having set the device network ID to the hex IP and port format so parse will get responses and they are using that as a fallback source of the host address and port. They are actually converting it from hex before using it in the host header though.

---

<div class="post-metadata">

**Author:** ![mrmrmrmr](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@mrmrmrmr](https://community.smartthings.com/u/mrmrmrmr)\
**Post date:** [December 17, 2018, 12:33pm UTC](https://community.smartthings.com/t/https-post-hubaction/146603/11 "2018-12-17T12:33:54Z")

</div>

> [@orangebucket](#):
>
> I don’t see a `sendHubCommand()` to actually run the HubAction you defined.

in my previous experience, I did not use sendHubActionCommand() and it did work.  
Now I tried both ways but neither was successful.  
Packets don’t go out …  
how can I troubleshoot further ?
