JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.02k stars 2.37k forks source link

OpenWeatherMap API Segment .03 appended to the Temperature #2591

Closed TrapTheOnly closed 2 years ago

TrapTheOnly commented 2 years ago

Code of Conduct

What happened?

I have the OWM segment active in my theme, and for the whole time I have been using it, no matter in which city I am or what temperature it is outside, the returned temperature always has a .03 appended to it. I have tried to fix this issue, but there have been no reports of such bug in here before, as well as the code of the segment seems to work fine. It is just some bug that really annoys. image

Theme

{
    "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
    "blocks": [
        {
            "alignment": "left",
            "segments": [
                {
                    "background": "#292929",
                    "foreground": "#26C6DA",
                    "leading_diamond": "\u256d\u2500\ue0b2",
                    "style": "diamond",
                    "type": "os"
                },
                {
                    "background": "#292929",
                    "foreground": "#fb7e14",
                    "properties": {
                        "always_enabled": true,
                        "style": "austin",
                        "threshold": 500
                    },
                    "style": "powerline",
                    "type": "executiontime"
                },
                {
                    "background": "#292929",
                    "foreground": "#26C6DA",
                    "style": "plain",
                    "type": "root"
                },
                {
                    "background": "#292929",
                    "foreground": "#D4E157",
                    "style": "plain",
                    "type": "poshgit"
                },
                {
                    "type": "wifi",
                    "style": "powerline",
                    "background": "#292929",
                    "foreground": "#fb7e14",
                    "template": "<#fb7e14>\ue0b1</> <#26C6DA></>  {{ .SSID }} <#fb7e14>\ue0b1</> "
                },
                {
                    "type": "ytm",
                    "style": "powerline",
                    "powerline_symbol": "\uE0B0",
                    "foreground": "#fb7e14",
                    "background": "#292929",
                    "properties": {
                        "playing_icon": "\uE602",
                        "paused_icon": "\uF8E3",
                        "stopped_icon": "\uF04D"
                    },
                    "template": "<#26C6DA>{{ .Icon }}</> {{ if ne .Status \"stopped\" }}{{ .Artist }} - {{ .Track }}{{ end }} <#fb7e14>\ue0b1</>"
                },
                {
                    "background": "#292929",
                    "background_templates": [
                        "{{ if gt .Code 0 }}#292929{{ end }}"
                    ],
                    "foreground": "#26C6DA",
                    "properties": {
                        "always_enabled": true,
                        "display_exit_code": true
                    },
                    "style": "diamond",
                    "trailing_diamond": "\ue0b4",
                    "type": "exit"
                }
            ],
            "type": "prompt"
        },
        {
            "alignment": "right",
            "segments": [
                {
                    "background": "#292929",
                    "foreground": "#fb7e14",
                    "leading_diamond": "\ue0b6",
                    "style": "diamond",
                    "template": " {{ if .SSHSession }}<#26C6DA>\uf817</> {{ end }}{{ .UserName }} <#26C6DA></>  {{ .HostName }} <#fb7e14>\ue0b3</> ",
                    "type": "session"
                },
                {
                    "background": "#292929",
                    "foreground": "#fb7e14",
                    "properties": {
                        "apikey": "API_KEY",
                        "cache_timeout": 10,
                        "http_timeout": 2000,
                        "location": "CITY, COUNTRY",
                        "units": "metric"
                    },
                    "style": "diamond",
                    "template": "<#26C6DA></> {{.Temperature}}{{.UnitIcon}} <#fb7e14>\ue0b3</> ",
                    "type": "owm"
                },
                {
                    "background": "#292929",
                    "foreground": "#fb7e14",
                    "properties": {
                        "time_format": "15:04"
                    },
                    "style": "diamond",
                    "template": "{{ .CurrentDate | date .Format }} <#26C6DA>\uf017</> ",
                    "trailing_diamond": "\ue0b4",
                    "type": "time"
                },
                {
                    "background": "transparent",
                    "style": "diamond",
                    "template": "\u2800",
                    "type": "text"
                }
            ],
            "type": "prompt"
        },
        {
            "alignment": "left",
            "newline": true,
            "segments": [
                {
                    "background": "#fb7e14",
                    "foreground": "#292929",
                    "leading_diamond": "\u2570\u2500\ue0b6",
                    "properties": {
                        "always_enabled": true
                    },
                    "style": "diamond",
                    "trailing_diamond": "\ue0b4",
                    "type": "path"
                }
            ],
            "type": "prompt"
        }
    ],
    "final_space": true,
    "version": 2
}

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

Version: 8.5.0

Segments:

ConsoleTitle(false)  -   0 ms -
os(true)             -   0 ms - ╭─ 
executiontime(true)  -   0 ms -  0ms
root(false)          -   0 ms -
poshgit(false)       -   0 ms -
wifi(true)           -   1 ms -    Wifi 2 (5ghz) 
ytm(false)           -  34 ms -
exit(true)           -   0 ms -   
session(true)        -   0 ms -  User  UserPC 
owm(true)            -   1 ms -  29.03°C 
time(true)           -   0 ms - 15:12  
text(true)           -   0 ms - ⠀
path(true)           -   0 ms - ╰─ ~ 

Run duration: 49.4573ms

Cache path: C:\Users\User\AppData\Local\oh-my-posh

Config path: C:\Users\User\AppData\Local\Programs\oh-my-posh\themes\lambdageneration.omp.json

Logs:

2022/07/29 15:12:07 debug: Getenv
C:\Users\User\AppData\Local
2022/07/29 15:12:07 Getenv duration: 555.7µs, args: LOCALAPPDATA
2022/07/29 15:12:07 CachePath duration: 555.7µs, args:
2022/07/29 15:12:07 debug: Getenv
C:\Users\User\AppData\Local\Programs\oh-my-posh\themes\lambdageneration.omp.json
2022/07/29 15:12:07 Getenv duration: 0s, args: POSH_THEME
2022/07/29 15:12:07 Shell duration: 8.8158ms, args:
2022/07/29 15:12:07 resolveConfigPath duration: 8.8158ms, args:
2022/07/29 15:12:07 Init duration: 9.3715ms, args:
2022/07/29 15:12:07 Flags duration: 0s, args:
2022/07/29 15:12:07 config.loadConfig duration: 517.5µs, args:
2022/07/29 15:12:07 Flags duration: 0s, args:
2022/07/29 15:12:07 debug: Getenv

2022/07/29 15:12:07 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/07/29 15:12:07 WindowsRegistryKeyValue duration: 0s, args: HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 debug: WindowsRegistryKeyValue
ColorizationColor(DWORD): 0xC4434C5E
2022/07/29 15:12:07 Root duration: 0s, args:
2022/07/29 15:12:07 Shell duration: 0s, args:
2022/07/29 15:12:07 ErrorCode duration: 0s, args:
2022/07/29 15:12:07 IsWsl duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 debug: User
User
2022/07/29 15:12:07 User duration: 0s, args:
2022/07/29 15:12:07 debug: Host
UserPC
2022/07/29 15:12:07 Host duration: 517.2µs, args:
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 517.2µs, args:
2022/07/29 15:12:07 Flags duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 Shell duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 ExecutionTime duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 Shell duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 Root duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 debug: Getenv

2022/07/29 15:12:07 Getenv duration: 0s, args: POSH_GIT_STATUS
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 WifiNetwork duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 Shell duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 error: HTTPRequest
Get "http://127.0.0.1:9863/query": context deadline exceeded
2022/07/29 15:12:07 HTTPRequest duration: 34.9854ms, args: http://127.0.0.1:9863/query
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 ErrorCode duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 Shell duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 Flags duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 debug: Getenv

2022/07/29 15:12:07 Getenv duration: 0s, args: SSH_CONNECTION
2022/07/29 15:12:07 debug: Getenv

2022/07/29 15:12:07 Getenv duration: 0s, args: SSH_CLIENT
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 Shell duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 Shell duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 Shell duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 Shell duration: 0s, args:
2022/07/29 15:12:07 Flags duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 Flags duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 Flags duration: 0s, args:
2022/07/29 15:12:07 debug: Pwd
C:\Users\User
2022/07/29 15:12:07 Pwd duration: 0s, args:
2022/07/29 15:12:07 debug: Home
C:\Users\User
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 PathSeparator duration: 0s, args:
2022/07/29 15:12:07 GOOS duration: 0s, args:
2022/07/29 15:12:07 IsWsl duration: 0s, args:
2022/07/29 15:12:07 StackCount duration: 0s, args:
2022/07/29 15:12:07 DirIsWritable duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 TemplateCache duration: 0s, args:
2022/07/29 15:12:07 Shell duration: 0s, args:
2022/07/29 15:12:07 debug: Getenv
C:\Users\User\AppData\Local
2022/07/29 15:12:07 Getenv duration: 0s, args: LOCALAPPDATA
2022/07/29 15:12:07 CachePath duration: 0s, args:
2022/07/29 15:12:07 Flags duration: 0s, args:
JanDeDobbeleer commented 2 years ago

@TrapTheOnly the data type is incorrect, so changing that to a nicely rounded integer.

lnu commented 2 years ago

It means that we lose the 2 digits precision we had before and limit the output to always a rounded degree value.

JanDeDobbeleer commented 2 years ago

@lnu yes. Because I figured nobody really cares whether it's 38.6 or 38.7 and 39 is perfectly fine. I've yet to see the weather channel report it otherwise as well.

github-actions[bot] commented 9 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.