Can anyone point me to a direction how to subscribe a sensor value to dweet. I would like to populate a freeboard with some values and since I do not want to open any inbound ports in my firewall I thought about using dweet since the values are not particulary secret. I tried to use httplink but am not succeeding to get a value out. Can anyone point me to some direction. For the record I'm not trying to set up MQTT or any other more elaborate system, just doing a put thru a wel defined API to dweet.io, that's it.
Ralph
send values to dweet
Moderator: leecollings
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: send values to dweet
Easy with a small PHP script:
Call the script by 'script://path/to/script/dweet.php?tag=Test&value=Hello' for a text message, or first pull the values you need with json and send those automatically.
Code: Select all
#!/usr/bin/php
<?php
if(isset($_REQUEST['tag'])&&isset($_REQUEST['value'])) {
$url = 'https://dweet.io/dweet/for/egregius';
$data = array($_REQUEST['tag'] => $_REQUEST['value']);
}
else {
echo "Nothing sent";
exit;
}
$options = array(
'http' => array(
'method' => 'POST',
'header' => "Content-Type: application/x-www-form-urlencoded\r\n",
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
-
- Posts: 40
- Joined: Monday 12 August 2013 11:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.x
- Location: Finland
- Contact:
Re: send values to dweet
Just got my Freeboard dashboard online. I used curl and jq to parse Domoticz sensors json, then curl again to push the data to Dweet. All this in a bash script. Scheduled in crontab to run every 10 mins. I'm not a developer so it's not pretty but working ok.
Who is online
Users browsing this forum: No registered users and 1 guest