Is there a Dynamic DNS script?

All kinds of 'OS' scripts

Moderator: leecollings

Post Reply
BarryT
Posts: 358
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Is there a Dynamic DNS script?

Post by BarryT »

Hi all, is there a (freedns) script around that will update a dynamic dns url and push data into domoticz?
I have a direct url wich only needs to be opened to update my dynamic dns wan ip, it would be great to do this from inside domoticz.

Thanks a lot!

Merry Christmas
Raspberry / ESP Boards / Relais / Milight / Hue / OTGW / P1 / Xiaomi / RFXCom / RFLink / ZWave / Conbee II / Z2M / MQTT / A lot of scripts and many more..
Software: Linux, Android and Windows
User avatar
habahabahaba
Posts: 190
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: Is there a Dynamic DNS script?

Post by habahabahaba »

If you need only to open known url you can use dzvents script that will make it by timer as often as you need
by using
domoticz.openURL('<YOUR_URL>')
BarryT
Posts: 358
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Is there a Dynamic DNS script?

Post by BarryT »

So, only curling an url is not the thing, i want also a virtual device with wan ip and when it has updated.. any examples? Pardon me, maybe i was not clear enough. Thanks!
Raspberry / ESP Boards / Relais / Milight / Hue / OTGW / P1 / Xiaomi / RFXCom / RFLink / ZWave / Conbee II / Z2M / MQTT / A lot of scripts and many more..
Software: Linux, Android and Windows
User avatar
habahabahaba
Posts: 190
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: Is there a Dynamic DNS script?

Post by habahabahaba »

Still not sure what do you want.
Any notifyer with you current ip ?
BarryT
Posts: 358
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Is there a Dynamic DNS script?

Post by BarryT »

I want domoticz let do my dynamic dns update and update an virtual device as well when the ip has changed and updated 🤭☺️
Raspberry / ESP Boards / Relais / Milight / Hue / OTGW / P1 / Xiaomi / RFXCom / RFLink / ZWave / Conbee II / Z2M / MQTT / A lot of scripts and many more..
Software: Linux, Android and Windows
User avatar
habahabahaba
Posts: 190
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: Is there a Dynamic DNS script?

Post by habahabahaba »

So, first you need to know what is your IP now (for example here)
Then you can push it where you want
BarryT
Posts: 358
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Is there a Dynamic DNS script?

Post by BarryT »

I know, but that is still not a script 🙂
I was hoping that someone has some script or similar already 😁
Raspberry / ESP Boards / Relais / Milight / Hue / OTGW / P1 / Xiaomi / RFXCom / RFLink / ZWave / Conbee II / Z2M / MQTT / A lot of scripts and many more..
Software: Linux, Android and Windows
User avatar
habahabahaba
Posts: 190
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: Is there a Dynamic DNS script?

Post by habahabahaba »

Code: Select all

-- 123

return {
	on = {
		timer = {
			'every minute' -- just an example to trigger the request
		},
		httpResponses = {
			'GettingIP' -- название должно совпадать с методом Callback ниже
		}
	},
	logging = {
		level = domoticz.LOG_INFO,
		marker = 'GettingIP',
	},
	execute = function(domoticz, item)
	    
	    local ip_url = 'https://api.ipify.org/?format=json' 

		if (item.isTimer) then
			domoticz.openURL({
			    method = 'GET',
				url = ip_url,
				callback = 'GettingIP', -- see httpResponses above.
			}).afterSec(1)
		end

		if (item.isHTTPResponse) then
		    
			if (item.ok) then
				if (item.isJSON) then
				    
				    local jsonParser = require('JSON')
					local json1 = jsonParser:decode(item.data)
					
                       local currentIP = json1['ip'] -- 
  
                        local devIdx = 40 -- idx of your text device with current ip
                        domoticz.devices(devIdx).updateText('Current ip: '..currentIP)
                        domoticz.log('Current IP: '.. currentIP, domoticz.LOG_INFO)
                        
                        --- uncomment and put your data
                        --[[domoticz.openURL({
            			    method = 'POST',
            				url = '<YOUR POST URL WITH CUR IP>',
            				callback = 'Updating IP', -- see httpResponses above.
            			  }).afterSec(1)]]--

				end
		else
		        --OOOPS
				domoticz.log('ERROR', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
        end

		end

	end
}
2023-12-26_21-30-12.png
2023-12-26_21-30-12.png (7.68 KiB) Viewed 1080 times
BarryT
Posts: 358
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Is there a Dynamic DNS script?

Post by BarryT »

habahabahaba wrote: Tuesday 26 December 2023 19:25

Code: Select all

-- 123

return {
	on = {
		timer = {
			'every minute' -- just an example to trigger the request
		},
		httpResponses = {
			'GettingIP' -- название должно совпадать с методом Callback ниже
		}
	},
	logging = {
		level = domoticz.LOG_INFO,
		marker = 'GettingIP',
	},
	execute = function(domoticz, item)
	    
	    local ip_url = 'https://api.ipify.org/?format=json' 

		if (item.isTimer) then
			domoticz.openURL({
			    method = 'GET',
				url = ip_url,
				callback = 'GettingIP', -- see httpResponses above.
			}).afterSec(1)
		end

		if (item.isHTTPResponse) then
		    
			if (item.ok) then
				if (item.isJSON) then
				    
				    local jsonParser = require('JSON')
					local json1 = jsonParser:decode(item.data)
					
                       local currentIP = json1['ip'] -- 
  
                        local devIdx = 40 -- idx of your text device with current ip
                        domoticz.devices(devIdx).updateText('Current ip: '..currentIP)
                        domoticz.log('Current IP: '.. currentIP, domoticz.LOG_INFO)
                        
                        --- uncomment and put your data
                        --[[domoticz.openURL({
            			    method = 'POST',
            				url = '<YOUR POST URL WITH CUR IP>',
            				callback = 'Updating IP', -- see httpResponses above.
            			  }).afterSec(1)]]--

				end
		else
		        --OOOPS
				domoticz.log('ERROR', domoticz.LOG_ERROR)
				domoticz.log(item, domoticz.LOG_ERROR)
        end

		end

	end
}
2023-12-26_21-30-12.png
Great!! Thank you very much! Going to try tonight 👍🏾😁
Raspberry / ESP Boards / Relais / Milight / Hue / OTGW / P1 / Xiaomi / RFXCom / RFLink / ZWave / Conbee II / Z2M / MQTT / A lot of scripts and many more..
Software: Linux, Android and Windows
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest