use tunnel in production

This commit is contained in:
Torsten 2023-01-14 18:38:27 +02:00
parent d5b8d83096
commit 2a5d7de326
2 changed files with 12 additions and 6 deletions

View File

@ -13,16 +13,22 @@ class Entity < ApplicationRecord
def type
ha_id.split(".").first.capitalize
end
def self.ha_entities
res = response()
res.collect{|i| i["entity_id"]}.select{|i| i.include?("4a") || i.include?("2d")}
end
def self.response(path = "")
token = Rails.application.credentials[:ha_token]
all = RestClient.get( "10.30.39.238:8123/api/states#{path}" ,
{"Authorization" => "Bearer #{token}" })
res = JSON.parse(all.body)
host = Rails.credentials.weather_dev
host = Rails.credentials.weather_pro if Rails.env.production?
token = Rails.application.credentials.weather_token
begin
all = RestClient.get( "#{host}:8123/api/states#{path}" ,
{"Authorization" => "Bearer #{token}" })
res = JSON.parse(all.body)
rescue
[]
end
end
end

View File

@ -1 +1 @@
OaKTik0EStvonrwTuP2M/z94Dn97BOuyOeP0zCgiKOG0C3K9D7XLKwhboSBBprkWBxAadS3U+JXKr+uF3J72fE3DYO2O1Ruddx60CWi4XnIsUi2TUKDgHvvRJMMCp1hbclggixuqH3r5d+YVoFeEtp0XBE1JZscUSDEEG8m7+5WeBnuKa+cWu1OVFtgqn68AAD4Jr8wEp8agNIZlvZk/77nO5jmIpgzWlVsIgznDDdyZW7IK6jdVxKBrnu6HvfJqt8Np9nZnsQ+EtwioCQO5nvfYtM5lrHVOvVKxVnmaycKvC42Vh2MH8IUO2mQZAX5543FPBovmxRcQFqDgrHr6C4NQ2x7UHRxeD5RD6A9fZ4RaEAxKVRYWXL3YVkz+HUutJ+bKJMaMlPwnEBfYnshFJdI5ca57UpiUY+c09WikIDMjZjtCos4obwJbIX8Oy9/ClhSWEkoJBr1eZ3ieUZz66gKZvfiKgNhMnE/KBCj3CqUBmHLi5XfmKqdOlAf+EoZDm4XRbXd4BanmheJ4FWJeIQhFXM7lwIvv1q9PiuBP60Ss95dWQR4q7NZiu3LKkfAodZkgbPjPNzmUWlZsq0q4ze0Koz1XGki9vkx3hz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